This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Use "[warning enabled by default]" for default warnings
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 09 Feb 2014 20:00:26 +0000
- Subject: Use "[warning enabled by default]" for default warnings
- Authentication-results: sourceware.org; auth=none
We print "[-Wfoo]" after a warning that was enabled by the -Wfoo option,
which is pretty clear. But for warnings that have no -W option we just
print "[enabled by default]", which leads to the question of _what_ is
enabled by default. As shown by:
http://gcc.gnu.org/ml/gcc/2014-01/msg00234.html
it invites the wrong interpretation for things like:
warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
IMO the natural assumption is that gnu++11 is enabled by default, which is
how Lars also read it.
There seemed to be support for using "warning enabled by default" instead,
so this patch does that. Tested on x86_64-linux-gnu. OK to install?
I'll post an Ada patch separately.
Thanks,
Richard
gcc/
* opts.c (option_name): Use "warning enabled by default" rather than
just "enabled by default".
gcc/testsuite/
* gcc.dg/gomp/simd-clones-5.c: Update comment for new warning message.
Index: gcc/opts.c
===================================================================
--- gcc/opts.c 2014-02-09 12:07:06.237317560 +0000
+++ gcc/opts.c 2014-02-09 12:07:06.371318597 +0000
@@ -2222,7 +2222,7 @@ option_name (diagnostic_context *context
if (context->warning_as_error_requested)
return xstrdup (cl_options[OPT_Werror].opt_text);
else
- return xstrdup (_("enabled by default"));
+ return xstrdup (_("warning enabled by default"));
}
else
return NULL;
Index: gcc/testsuite/gcc.dg/gomp/simd-clones-5.c
===================================================================
--- gcc/testsuite/gcc.dg/gomp/simd-clones-5.c 2014-02-09 12:07:06.237317560 +0000
+++ gcc/testsuite/gcc.dg/gomp/simd-clones-5.c 2014-02-09 12:07:06.371318597 +0000
@@ -3,7 +3,7 @@
/* ?? The -w above is to inhibit the following warning for now:
a.c:2:6: warning: AVX vector argument without AVX enabled changes
- the ABI [enabled by default]. */
+ the ABI [warning enabled by default]. */
#pragma omp declare simd notinbranch simdlen(4)
void foo (int *a)