From: dmalcolm Date: Tue, 2 Jun 2015 18:39:49 +0000 (+0000) Subject: Avoid unnecessary work when -Wmisleading-indentation isn't enabled X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9af7c176b2d5fc35bdbf0a98cdf677c156dabaa8;p=thirdparty%2Fgcc.git Avoid unnecessary work when -Wmisleading-indentation isn't enabled gcc/c-family/ChangeLog: * c-indentation.c (warn_for_misleading_indentation): Bail out immediately if -Wmisleading-indentation isn't enabled. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224040 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 1af4e1521c56..8fc0281d41c3 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2015-06-02 David Malcolm + + * c-indentation.c (warn_for_misleading_indentation): Bail out + immediately if -Wmisleading-indentation isn't enabled. + 2015-06-01 Martin Liska * c-format.c (check_format_arg):Use new type-based pool allocator. diff --git a/gcc/c-family/c-indentation.c b/gcc/c-family/c-indentation.c index 94565f6daa24..9aeebae3a81f 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,