This is the mail archive of the gcc-bugs@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]

Re: preprocessor/9650: string literal contactenation doesn't work with #include


i tried that but it doesn't work consistently with the newer prescan semantics. 
for example, if i did this:

#include COMP_INC(me, mips/hello.h)

you'd think it'd expand with the below method:

#include "me/include/mips/hello.h"

unfortunately, mips is a predefined macro.  so it expands to "1".  is there a
work around for this without having to undefine it?

frey


Neil Booth wrote:
> 
> frey waid wrote:-
> 
> > that's what i was doing before.  so i had this:
> >
> > #include COMP_INC(comp,file)
> >
> > #define COMP_INC(comp,file)   #comp "/include/" #file
> >
> > do you have another method in mind?
> 
> Sure 8-)
> 
> #include COMP_INC (comp, file)
> 
> #define COMP_INC(comp, file) COMP (comp, file)
> #define COMP(prefix, suffix) str(comp/include/file)
> #define str(x) #x
> 
> Not tested, but you get the idea.
> 
> Neil.


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