This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/84195] New: newlines in deprecated diagnostics
- 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: Sat, 03 Feb 2018 23:16:07 +0000
- Subject: [Bug c/84195] New: newlines in deprecated diagnostics
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84195
Bug ID: 84195
Summary: newlines in deprecated diagnostics
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
The deprecated attribute makes it possible for GCC diagnostics to be broken up
by newlines introduced by the program. I think it would better to remove
newlines and other control characters from the string before printing it so
that they don't mess up tools that parse GCC output. If there's no limit on
the length of the string it might also be worthwhile to impose it.
$ cat t.C && gcc -O -S -Wall -Wextra t.C
#define MSG "\nThis is deprecated.\nPlease do not use it.\n"
int f (int i __attribute__ ((deprecated (MSG))))
{
return 0 ? i : 0;
}
void g (int i)
{
f (i);
}
t.C: In function ‘int f(int)’:
t.C:5:14: warning: ‘i’ is deprecated:
This is deprecated.
Please do not use it.
[-Wdeprecated-declarations]
return 0 ? i : 0;
^
t.C:3:12: note: declared here
int f (int i __attribute__ ((deprecated (MSG))))
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~