From: David Malcolm <dmalcolm@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [PATCH] Avoid unnecessary work when -Wmisleading-indentation isn't enabled
Date: Wed, 13 May 2015 15:16:00 -0000 [thread overview]
Message-ID: <1431530756-26831-1-git-send-email-dmalcolm@redhat.com> (raw)
This might qualify as "obvious".
OK for trunk? (if it passes bootstrap and regrtest)
gcc/c-family/ChangeLog:
* c-indentation.c (warn_for_misleading_indentation): Bail out
immediately if -Wmisleading-indentation isn't enabled.
---
gcc/c-family/c-indentation.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gcc/c-family/c-indentation.c b/gcc/c-family/c-indentation.c
index 94565f6..9aeebae 100644
--- a/gcc/c-family/c-indentation.c
+++ b/gcc/c-family/c-indentation.c
@@ -373,6 +373,12 @@ warn_for_misleading_indentation (location_t guard_loc,
enum cpp_ttype next_tok_type,
const char *guard_kind)
{
+ /* Early reject for the case where -Wmisleading-indentation is disabled,
+ to avoid doing work only to have the warning suppressed inside the
+ diagnostic machinery. */
+ if (!warn_misleading_indentation)
+ return;
+
if (should_warn_for_misleading_indentation (guard_loc,
body_loc,
next_stmt_loc,
--
1.8.5.3
next reply other threads:[~2015-05-13 15:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 15:16 David Malcolm [this message]
2015-05-13 15:33 ` Marek Polacek
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=1431530756-26831-1-git-send-email-dmalcolm@redhat.com \
--to=dmalcolm@redhat.com \
--cc=gcc-patches@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: link
Be 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).