This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/79106] wrong source line printed in diagnostics for a translation unit
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 17 Jan 2017 01:50:16 +0000
- Subject: [Bug preprocessor/79106] wrong source line printed in diagnostics for a translation unit
- Auto-submitted: auto-generated
- References: <bug-79106-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79106
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-01-17
Ever confirmed|0 |1
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> IMNSHO the GCC behavior is the right thing to do, that is how the source
> looks like. If the preprocessed file has been hand-edited, it is just a
> user bug.
I disagree. Suppose the translation unit comes from a header from version X of
software installed on the system it was obtained on by a user (say a bug
submitter). Suppose version Y of the same software is installed on the system
where the translation unit is being compiled (say by whoever is debugging it
for the user). Then even when it isn't edited, diagnostics that point into the
header included in the translation unit will print potentially unrelated lines
from the header where the translation unit is being compiled. That's just
wrong. GCC should print the code from the translation unit, not some unrelated
files that just happen to have the same name as those referenced in it.