[Bug preprocessor/87730] New: Warn about misuses of __has_include_next

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Oct 24 13:08:00 GMT 2018


            Bug ID: 87730
           Summary: Warn about misuses of __has_include_next
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
            Blocks: 87403
  Target Milestone: ---

Clang has some nice warnings for dubious uses of __has_include_next.


#if __has_include_next(</usr/include/stdio.h>)

In the main file being compiled this produces:

foo.cc:1:5: warning: #include_next in primary source file
#if __has_include_next(</usr/include/stdio.h>)

and in an included header it produces:

In file included from foo.cc:1:
./foo.h:1:5: warning: #include_next with absolute path
#if __has_include_next(</usr/include/stdio.h>)

Referenced Bugs:

[Bug 87403] [Meta-bug] Issues that suggest a new warning

More information about the Gcc-bugs mailing list