[Bug c/84195] newlines in deprecated diagnostics
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84195 Nick Clifton changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |FIXED --- Comment #9 from Nick Clifton --- (In reply to Martin) > Can the bug be marked as resolved? Yup - closing.
[Bug c/84195] newlines in deprecated diagnostics
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84195 Martin Liška changed: What|Removed |Added CC||marxin at gcc dot gnu.org --- Comment #8 from Martin Liška --- Nick: Can the bug be marked as resolved?
[Bug c/84195] newlines in deprecated diagnostics
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84195 --- Comment #7 from Nick Clifton --- Author: nickc Date: Mon Jun 18 10:39:01 2018 New Revision: 261697 URL: https://gcc.gnu.org/viewcvs?rev=261697=gcc=rev Log: Ensure that control characters in user supplied error and warning messages are escaped. PR 84195 * tree.c (escaped_string): New class. Converts an unescaped string into its escaped equivalent. (warn_deprecated_use): Use the new class to convert the deprecation message, if present. (test_escaped_strings): New self test. (test_c_tests): Add test_escaped_strings. Modified: trunk/gcc/ChangeLog trunk/gcc/tree.c
[Bug c/84195] newlines in deprecated diagnostics
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84195 Andreas Schwab changed: What|Removed |Added Status|RESOLVED|REOPENED Last reconfirmed||2018-06-17 Resolution|FIXED |--- Ever confirmed|0 |1 --- Comment #6 from Andreas Schwab --- FAIL: gcc.c-torture/compile/pr84195.c -O0 (test for warnings, line 15) FAIL: gcc.c-torture/compile/pr84195.c -O0 (test for excess errors) Excess errors: /opt/gcc/gcc-20180616/gcc/testsuite/gcc.c-torture/compile/pr84195.c:15:3: warning: 'i' is deprecated: foo bar [-Wdeprecated-declarations]
[Bug c/84195] newlines in deprecated diagnostics
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84195 Nick Clifton changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #5 from Nick Clifton --- A revised form of the patch has now been apoplied.
[Bug c/84195] newlines in deprecated diagnostics
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84195 --- Comment #4 from Nick Clifton --- Author: nickc Date: Fri Jun 15 15:25:16 2018 New Revision: 261633 URL: https://gcc.gnu.org/viewcvs?rev=261633=gcc=rev Log: Force user provided warning and error messages to only occupy one line. PR 84195 gcc:* tree.c (escaped_string): New class. Converts an unescaped string into its escaped equivalent. (warn_deprecated_use): Use the new class to convert the deprecation message, if present. (test_escaped_strings): New self test. (test_c_tests): Add test_escaped_strings. * doc/extend.texi (deprecated): Add a note that the deprecation message is affected by the -fmessage-length option, and that control characters will be escaped. (#pragma GCC error): Document this pragma. (#pragma GCC warning): Likewise. * doc/invoke.texi (-fmessage-length): Document this option's effect on the #warning and #error preprocessor directives and the deprecated attribute. testsuite; * gcc.c-torture/compile/pr84195.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr84195.c Modified: trunk/gcc/ChangeLog trunk/gcc/doc/extend.texi trunk/gcc/doc/invoke.texi trunk/gcc/testsuite/ChangeLog
[Bug c/84195] newlines in deprecated diagnostics
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84195 David Malcolm changed: What|Removed |Added Keywords||deferred Assignee|unassigned at gcc dot gnu.org |nickc at gcc dot gnu.org Target Milestone|--- |9.0 --- Comment #3 from David Malcolm --- Candidate patch here: https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00977.html
[Bug c/84195] newlines in deprecated diagnostics
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84195 Martin Sebor changed: What|Removed |Added Keywords||diagnostic --- Comment #2 from Martin Sebor --- I noticed it while comparing how GCC handles embedded control characters in different contexts, in some of the tests I was developing. Some of the contexts I looked at are: 1) #error and #warning where the string is printed as it appears in the source (i.e., with escape sequences), 2) -Wformat where control characters are escaped, 3) -Wformat-overflow where control characters are not escaped unless -fexec-charset= is specified. I consider it a bug and plan to fix it. I think control characters should not be allowed to make it into the output in any context. Besides breaking up diagnostics they can also mess up the color highlighting. I suspect that when they are a part of a string it's more likely by accident than by design, either because the same string is used for different things (e.g., in printf in addition to attribute deprecated), or because the repercussions aren't fully understood by the author.
[Bug c/84195] newlines in deprecated diagnostics
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84195 David Malcolm changed: What|Removed |Added CC||dmalcolm at gcc dot gnu.org --- Comment #1 from David Malcolm --- I'm thinking that if the user has requested newlines, then let's give them newlines. Is there a case you ran into with real-world code here, or are you raising this more as a theoretical concern? Thanks.