[LLVMdev] COFF.h and windows.h conflict
Óscar Fuentes
ofv at wanadoo.es
Wed Aug 28 11:05:10 PDT 2013
Reid Kleckner <rnk at google.com> writes:
> We have to provide definitions so that we can produce COFF on platforms
> that do not have winnt.h.
Surely there is no need to use the exact same names.
> Ours are nicely namespaced under ::llvm::, but
> winnt's are global macros, which is crummy.
Windows headers do terrible things, but some of those atrocities are
there because they must work for C too.
> That said, I don't actually feel strongly about this. It would be nice if
> Support/ELF.h, COFF.h, and MachO.h all provided the enums named in their
> respective specifications, but if you send a patch to remove the IMAGE_
> prefix, it's probably for the best.
For the case where no winnt.h is included the names could be defined:
#ifndef IMAGE_whatever
#define IMAGE_whatever
...
I'm not sure that putting those COFF names as enums in a namespace is a
good idea, because someone could use them as such and that would break
on Windows. #defining then duplicates the crumminess and hence is the
safe option, IMHO. Just a suggestion to the OP who volunteered to
provide a patch. I have no official saying on this issue.
More information about the llvm-dev
mailing list