views:

18

answers:

1

Is it possible with gcc to eliminate the warning below without eliminating all warnings?

pasting "/" and "/" does not give a valid preprocessing token

For a certain platform, I must use a specific cross-compiler, but I can use make, so I use gcc to create the dependencies.

I know that I'm passing the “//” token to the compiler and it’s not a problem, so I’d like gcc to stop complaining about it.

A: 

The only way I've found so far to work around this issue is to just hide this construct from g++, like so:

#if __GNUC__
  #define EMPTY
#else
  #define SLASH(s) /##s
  #define EMPTY ; SLASH(/)
#endif

Since I'm only using g++ here to create dependencies, I can just hide the code.

Tom the Toolman

related questions