Hi, I think I should rename the constants to be a little less likely to collide. I think just upcasing them might be good enough? - Daniel On Tue, Aug 25, 2009 at 12:20 AM, Duncan Sands<baldrick at free.fr> wrote:> Hi Venkatraman, > >> The current version in SVN fails to compile in sparc machines since >> gcc defines "sparc" as a macro in sparc machines that expands to 1 >> (see below) but Triple.h defines "sparc" as a enum constant. >> >> $ cpp -dM /dev/null | grep sparc >> #define sparc 1 >> #define __sparc__ 1 >> #define __sparc 1 >> >> The attached patch fixes this problem by renaming sparc to sparc_. > > the same thing happens with mips: "mips" is defined to be a numerical > value on mips machines, and this breaks Triple.h. > > Ciao, > > Duncan. >
On Aug 25, 2009, at 12:32 AM, Daniel Dunbar wrote:> Hi, > > I think I should rename the constants to be a little less likely to > collide. I think just upcasing them might be good enough?It should, this is the pattern generally emitted by all of the backends.>>> >>> $ cpp -dM /dev/null | grep sparc >>> #define sparc 1 >>> #define __sparc__ 1 >>> #define __sparc 1There's likely an all uppercase one as well, but afaik no camel case one. -eric
Instead of just upcasing them, can we add prefix ARCH_? --Venkatraman On Tue, Aug 25, 2009 at 2:36 AM, Eric Christopher<echristo at apple.com> wrote:> > On Aug 25, 2009, at 12:32 AM, Daniel Dunbar wrote: > >> Hi, >> >> I think I should rename the constants to be a little less likely to >> collide. I think just upcasing them might be good enough? > > It should, this is the pattern generally emitted by all of the backends. > >>>> >>>> $ cpp -dM /dev/null | grep sparc >>>> #define sparc 1 >>>> #define __sparc__ 1 >>>> #define __sparc 1 > > There's likely an all uppercase one as well, but afaik no camel case one. > > -eric >
On Aug 25, 2009, at 12:32 AM, Daniel Dunbar wrote:> Hi, > > I think I should rename the constants to be a little less likely to > collide. I think just upcasing them might be good enough?Why not just use "#undef sparc" at the top of the file like we do for other macro pollution stuff? -Chris
On Aug 25, 2009, at 2:24 PM, Chris Lattner wrote:> > On Aug 25, 2009, at 12:32 AM, Daniel Dunbar wrote: > >> Hi, >> >> I think I should rename the constants to be a little less likely to >> collide. I think just upcasing them might be good enough? > > Why not just use "#undef sparc" at the top of the file like we do for > other macro pollution stuff?I guess if there's not going to be anything that's target dependently compiled for any file that includes it then that's probably best. -eric