title: __attribute__() macro and its effect on Visual Studio 2010 based projects
body: <p>I have some legacy code that has got conditional preprocessing e.g. <code>#ifdef</code> and <code>#else</code> where I have found the use of <code>__attribute__</code> macro. I have done a quick research and found out that it is specific to GNU compilers. I have to use this legacy code in Visual Studio 2010 using MSVC10 compiler and apparently it is complaining everywhere it sees <strong>attribute</strong>((unused)) even though it is protected by <code>#ifndef</code> and <code>#ifdef</code>s. An example is:</p>
  
  <pre><code>#ifdef __tone_z__
    static const char *mcr_inf
  #else
    static char *mcr_inf
  #endif
  #ifndef _WINDOWS
  __attribute__(( unused ))    % this is causing all the problem!!
  #endif
  = "@(#) bla bla copyright bla";
  
  
  
  #ifdef __tone_z__
     static const char *mcr_info_2a353_id[2]
  #else
     static       char *mcr_info_2a353_id[2]
  #endif
  __attribute__(( unused )) = { "my long copyright info!" } ;
  </code></pre>
  
  <p>I am really struggling to understand if it is very poorly planned code or is it just my misunderstanding. How do I avoid the usual compiler and linker errors with this <code>__attribute__()</code> directive? I have started to get C2061 errors (missing identifiers/unknown). I have got all necessary header files and nothing is missing, may be except GNU compiler (which I don't want!!).</p>
  
  <p>Also, it seems that the end of line character <code>;</code> is also being messed up when I take to code in windows....argh....I mean the UNIX end-of-line and Windows EOL how can I use this code without modifying the body....I can define in my property sheet about the _WINDOWS thingy, but cannot automatically adjust the EOL character recognition.</p>
  
  <p>ANy help is appreciated!
  Thanks.</p>