From 36b341276f85fc5af74d3019496aea379553f37d Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 5 Jun 2019 14:24:03 +0000 Subject: [PATCH] c-pragma.c (handle_pragma_weak): Adjust quoting in a diagnostic. gcc/c-family/ChangeLog: * c-pragma.c (handle_pragma_weak): Adjust quoting in a diagnostic. * c.opt (-Wformat-diag): Remove a spurious period. gcc/testsuite/ChangeLog: * gcc.dg/weak/weak-19.c: New test. From-SVN: r271965 --- gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c-pragma.c | 2 +- gcc/c-family/c.opt | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/weak/weak-19.c | 8 ++++++++ 5 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/weak/weak-19.c diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 0c3a64407a0..e74e9258a1c 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2019-06-05 Martin Sebor + + * c-pragma.c (handle_pragma_weak): Adjust quoting in a diagnostic. + * c.opt (-Wformat-diag): Remove a spurious period. + 2019-05-29 Jakub Jelinek PR c/90628 diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c index 480d98efd1e..62b71d2e4c4 100644 --- a/gcc/c-family/c-pragma.c +++ b/gcc/c-family/c-pragma.c @@ -361,7 +361,7 @@ handle_pragma_weak (cpp_reader * ARG_UNUSED (dummy)) if (t == CPP_EQ) { if (pragma_lex (&value) != CPP_NAME) - GCC_BAD ("%, ignored"); + GCC_BAD ("malformed %<#pragma weak%>, ignored"); t = pragma_lex (&x); } if (t != CPP_EOF) diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 046d489f7eb..6c247779af6 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -564,7 +564,7 @@ Warn about format strings that contain NUL bytes. Wformat-diag C ObjC C++ ObjC++ Var(warn_format_diag) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 1, 0) -Warn about GCC format strings with strings unsuitable for diagnostics.. +Warn about GCC format strings with strings unsuitable for diagnostics. Wformat-extra-args C ObjC C++ ObjC++ Var(warn_format_extra_args) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 1, 0) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0a88fed79de..457970ede45 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-06-05 Martin Sebor + + * gcc.dg/weak/weak-19.c: New test. + 2019-06-05 Eric Botcazou * gnat.dg/specs/discr6.ads: New test. diff --git a/gcc/testsuite/gcc.dg/weak/weak-19.c b/gcc/testsuite/gcc.dg/weak/weak-19.c new file mode 100644 index 00000000000..08906b71886 --- /dev/null +++ b/gcc/testsuite/gcc.dg/weak/weak-19.c @@ -0,0 +1,8 @@ +/* { dg-do compile } + { dg-require-weak "" } */ + +/* Verify that the following invalid pragmas are diagnosed. */ + +#pragma weak foo = 1 /* { dg-warning "malformed '#pragma weak'" } */ +#pragma weak foo = + /* { dg-warning "malformed '#pragma weak'" } */ +#pragma weak foo = ? /* { dg-warning "malformed '#pragma weak'" } */ -- 2.30.2