This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

3.1 preprocessor regression?


This code:

        #define anglequote(x) < ## x ## >
        #include anglequote(stdio.h)

Worked with gcc 2.95.3 but fails with gcc 3.1 like:
        
        $ gcc -c foo.c
        foo.c:2:28: missing terminating > character
        foo.c:2:29: stdio: no such file or directory

If I remove the #include keyword and then run the file through the
preprocessor, I get:

        foo.c:2:19: warning: pasting "<" and "stdio" does not give a valid preprocessing token
        foo.c:2:19: warning: pasting "h" and ">" does not give a valid preprocessing token

I read the preprocessor section of the C9X standard, and I think what
I want to do is valid.  As I read 6.10.3.3, when the anglequote macro
is expanded, both ## operators should be replaced before the macro is
rexamined for further expansion.  So it shouldn't matter that "<stdio"
and "h>" are not valid preprocessor tokens, as <stdio.h> is.  Perhaps
I'm all wet though.  Knowing that would be useful too...

The anglequote macro is actually a cut down version of a set of macros
from some code I recently ran across that slices together header-names
to include based on the settings of various macros.

Thanks,

        --jtc


-- 
J.T. Conklin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]