[Bug c/65403] -Wno-error= is an error

2021-08-12 Thread alexhenrie24 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

--- Comment #15 from Alex Henrie  ---
Nicholas Guriev also sent a patch for this issue:

https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573774.html

[Bug c/65403] -Wno-error= is an error

2019-09-04 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

Eric Gallager  changed:

   What|Removed |Added

 CC||msebor at gcc dot gnu.org

--- Comment #14 from Eric Gallager  ---
(In reply to Alex Henrie from comment #13)
> I filled out all the forms and was approved to contribute code to GCC, but
> the patches have still not been reviewed:
> https://gcc.gnu.org/ml/gcc-patches/2019-03/msg00971.html

Latest review comment I can find on a later iteration of that patch series is
here by Martin Sebor: https://gcc.gnu.org/ml/gcc-patches/2019-08/msg01892.html

[Bug c/65403] -Wno-error= is an error

2019-06-05 Thread alexhenrie24 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

--- Comment #13 from Alex Henrie  ---
I filled out all the forms and was approved to contribute code to GCC, but the
patches have still not been reviewed:
https://gcc.gnu.org/ml/gcc-patches/2019-03/msg00971.html

[Bug c/65403] -Wno-error= is an error

2019-06-05 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

--- Comment #12 from Eric Gallager  ---
(In reply to Alex Henrie from comment #11)
> Created attachment 45889 [details]
> Proposed patches
> 
> I fixed up the patch from comment 4 and added a second patch with tests. Now
> I'm just waiting to receive a copyright assignment form.

It's been a bit... have you received your copyright assignment form yet?

[Bug c/65403] -Wno-error= is an error

2019-03-04 Thread alexhenrie24 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

--- Comment #11 from Alex Henrie  ---
Created attachment 45889
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45889&action=edit
Proposed patches

I fixed up the patch from comment 4 and added a second patch with tests. Now
I'm just waiting to receive a copyright assignment form.

[Bug c/65403] -Wno-error= is an error

2019-03-02 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

--- Comment #10 from Manuel López-Ibáñez  ---
(In reply to Alex Henrie from comment #8)
> Why weren't Manuel's patches accepted?

I never properly submitted them. Feel free to adopt them and get them through
the process:
https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps

[Bug c/65403] -Wno-error= is an error

2019-03-01 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

Eric Gallager  changed:

   What|Removed |Added

 CC||egallager at gcc dot gnu.org

--- Comment #9 from Eric Gallager  ---
(In reply to Alex Henrie from comment #8)
> Why weren't Manuel's patches accepted?

He probably forgot to ping them and then people just forgot about them, I'm
guessing

[Bug c/65403] -Wno-error= is an error

2019-03-01 Thread alexhenrie24 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

--- Comment #8 from Alex Henrie  ---
Why weren't Manuel's patches accepted?

[Bug c/65403] -Wno-error= is an error

2019-03-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

Richard Biener  changed:

   What|Removed |Added

 CC||alexhenrie24 at gmail dot com

--- Comment #7 from Richard Biener  ---
*** Bug 89524 has been marked as a duplicate of this bug. ***

[Bug c/65403] -Wno-error= is an error

2016-04-03 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

Manuel López-Ibáñez  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #6 from Manuel López-Ibáñez  ---
(In reply to Jakub Jelinek from comment #5)
> -Werror=unknown-warning should not be ignored, as -Werror=unknown-warning
> implies also -Wunknown-warning (unlike -Wno-error=, which doesn't imply
> anything).

Are you talking about my patch in comment #4? I think it doesn't ignore
-Werror=unknown-warning See the hunk in opts.c.

[Bug c/65403] -Wno-error= is an error

2016-01-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek  ---
-Werror=unknown-warning should not be ignored, as -Werror=unknown-warning
implies also -Wunknown-warning (unlike -Wno-error=, which doesn't imply
anything).

[Bug c/65403] -Wno-error= is an error

2015-03-12 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

--- Comment #4 from Manuel López-Ibáñez  ---
In fact, this version seems much more straightforward:

Index: opts-global.c
===
--- opts-global.c   (revision 221118)
+++ opts-global.c   (working copy)
@@ -60,13 +60,12 @@ along with GCC; see the file COPYING3.  
 #include "toplev.h"
 #include "tree-pass.h"
 #include "context.h"
 #include "asan.h"

-typedef const char *const_char_p; /* For DEF_VEC_P.  */
-
-static vec ignored_options;
+static vec ignored_options;
+static vec ignored_wnoerror_options;

 /* Input file names.  */
 const char **in_fnames;
 unsigned num_in_fnames;

@@ -145,23 +144,35 @@ static void
 postpone_unknown_option_warning (const char *opt)
 {
   ignored_options.safe_push (opt);
 }

+/* This function is equivalent to the above, but it should be used to
+   buffer options passed to -Wno-error=.  */
+void
+postpone_unknown_wnoerror_warning (const char *opt)
+{
+  ignored_wnoerror_options.safe_push (opt);
+}
+
 /* Produce a warning for each option previously buffered.  */

 void
 print_ignored_options (void)
 {
   while (!ignored_options.is_empty ())
 {
-  const char *opt;
-
-  opt = ignored_options.pop ();
+  const char * opt = ignored_options.pop ();
   warning_at (UNKNOWN_LOCATION, 0,
  "unrecognized command line option %qs", opt);
 }
+  while (!ignored_wnoerror_options.is_empty ())
+{
+  const char * opt = ignored_wnoerror_options.pop ();
+  warning_at (UNKNOWN_LOCATION, 0,
+ "-Wno-error=%s: no option -W%s", opt, opt);
+}
 }

 /* Handle an unknown option DECODED, returning true if an error should
be given.  */

Index: opts.c
===
--- opts.c  (revision 221118)
+++ opts.c  (working copy)
@@ -2341,11 +2341,14 @@ enable_warning_as_error (const char *arg
   new_option[0] = 'W';
   strcpy (new_option + 1, arg);
   option_index = find_opt (new_option, lang_mask);
   if (option_index == OPT_SPECIAL_unknown)
 {
-  error_at (loc, "-Werror=%s: no option -%s", arg, new_option);
+  if (value)
+   error_at (loc, "-Werror=%s: no option -%s",  arg, new_option);
+  else
+   postpone_unknown_wnoerror_warning (arg);
 }
   else
 {
   const diagnostic_t kind = value ? DK_ERROR : DK_WARNING;

Index: opts.h
===
--- opts.h  (revision 221118)
+++ opts.h  (working copy)
@@ -400,6 +400,7 @@ extern void default_options_optimization
 extern void set_struct_debug_option (struct gcc_options *opts,
 location_t loc,
 const char *value);
 extern bool opt_enum_arg_to_value (size_t opt_index, const char *arg,
   int *value, unsigned int lang_mask);
+extern void postpone_unknown_wnoerror_warning (const char *opt);
 #endif

[Bug c/65403] -Wno-error= is an error

2015-03-12 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

--- Comment #3 from Manuel López-Ibáñez  ---
For harmonizing how -Wno-X and -Wno-error=X work, it is a bit more convoluted.
This mostly works:

Index: opts-global.c
===
--- opts-global.c   (revision 221118)
+++ opts-global.c   (working copy)
@@ -139,11 +139,11 @@ complain_wrong_lang (const struct cl_dec
prevented a diagnostic. Otherwise, we just ignore them.  Note that
if we do complain, it is only as a warning, not an error; passing
the compiler an unrecognized -Wno-* option should never change
whether the compilation succeeds or fails.  */

-static void
+void
 postpone_unknown_option_warning (const char *opt)
 {
   ignored_options.safe_push (opt);
 }

@@ -152,15 +152,20 @@ postpone_unknown_option_warning (const c
 void
 print_ignored_options (void)
 {
   while (!ignored_options.is_empty ())
 {
-  const char *opt;
-
-  opt = ignored_options.pop ();
-  warning_at (UNKNOWN_LOCATION, 0,
- "unrecognized command line option %qs", opt);
+  const char * opt = ignored_options.pop ();
+  if (strcmp (opt, "-Wno-error=") == 0)
+   {
+ const char * w_opt = opt + strlen ("-Wno-error=");
+ warning_at (UNKNOWN_LOCATION, 0, "-Wno-error=%s: no option -W%s",
+ w_opt, w_opt);
+   }
+  else
+   warning_at (UNKNOWN_LOCATION, 0,
+   "unrecognized command line option %qs", opt);
 }
 }

 /* Handle an unknown option DECODED, returning true if an error should
be given.  */

Index: opts.h
===
--- opts.h  (revision 221118)
+++ opts.h  (working copy)
@@ -400,6 +400,7 @@ extern void default_options_optimization
 extern void set_struct_debug_option (struct gcc_options *opts,
 location_t loc,
 const char *value);
 extern bool opt_enum_arg_to_value (size_t opt_index, const char *arg,
   int *value, unsigned int lang_mask);
+extern void postpone_unknown_option_warning (const char *opt);
 #endif
Index: opts.c
===
--- opts.c  (revision 221118)
+++ opts.c  (working copy)
@@ -2335,17 +2335,23 @@ enable_warning_as_error (const char *arg
 location_t loc, diagnostic_context *dc)
 {
   char *new_option;
   int option_index;

-  new_option = XNEWVEC (char, strlen (arg) + 2);
+  new_option = XNEWVEC (char, strlen (arg) + strlen ("-Wno-error=") + 1);
   new_option[0] = 'W';
   strcpy (new_option + 1, arg);
   option_index = find_opt (new_option, lang_mask);
   if (option_index == OPT_SPECIAL_unknown)
 {
-  error_at (loc, "-Werror=%s: no option -%s", arg, new_option);
+  if (value)
+   error_at (loc, "-Werror=%s: no option -%s",  arg, new_option);
+  else
+   strcpy (new_option, "-Wno-error=");
+   strcat (new_option, arg);
+   postpone_unknown_option_warning (new_option);
+   return;
 }
   else
 {
   const diagnostic_t kind = value ? DK_ERROR : DK_WARNING;


with some caveats:

* It is a bit too convoluted
* In principle enable_warning_as_error() can be called with a loc !=
UNKNOWN_LOCATION, thus we should record this location for reporting the
warning.

[Bug c/65403] -Wno-error= is an error

2015-03-12 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

Manuel López-Ibáñez  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-03-12
 CC||manu at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Manuel López-Ibáñez  ---
For fixing the output, the following should be enough:

Index: opts.c
===
--- opts.c  (revision 221118)
+++ opts.c  (working copy)
@@ -2341,11 +2341,12 @@ enable_warning_as_error (const char *arg
   new_option[0] = 'W';
   strcpy (new_option + 1, arg);
   option_index = find_opt (new_option, lang_mask);
   if (option_index == OPT_SPECIAL_unknown)
 {
-  error_at (loc, "-Werror=%s: no option -%s", arg, new_option);
+  error_at (loc, "-W%s=%s: no option -%s",
+   value ? "error" : "no-error", arg, new_option);
 }
   else
 {
   const diagnostic_t kind = value ? DK_ERROR : DK_WARNING;

[Bug c/65403] -Wno-error= is an error

2015-03-12 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403

--- Comment #1 from Richard Biener  ---
Besides that the error also complains about -Werror= instead of -Wno-error=