public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/65403] -Wno-error=<not implemented> is an error Date: Thu, 12 Mar 2015 17:10:00 -0000 [thread overview] Message-ID: <bug-65403-4-EbxdBEY0m8@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-65403-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403 --- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- 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. >From gcc-bugs-return-480212-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Mar 12 17:19:17 2015 Return-Path: <gcc-bugs-return-480212-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org> Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 27450 invoked by alias); 12 Mar 2015 17:19:17 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: <gcc-bugs.gcc.gnu.org> List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/> List-Post: <mailto:gcc-bugs@gcc.gnu.org> List-Help: <mailto:gcc-bugs-help@gcc.gnu.org> Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 27401 invoked by uid 48); 12 Mar 2015 17:19:13 -0000 From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/65403] -Wno-error=<not implemented> is an error Date: Thu, 12 Mar 2015 17:19:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: <bug-65403-4-Kn3lUypK9R@http.gcc.gnu.org/bugzilla/> In-Reply-To: <bug-65403-4@http.gcc.gnu.org/bugzilla/> References: <bug-65403-4@http.gcc.gnu.org/bugzilla/> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg01356.txt.bz2 Content-length: 3559 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403 --- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- 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<const_char_p> ignored_options; +static vec<const char *> ignored_options; +static vec<const char *> 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 >From gcc-bugs-return-480214-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Mar 12 17:26:53 2015 Return-Path: <gcc-bugs-return-480214-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org> Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 63703 invoked by alias); 12 Mar 2015 17:26:53 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: <gcc-bugs.gcc.gnu.org> List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/> List-Post: <mailto:gcc-bugs@gcc.gnu.org> List-Help: <mailto:gcc-bugs-help@gcc.gnu.org> Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 63203 invoked by uid 55); 12 Mar 2015 17:26:49 -0000 From: "mikael at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/60898] [4.8/4.9/5 Regression] model compile error with gfortran 4.7 and gcc 4.9 Date: Thu, 12 Mar 2015 17:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: ice-on-valid-code, patch X-Bugzilla-Severity: normal X-Bugzilla-Who: mikael at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: mikael at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: <bug-60898-4-CZTZPyeHUX@http.gcc.gnu.org/bugzilla/> In-Reply-To: <bug-60898-4@http.gcc.gnu.org/bugzilla/> References: <bug-60898-4@http.gcc.gnu.org/bugzilla/> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg01358.txt.bz2 Content-length: 696 https://gcc.gnu.org/bugzilla/show_bug.cgi?id`898 --- Comment #25 from Mikael Morin <mikael at gcc dot gnu.org> --- Author: mikael Date: Thu Mar 12 17:26:17 2015 New Revision: 221400 URL: https://gcc.gnu.org/viewcvs?rev"1400&root=gcc&view=rev Log: PR fortran/60898 fortran/ * resolve.c (resolve_symbol): Check that the symbol found by name lookup really is the current symbol being resolved. testsuite/ * gfortran.dg/entry_20.f90: New. Added: branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/entry_20.f90 Modified: branches/gcc-4_8-branch/gcc/fortran/ChangeLog branches/gcc-4_8-branch/gcc/fortran/resolve.c branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
next prev parent reply other threads:[~2015-03-12 17:10 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-03-12 14:36 [Bug c/65403] New: " rguenth at gcc dot gnu.org 2015-03-12 14:38 ` [Bug c/65403] " rguenth at gcc dot gnu.org 2015-03-12 16:09 ` manu at gcc dot gnu.org 2015-03-12 17:10 ` manu at gcc dot gnu.org [this message] 2021-08-12 16:48 ` alexhenrie24 at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-65403-4-EbxdBEY0m8@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).