[Bug c++/69145] New: [6 Regression] Bogus 'warning:=?UTF-8?Q?=20=23pragma=20implementation=20for=20=E2=80=98?=...=?UTF-8?Q?=E2=80=99=20appears=20after=20file=20is=20included?='

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 5 10:06:00 GMT 2016


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

            Bug ID: 69145
           Summary: [6 Regression] Bogus 'warning: #pragma implementation
                    for ‘...’ appears after file is included'
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

Created attachment 37224
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37224&action=edit
Patch used to show the "note" line

Since a while, I get seemingly bogus warnings of the form:

file.cc:38:24: warning: #pragma implementation for ‘header.h’ appears after
file is included

The warning is generated in gcc/cp/lex.c's handle_pragma_implementation and
calls cpp_included_before, which contains:
   while (entry && (entry->start_dir == NULL || entry->u.file->err_no
                   || entry->location > location))
     entry = entry->next;

I modified the code to print a "note" with the entry->location after the
warning call.


Example:

TDICmds.cc:7:24: warning: #pragma implementation for
‘create_defect_script_SCDBase.cc’ appears after file is included
 #pragma implementation "create_defect_script_SCDBase.cc"
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from TDICmds.cc:33:0:
./create_defect_script_SCDBase.cc:1:0: note: File was included here
 #include "create_defect_script_SCDBase.h"


I will now try to create a small example and to find the commit, which caused
the regression.


More information about the Gcc-bugs mailing list