public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Lewis Hyatt <lhyatt@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1605] c-family: Fix option check in handle_pragma_diagnostic [PR106252] Date: Mon, 11 Jul 2022 14:25:17 +0000 (GMT) [thread overview] Message-ID: <20220711142517.D90E9385840B@sourceware.org> (raw) https://gcc.gnu.org/g:cb7b01db7a1979a45fd1dce87a8738e80568520e commit r13-1605-gcb7b01db7a1979a45fd1dce87a8738e80568520e Author: Lewis Hyatt <lhyatt@gmail.com> Date: Mon Jul 11 08:12:33 2022 -0400 c-family: Fix option check in handle_pragma_diagnostic [PR106252] In r13-1544, handle_pragma_diagnostic was refactored to support processing early pragmas. During that process the part looking up option arguments was inadvertenly moved too early, prior to checking the option was valid, causing PR106252. Fixed by moving the check back where it goes. gcc/c-family/ChangeLog: PR preprocessor/106252 * c-pragma.cc (handle_pragma_diagnostic_impl): Don't look up the option argument prior to verifying the option was found. Diff: --- gcc/c-family/c-pragma.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/c-family/c-pragma.cc b/gcc/c-family/c-pragma.cc index 62bce2ed0f5..789719e6e6a 100644 --- a/gcc/c-family/c-pragma.cc +++ b/gcc/c-family/c-pragma.cc @@ -1009,10 +1009,6 @@ handle_pragma_diagnostic_impl () if (early && !c_option_is_from_cpp_diagnostics (option_index)) return; - const char *arg = NULL; - if (cl_options[option_index].flags & CL_JOINED) - arg = data.option_str + 1 + cl_options[option_index].opt_len; - if (option_index == OPT_SPECIAL_unknown) { if (want_diagnostics) @@ -1052,6 +1048,10 @@ handle_pragma_diagnostic_impl () return; } + const char *arg = NULL; + if (cl_options[option_index].flags & CL_JOINED) + arg = data.option_str + 1 + cl_options[option_index].opt_len; + struct cl_option_handlers handlers; set_default_handlers (&handlers, NULL); /* FIXME: input_location isn't the best location here, but it is
reply other threads:[~2022-07-11 14:25 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220711142517.D90E9385840B@sourceware.org \ --to=lhyatt@gcc.gnu.org \ --cc=gcc-cvs@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).