On Wed, 2015-06-10 at 17:34 +0200, Jakub Jelinek wrote: > On Wed, Jun 10, 2015 at 11:24:41AM -0400, David Malcolm wrote: (...snip...)
> Also, no matter what testsuite framework is used, including any > headers before #include "config.h" line is a big no-no. The issue was that libiberty/safe-ctype.h has various macros of the form: #define toupper(c) do_not_use_toupper_with_safe_ctype which, if I include gtest.h last, breaks the STL e.g. in const char_type* toupper(char_type *__lo, const char_type* __hi) const { return this->do_toupper(__lo, __hi); } /usr/include/c++/4.8.3/bits/locale_facets.h:240:53: error: macro "toupper" passed 2 arguments, but takes just 1 toupper(char_type *__lo, const char_type* __hi) const ^ Adding a #undef of these things before including gtest.h fixes it, though we then run into: In file included from /usr/include/gtest/internal/gtest-internal.h:40:0, from /usr/include/gtest/gtest.h:57, from ../../src/gcc/unittests/test-tree.c:73: /usr/include/gtest/internal/gtest-port.h:1595:47: error: attempt to use poisoned "strdup" inline char* StrDup(const char* src) { return strdup(src); } ^ /usr/include/gtest/internal/gtest-port.h:1638:50: error: attempt to use poisoned "strerror" inline const char* StrError(int errnum) { return strerror(errnum); } ^ FWIW this goes away if I simply include gtest.h immediately after config.h, but before system.h. Dave