From patchwork Tue Aug 19 22:12:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWFudWVsIEzDs3Blei1JYsOhw7Fleg==?= X-Patchwork-Id: 381511 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6419F1400B2 for ; Wed, 20 Aug 2014 08:13:01 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=TQWNmcnTUSVouh4ElsDd+XyoB2WzQuQeFMJrULt0Qe+BEB k0RF11Mhg0PCnEhdwswR3bXIR8yMCUoK5PENSvvfC2SBmbwhhJ9nNCPqN3W9XwA0 dfFbGSpQv/U2+Wm6jzYZyefdgATON9ucrBUSjC90Q2FnM47lszXr5o3Bzr6Es= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=hAmCFzKyYg2q7rfKPLxRRFH6GTk=; b=ihyDMMPxtyT9mE7aB53a 9IgtVM6h9mcbolJG47sKY/bMjWbTvxMSfkb273292o10nc4jxxYIuCGXg7a8SJH4 JE5KOHSVhhwxozHIkzoyH2OGR0xvFj5W1OQBKAI3rcnjyIud6sjb3PnUtE52aEqU UkpuLxD0hrOuKGIITWUMSyg= Received: (qmail 9644 invoked by alias); 19 Aug 2014 22:12:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 9634 invoked by uid 89); 19 Aug 2014 22:12:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f48.google.com Received: from mail-wg0-f48.google.com (HELO mail-wg0-f48.google.com) (74.125.82.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 19 Aug 2014 22:12:51 +0000 Received: by mail-wg0-f48.google.com with SMTP id x13so7061391wgg.7 for ; Tue, 19 Aug 2014 15:12:48 -0700 (PDT) X-Received: by 10.180.102.105 with SMTP id fn9mr9733773wib.27.1408486368413; Tue, 19 Aug 2014 15:12:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.217.80.73 with HTTP; Tue, 19 Aug 2014 15:12:28 -0700 (PDT) From: =?ISO-8859-1?Q?Manuel_L=F3pez=2DIb=E1=F1ez?= Date: Wed, 20 Aug 2014 00:12:28 +0200 Message-ID: Subject: [PATCH PR preprocessor/51303] Wmissing-include-dirs warnings reported as [enabled by default] To: Gcc Patch List , "Joseph S. Myers" X-IsSubscribed: yes The fix is almost trivial. Just use the appropriate flags when warning. Bootstrapped and regression tested on x86_64-linux-gnu. OK? gcc/ChangeLog: 2014-08-20 Manuel López-Ibáñez * incpath.c (remove_duplicates): Use cpp_warning. gcc/c-family/ChangeLog: 2014-08-20 Manuel López-Ibáñez * c-common.c (struct reason_option_codes_t option_codes): Add CPP_W_MISSING_INCLUDE_DIRS. Sort alphabetically. gcc/testsuite/ChangeLog: 2014-08-20 Manuel López-Ibáñez * gcc.dg/cpp/Wmissingdirs.c: Test for the warning option. Index: gcc/c-family/c-common.c =================================================================== --- gcc/c-family/c-common.c (revision 214136) +++ gcc/c-family/c-common.c (working copy) @@ -9678,27 +9678,28 @@ struct reason_option_codes_t const int reason; /* cpplib message reason. */ const int option_code; /* gcc option that controls this message. */ }; static const struct reason_option_codes_t option_codes[] = { - {CPP_W_DEPRECATED, OPT_Wdeprecated}, + {CPP_W_BUILTIN_MACRO_REDEFINED, OPT_Wbuiltin_macro_redefined}, {CPP_W_COMMENTS, OPT_Wcomment}, - {CPP_W_TRIGRAPHS, OPT_Wtrigraphs}, + {CPP_W_CXX_OPERATOR_NAMES, OPT_Wc___compat}, + {CPP_W_DATE_TIME, OPT_Wdate_time}, + {CPP_W_DEPRECATED, OPT_Wdeprecated}, + {CPP_W_ENDIF_LABELS, OPT_Wendif_labels}, + {CPP_W_INVALID_PCH, OPT_Winvalid_pch}, + {CPP_W_LITERAL_SUFFIX, OPT_Wliteral_suffix}, + {CPP_W_LONG_LONG, OPT_Wlong_long}, + {CPP_W_MISSING_INCLUDE_DIRS, OPT_Wmissing_include_dirs}, {CPP_W_MULTICHAR, OPT_Wmultichar}, + {CPP_W_NORMALIZE, OPT_Wnormalized_}, {CPP_W_TRADITIONAL, OPT_Wtraditional}, - {CPP_W_LONG_LONG, OPT_Wlong_long}, - {CPP_W_ENDIF_LABELS, OPT_Wendif_labels}, - {CPP_W_VARIADIC_MACROS, OPT_Wvariadic_macros}, - {CPP_W_BUILTIN_MACRO_REDEFINED, OPT_Wbuiltin_macro_redefined}, + {CPP_W_TRIGRAPHS, OPT_Wtrigraphs}, {CPP_W_UNDEF, OPT_Wundef}, {CPP_W_UNUSED_MACROS, OPT_Wunused_macros}, - {CPP_W_CXX_OPERATOR_NAMES, OPT_Wc___compat}, - {CPP_W_NORMALIZE, OPT_Wnormalized_}, - {CPP_W_INVALID_PCH, OPT_Winvalid_pch}, + {CPP_W_VARIADIC_MACROS, OPT_Wvariadic_macros}, {CPP_W_WARNING_DIRECTIVE, OPT_Wcpp}, - {CPP_W_LITERAL_SUFFIX, OPT_Wliteral_suffix}, - {CPP_W_DATE_TIME, OPT_Wdate_time}, {CPP_W_NONE, 0} }; /* Return the gcc option code associated with the reason for a cpp message, or 0 if none. */ Index: gcc/incpath.c =================================================================== --- gcc/incpath.c (revision 214136) +++ gcc/incpath.c (working copy) @@ -261,11 +261,12 @@ remove_duplicates (cpp_reader *pfile, st else { /* If -Wmissing-include-dirs is given, warn. */ cpp_options *opts = cpp_get_options (pfile); if (opts->warn_missing_include_dirs && cur->user_supplied_p) - cpp_errno (pfile, CPP_DL_WARNING, cur->name); + cpp_warning (pfile, CPP_W_MISSING_INCLUDE_DIRS, "%s: %s", + cur->name, xstrerror (errno)); reason = REASON_NOENT; } } else if (!S_ISDIR (st.st_mode)) cpp_error_with_line (pfile, CPP_DL_WARNING, 0, 0, Index: gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c =================================================================== --- gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c (revision 214136) +++ gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c (working copy) @@ -2,6 +2,6 @@ /* { dg-options "-std=gnu99 -I /jolly/well/better/not/exist -Wmissing-include-dirs" } */ /* Test that -Wmissing-include-dirs issues a warning when a specified directory does not exist. Source Ben Elliston, 2004-05-13. */ -/* { dg-warning "No such file or directory" "-Wmissing-include-dirs" { target *-*-* } 0 } */ +/* { dg-warning "No such file or directory.*Wmissing-include-dirs" "-Wmissing-include-dirs" { target *-*-* } 0 } */