From: Borut R. <bor...@si...> - 2006-12-12 19:14:08
|
Thank you very much for the explanation, Erik! Actually I found a comment for do_pragma() function in cpplib.c: /* Pragmata handling. We handle some, and pass the rest on to the front end. C99 defines three pragmas and says that no macro expansion is to be performed on them; whether or not macro expansion happens for other pragmas is implementation defined. This implementation never macro-expands the text after #pragma. */ This shows that gcc guys decided not to expand macros in any pragmas, which makes sense to me since it wold be really a mess if macros would be expanded in some (STDC) and not expanded in other pragmas. So it seems that we don't have other possibility then to expand all macros in pragmas in header files (we can use the old sdcpp to do it) and/or to move them from header files to pic14devices.txt. That this process can be automated with a script. Raphael, if you explain me what exactly has to be done, I can do it. Is there any reason why currently some memmaps are in header files and other in pic14devices.txt? I think that the memmap (and all other) pragmas should verify it's parameters types and throw a compile time error if they are not correct. Borut Erik Petrich wrote: > On Tue, 12 Dec 2006, Borut Razem wrote: > > >> At the first glance it seems that the macros in pragma lines are not >> preprocessed. >> But anyway, do you have an idea why the problem is only on ppc64 >> platform? This actually miss leaded me :-( >> >> I made a quick test on gcc cpp, and it seems that the behaviour is the >> same: macros in pragma lines are not preprocessed!? >> >> I don't know what the standard says about this issue. If the gcc cpp is >> correct, then we have to change all macros in pragmas with the actual >> values :-( >> > > There's a footnote in ISO/IEC 9899:1999 subclause 6.10.6 that answers > this very question: > > "An implementation is not required to perform macro replacement in > pragmas, but it is permitted except for in standard pragmas (where STDC > immediately follows pragma)." > > Erik > > > |