Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as r15-5700-g5134bad11b9a71.

gcc/c/ChangeLog:
        PR c/94370
        * c-typeck.cc (c_build_functype_attribute_variant): Reword
        warning message to avoid double-negative.

gcc/testsuite/ChangeLog:
        PR c/94370
        * gcc.dg/format/proto.c: Update wording of message.

Signed-off-by: David Malcolm <dmalc...@redhat.com>
---
 gcc/c/c-typeck.cc                   | 4 ++--
 gcc/testsuite/gcc.dg/format/proto.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index dd6caf642aaa..a58f618c30b7 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -568,8 +568,8 @@ c_build_functype_attribute_variant (tree ntype, tree otype, 
tree attrs)
       && lookup_attribute ("format", attrs))
     {
       warning_at (input_location, OPT_Wattributes,
-                 "%qs attribute cannot be applied to a function that "
-                 "does not take variable arguments", "format");
+                 "%qs attribute can only be applied to variadic functions",
+                 "format");
       attrs = remove_attribute ("format", attrs);
     }
   return c_build_type_attribute_variant (ntype, attrs);
diff --git a/gcc/testsuite/gcc.dg/format/proto.c 
b/gcc/testsuite/gcc.dg/format/proto.c
index 2556400b10c4..f29e331c8144 100644
--- a/gcc/testsuite/gcc.dg/format/proto.c
+++ b/gcc/testsuite/gcc.dg/format/proto.c
@@ -18,7 +18,7 @@ FMT (3, 4) void print3 ();
 FMT (3, 4) void print3 ();
 
 FMT (1, 2) void print4 ();
-           void print4 (void);              // { dg-warning "'format' 
attribute cannot be applied to a function that does not take variable 
arguments" }
+           void print4 (void);              // { dg-warning "'format' 
attribute can only be applied to variadic functions" }
 
            void print5 ();
 FMT (1, 2) void print5 (void);              // { dg-warning "\\\[-Wattributes" 
}
@@ -59,7 +59,7 @@ FMT (3, 4) void (*pfprint3)();
 FMT (3, 4) void (*pfprint3)();
 
 FMT (1, 2) void (*pfprint4)();
-           void (*pfprint4)(void);              // { dg-warning "'format' 
attribute cannot be applied to a function that does not take variable 
arguments" }
+           void (*pfprint4)(void);              // { dg-warning "'format' 
attribute can only be applied to variadic functions" }
 
            void (*pfprint5)();
 FMT (1, 2) void (*pfprint5)(void);              // { dg-warning 
"\\\[-Wattributes" }
-- 
2.26.3

Reply via email to