This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Go front end review: files outside gofrontend/

A further comment on go-system.h:

It is always necessary for code in GCC to include config.h before any 
system headers.  Thus, the includes

#include <string>
#include <vector>
#include <tr1/unordered_map>
#include <iostream>
#include <cstdio>

are unsafe because they appear before the include of config.h.

In particular, feature test macros such as those for large-files support 
(which is now enabled in GCC) may be defined in config.h and may only be 
effective if defined before any system headers are included - and C++ 
system headers may include C system headers.

If the issue described in

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

arises then I think the answer is for system.h to include some C++ 
headers, when compiling as C++, before the problem #poison declarations, 
just as it includes various C headers.  A suitable set of C++ header 
includes might also eliminate many of the #include <...> directives in 
individual files in the front end.  If a source file directly includes a 
<...> system header, there should be a clear reason why that include is 
not in system.h (for example, deliberately deciding that certain 
interfaces such as those from GMP and MPFR should only be used in certain 
parts of the compiler - especially where using a header may result in 
library dependencies not desired for programs such as the driver).

Joseph S. Myers

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]