aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2024-11-26 10:39:48 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2024-11-26 10:39:48 -0500
commit5134bad11b9a71f869abbb7f3d37b669c6ba138b (patch)
tree7a0bd0e2f82a0aff0b50114b782c14359f0009cc
parent67458ea13895bae3965274e7f03701fb14f8b1e6 (diff)
downloadgcc-5134bad11b9a71f869abbb7f3d37b669c6ba138b.zip
gcc-5134bad11b9a71f869abbb7f3d37b669c6ba138b.tar.gz
gcc-5134bad11b9a71f869abbb7f3d37b669c6ba138b.tar.bz2
c: avoid double-negative in warning message [PR94370]
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 <dmalcolm@redhat.com>
-rw-r--r--gcc/c/c-typeck.cc4
-rw-r--r--gcc/testsuite/gcc.dg/format/proto.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index a23d83b..f465123 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -567,8 +567,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 2556400..f29e331 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" }