https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63699

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu.org

--- Comment #3 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
A minimal testcase for this is:

#include "safe-ctype.h"
#include <string>

with the safe-ctype.h from trunk. Apparently, the C++ header <string> uses the
type functions, which are poisoned by GCC's safe-ctype.h header. The proper
fix, in my opinion, is to include <string> before "safe-ctype.h", which is
itself included in gcc/system.h.

The same logic already appears in go/go-system.h, which says:

// We don't really need iostream, but some versions of gmp.h include
// it when compiled with C++, which means that we need to include it
// before the macro magic of safe-ctype.h, which is included by
// system.h.


Here's the suggested patch, which I can't test right now unfortunately. Feel
free to submit it for review:

Index: plugin.cc
===================================================================
--- plugin.cc    (revision 217000)
+++ plugin.cc    (working copy)
@@ -31,6 +31,8 @@
 #undef PACKAGE_TARNAME
 #undef PACKAGE_VERSION

+#include <string>
+
 #include "gcc-plugin.h"
 #include "system.h"
 #include "coretypes.h"
@@ -55,8 +57,6 @@
 #include "connection.hh"
 #include "rpc.hh"

-#include <string>
-
 #ifdef __GNUC__
 #pragma GCC visibility push(default)
 #endif

Reply via email to