Strange warning during C compilation

Franz Sirl Franz.Sirl-ppc at lauterbach.com
Tue Nov 6 20:55:04 EST 2001


At 09:55 06.11.2001, Emmanuel STAPF wrote:

>Hi,
>
>I'm getting the following warning: warning: pasting "h" and "(" does not
>give a valid preprocessing token
>
>Here is the piece of code that shows the problem:
>
>#define CAT(a,b)a ## b
>#define TEST_MACRO(n,c,a)       (CAT(n,_done) ? CAT(n,_result) :
>CAT(c,a))
>
>extern void* h();
>extern void f(void*);
>extern void* h_result;
>extern char h_done;
>
>void k (void* titi)
>{
>         f((TEST_MACRO(h,h,())));
>}
>
>If you save this code in a test.c file and use `gcc -Wall -c test.c'
>here is what you get:
>
>test.c:11:12: warning: pasting "h" and "(" does not give a valid
>preprocessing token
>
>Any idea what is wrong here? My gcc version is 3.01. It was also
>happening on my gcc version 2.96 with a slightly different error
>message: warning: pasting would not give a valid preprocessing token. I
>tried with an even older version (2.7.2.3) and no warnings.

h and ( are separate tokens, no need to paste them. Remember, the C
preprocessor is token based, it's not a text processor.

Franz.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list