problems building googletest for 2.5

Google Test requires these CPP FLAGS “-Wno-missing-field-initializers -Wno-variadic-macros” in order to not output warnings. However, these flags are only available with gcc 4.X. We don’t want to prevent users from being able to build with gcc 3.X which is the current situation (

I’ve disabled building Google Test in the 2.5 branch. Hopefully someone can fix this issue and we can get it merged into the release branch.

Ideally, configure should detect what version of gcc you have and either use those CPP FLAGS or not (it will output warnings with 3.X). Or, we just disable building Google Test by default.

Can anyone help with this?


Here is a Makefile fragment that will dynamically test gcc and add flags, if the flag is supported. I'll leave it up to others to consider and/or integrate it and consider if /dev/null is portable enough.

FLAGS := $(shell gcc -Wall -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wall)
CFLAGS := $(shell gcc -Wallme -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wallme)
  @echo flags are $(FLAGS)
  @echo flags are $(CFLAGS)

The down side, these execute every time the fragment is read. If limited to just a few directories, it should be fine, Makefile.common would hurt.

Putting it into the one directory (utils/unittest) that needs it should be fine. Can you please test and apply a patch to mainline? Thanks Mike,


Sure, but I'm skeptical this will actually help gcc 3.X. I checked in the code, and tested on a gcc 4.2 system. Someone else would have to try 3.X.

Someone else would have to
try 3.X.

It works for me. I can now build LLVM on Cygwin with GCC 3.4.4, where
I used to fall over this problem before.


Thanks for testing.