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

            Bug ID: 77715
           Summary: go-system.h includes C++ header files before GCC
                    system.h
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
          Assignee: ian at airs dot com
          Reporter: dje at gcc dot gnu.org
                CC: cmang at google dot com
  Target Milestone: ---

go-system.h includes C++ headers before system.h to work-around poisoned
declarations

// These must be included before the #poison declarations in system.h.

#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <set>
#include <vector>

#if defined(HAVE_UNORDERED_MAP)

# include <unordered_map>
# include <unordered_set>

// 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.
#include <iostream>

#include "system.h"


GCC development specifies that "system.h" should be included first.  Inclusion
of C++ headers potentially pulls in OS system headers that cause conflicts or
that adversely influence the behavior of system.h.  This prevent the
compilation of gofrontend on AIX due to PRIx64 and PRIu64 definition conflicts.

The preferred solution is

#define INCLUDE_MAP
#define INCLUDE_SET
#include "system.h"

as used in auto-profile.c.  go-system.h should arrange for system.h to include
the necessary C++ header files.

Reply via email to