public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Avoid unnecessary work when -Wmisleading-indentation isn't enabled
@ 2015-05-13 15:16 David Malcolm
  2015-05-13 15:33 ` Marek Polacek
  0 siblings, 1 reply; 2+ messages in thread
From: David Malcolm @ 2015-05-13 15:16 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Avoid unnecessary work when -Wmisleading-indentation isn't enabled
  2015-05-13 15:16 [PATCH] Avoid unnecessary work when -Wmisleading-indentation isn't enabled David Malcolm
@ 2015-05-13 15:33 ` Marek Polacek
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Polacek @ 2015-05-13 15:33 UTC (permalink / raw)
  To: David Malcolm; +Cc: gcc-patches

On Wed, May 13, 2015 at 11:25:56AM -0400, David Malcolm wrote:
> This might qualify as "obvious".
> 
> OK for trunk?  (if it passes bootstrap and regrtest)

Ok.

	Marek

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-13 15:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-13 15:16 [PATCH] Avoid unnecessary work when -Wmisleading-indentation isn't enabled David Malcolm
2015-05-13 15:33 ` Marek Polacek

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).