__attribute __ () and its impact on projects based on Visual Studio 2010

I have legacy code that has conditional preprocessing, for example. #ifdefand #elsewhere I found using a macro __attribute__. I did a quick research and found out that it is specific to GNU compilers. I have to use the old code in Visual Studio 2010 using MSVC10 compiler and, apparently, he complains everywhere, he sees the attribute ((unused)), although it is protected #ifndefand #ifdefs. Example:

#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!" } ;

, , . __attribute__()? C2061 ( /). , , , GNU ( !!).

, , ; , windows.... argh.... UNIX end-of-line Windows EOL, .... _WINDOWS thingy, EOL.

! .

+4
1

, _WINDOWS, , , __attibute__ .

, :

#define __attribute__(A) /* do nothing */

__attribute__ .

, , , :

#ifdef _GNUC
  #define ATTR_UNUSED __attribute__((unused))
#else
  #define ATTR_UNUSED
#endif

static TONE_Z_CONST char *integ_func ATTR_UNUSED = "my copyright info";

( __tone_z__ .)

+14

All Articles