http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46836
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manu at gcc dot gnu.org --- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-29 13:50:17 UTC --- (In reply to comment #6) > (In reply to comment #2) > > #pragma GCC canonical_header [header-name] [identifier] > > I don't think we even need to do it per-identifier. > > If each standard header started with: > > #pragma GCC canonical_header push [header-name] > > and ended with: > > #pragma GCC canonical_header pop > > then we'd always know which header we're "in" when an error occurs, even for > nested headers (e.g. <fstream> includes <ios>) and helper files that are > included from many places (e.g. bits/stl_tree.h gets included by both <map> > and > <set>) Well, we already have pragma system_header, we could extend it with an optional parameter. #pragma GCC system_header "canonical_name" and when the pragma is read, save "canonical_name". Then when printing the name of a file, we could check that it is a system-header and there is a saved canonical_name. System-headerness is reset when leaving a file (but I think not when including something from a system header), so you don't need explicit push/pop.