This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 00/17] RFC: Addding a unit testing framework to gcc
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Jun 2015 14:04:11 -0400
- Subject: Re: [PATCH 00/17] RFC: Addding a unit testing framework to gcc
- Authentication-results: sourceware.org; auth=none
- References: <1433949898-22033-1-git-send-email-dmalcolm at redhat dot com> <20150610153447 dot GM10247 at tucnak dot redhat dot com>
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