Avoid unnecessary work when -Wmisleading-indentation isn't enabled
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 2 Jun 2015 18:39:49 +0000 (18:39 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Tue, 2 Jun 2015 18:39:49 +0000 (18:39 +0000)
gcc/c-family/ChangeLog:
* c-indentation.c (warn_for_misleading_indentation): Bail out
immediately if -Wmisleading-indentation isn't enabled.

From-SVN: r224040

gcc/c-family/ChangeLog
gcc/c-family/c-indentation.c

index 1af4e1521c56e26e25d8be3f4ce6d1bc851a15c2..8fc0281d41c3018196bb351b24e54fa90877547f 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-02  David Malcolm  <dmalcolm@redhat.com>
+
+       * c-indentation.c (warn_for_misleading_indentation): Bail out
+       immediately if -Wmisleading-indentation isn't enabled.
+
 2015-06-01  Martin Liska  <mliska@suse.cz>
 
        * c-format.c (check_format_arg):Use new type-based pool allocator.
index 94565f6daa24ad019cb24782a3fcdbe13146c27f..9aeebae3a81f7ce5f0efce19e06e997d5ff4deed 100644 (file)
@@ -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,