aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2018-06-15 15:25:16 +0000
committerNick Clifton <nickc@gcc.gnu.org>2018-06-15 15:25:16 +0000
commit490cced415071d4c2ea5ef9833c4ab61367471eb (patch)
treed032e0e439bf1d005b9dede218d85db79cbe223c /gcc/testsuite
parent7f93abd805763ef3827fce9194b0adcd2419a45c (diff)
downloadgcc-490cced415071d4c2ea5ef9833c4ab61367471eb.zip
gcc-490cced415071d4c2ea5ef9833c4ab61367471eb.tar.gz
gcc-490cced415071d4c2ea5ef9833c4ab61367471eb.tar.bz2
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. From-SVN: r261633
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr84195.c17
2 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 262bb2d..fc06596 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-15 Nick Clifton <nickc@redhat.com>
+
+ PR 84195
+ * gcc.c-torture/compile/pr84195.c: New test.
+
2018-06-15 Richard Biener <rguenther@suse.de>
PR middle-end/86159
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr84195.c b/gcc/testsuite/gcc.c-torture/compile/pr84195.c
new file mode 100644
index 0000000..4f1e70b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr84195.c
@@ -0,0 +1,17 @@
+/* { dg-options "-Wdeprecated-declarations" } */
+
+/* Check that MSG is printed without the escape characters being interpreted.
+ Especially the newlines.
+
+ Note - gcc's behaviour is inconsistent in this regard as #error and
+ #warning will also display control characters as escape sequences,
+ whereas #pragma GCC error and #pragma GCC warning will perform the
+ control operations of the control characters. */
+
+#define MSG "foo\n\t\rbar"
+
+int f (int i __attribute__ ((deprecated (MSG))))
+{
+ return 0 ? i : 0; /* { dg-warning "'i' is deprecated: foo.n.t.rbar" } */
+}
+