Given that some build systems try to encapsulate system headers separately from
those found in /usr/include, primarily through careful arrangement of -I flags,
it would be helpful if there was a warning flag, let's call it
-Wstrict-header-path for now, which would signal when a source file tries to do
the following:

#include "/usr/include/sys/stat.h"
#include "../../../sys/stat.h"

Ian Lance Taylor has indicated to me that this could be done as a check on
fname in do_include_common in libcpp/directives.c.  I would be willing to
attempt a patch myself if this enhancement is accepted.


-- 
           Summary: Warning for absolute or dotted header paths
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mbland at google dot com
 GCC build triplet: N/A
  GCC host triplet: N/A
GCC target triplet: N/A


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26857

Reply via email to