[llvm-commits] [PATCH] Fix bug with _MSC_VER define

John Garvin jgarvin at apple.com
Wed Aug 29 00:14:01 PDT 2012


On Aug 15, 2012, at 1:52 PM, Chris Lattner <clattner at apple.com> wrote:

> 
> On Aug 15, 2012, at 11:13 AM, John Garvin <jgarvin at apple.com> wrote:
> 
>> It's not strictly necessary, but it would allow compiling with -Werror -Wundef.
> 
> Ok, is this the only sort of thing that needs this, or is it pervasive throughout the llvm headers?
> 
> -Chris
> 


With respect to _MSC_VER, all the uses of it, except the one fixed in the patch, are in a context where the symbol is already defined. With respect to other symbols, I'm not familiar enough with the code yet to be totally sure which symbols are defined elsewhere, but I ran clang -fsyntax-only -Wundef on each header file and grepped for the -Wundef warning, and this was the result:

include/llvm-c/Core.h:2690:9: warning: 'DEBUG' is not defined, evaluates to 0 [-Wundef]
include/llvm/Support/Compiler.h:27:9: warning: '_MSC_VER' is not defined, evaluates to 0 [-Wundef]
include/llvm/Support/FileSystem.h:43:5: warning: 'HAVE_SYS_STAT_H' is not defined, evaluates to 0 [-Wundef]
include/llvm/Support/FileSystem.h:599:5: warning: 'LLVM_ON_WIN32' is not defined, evaluates to 0 [-Wundef]

About twenty more -Wundef warnings are there if you count .h files not in include/ .

Do we want to make sure all the headers in include/ compile without warning under -Wundef? It seems like a good idea to me.

John



More information about the llvm-commits mailing list