From patchwork Fri Aug 22 10:32:13 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: 382141 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 9E6721400E9 for ; Fri, 22 Aug 2014 20:32:50 +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=oA9ZOOF3T/MJB816+oxQCLdOGTtaVDbZe1aEUa9l8P/EUi j6IVjp0KK0cktRAa70YLg9bTQG6oJrITD0OiJbKk0bwjuOZjVpm0lMQ/6Fp+xu00 11YbqIfFascdfWN6tNjAtAFuxUmOAkikpXdBvoQ/TsCxlpzeB3RYJdEf8UbXc= 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=gqFt+6mF3WJ355ypeKN/iaOv5n8=; b=dE5mJQNeK1BYX1VJuNjh pg520D/tjZsXovltyDAJ7WNUQLu4kqVmzsCLBk7i7kZaWu2BCQ5ko3hNphJPQ5BZ PC6153inJK5uhIZOjLtcOMGP1LcdjCtF04TCQsd9g6vqVakJTq61dEGeqc00ag/l MExD4DaROy2Z+ZFb7V0VeIQ= Received: (qmail 30329 invoked by alias); 22 Aug 2014 10:32:43 -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 30311 invoked by uid 89); 22 Aug 2014 10:32:41 -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; Fri, 22 Aug 2014 10:32:37 +0000 Received: by mail-wg0-f48.google.com with SMTP id x13so10239167wgg.19 for ; Fri, 22 Aug 2014 03:32:34 -0700 (PDT) X-Received: by 10.180.82.166 with SMTP id j6mr28324123wiy.83.1408703554665; Fri, 22 Aug 2014 03:32:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.217.80.73 with HTTP; Fri, 22 Aug 2014 03:32:13 -0700 (PDT) From: =?ISO-8859-1?Q?Manuel_L=F3pez=2DIb=E1=F1ez?= Date: Fri, 22 Aug 2014 12:32:13 +0200 Message-ID: Subject: [PATCH C/C++] Make use of CPP() for Wdate-time and other flags To: Gcc Patch List , "Joseph S. Myers" X-IsSubscribed: yes Using Common for Wdate-time when it is defined in c.opt does not really make sense and breaks CPP(). I also took the opportunity to move a duplicated testcase to c-c++-common. (svn diff does not show the move). Bootstrapped and regression tested on x86_64-linux-gnu. OK? gcc/c-family/ChangeLog: 2014-08-22 Manuel López-Ibáñez * c.opt (Wcomment): Use CPP, Var and LangEnabledBy. (Wmultichar): Likewise. (Wdate-time): Use C-family languages instead of Common. Use CPP and Var. * c-opts.c (c_common_handle_option): Do not handle the above options here. (sanitize_cpp_opts): Likewise. gcc/testsuite/ChangeLog: 2014-08-22 Manuel López-Ibáñez * g++.dg/warn/wdate-time.C: Remove. * gcc.dg/wdate-time.c: Move from here... * c-c++-common/wdate-time.c: ... to here. Index: gcc/c-family/c.opt =================================================================== --- gcc/c-family/c.opt (revision 214220) +++ gcc/c-family/c.opt (working copy) @@ -326,11 +326,11 @@ Warn about subscripts whose type is \"ch Wclobbered C ObjC C++ ObjC++ Var(warn_clobbered) Warning EnabledBy(Wextra) Warn about variables that might be changed by \"longjmp\" or \"vfork\" Wcomment -C ObjC C++ ObjC++ Warning +C ObjC C++ ObjC++ CPP(warn_comments) Var(cpp_warn_comment) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Warn about possibly nested block comments, and C++ comments spanning more than one physical line Wcomments C ObjC C++ ObjC++ Warning Alias(Wcomment) Synonym for -Wcomment @@ -596,11 +596,11 @@ Warn about global functions without prot Wmudflap C ObjC C++ ObjC++ Ignore Warn(switch %qs is no longer supported) Wmultichar -C ObjC C++ ObjC++ Warning +C ObjC C++ ObjC++ CPP(warn_multichar) Var(cpp_warn_multichar) Warning Warn about use of multi-character character constants Wnarrowing C ObjC C++ ObjC++ Warning Var(warn_narrowing) Init(-1) LangEnabledBy(C++ ObjC++,Wall) Warn about narrowing conversions within { } that are ill-formed in C++11 @@ -700,11 +700,11 @@ Warn when a pointer is cast to an intege Wpragmas C ObjC C++ ObjC++ Var(warn_pragmas) Init(1) Warning Warn about misuses of pragmas Wdate-time -Common Var(cpp_warn_date_time) Warning +C ObjC C++ ObjC++ CPP(warn_date_time) Var(cpp_warn_date_time) Warning Warn about __TIME__, __DATE__ and __TIMESTAMP__ usage Wproperty-assign-default ObjC ObjC++ Var(warn_property_assign_default) Init(1) Warning Warn if a property for an Objective-C object has no assign semantics specified Index: gcc/c-family/c-opts.c =================================================================== --- gcc/c-family/c-opts.c (revision 214220) +++ gcc/c-family/c-opts.c (working copy) @@ -366,22 +366,17 @@ c_common_handle_option (size_t scode, co case OPT_Wall: /* ??? Don't add new options here. Use LangEnabledBy in c.opt. */ cpp_opts->warn_trigraphs = value; - cpp_opts->warn_comments = value; cpp_opts->warn_num_sign_change = value; break; case OPT_Wbuiltin_macro_redefined: cpp_opts->warn_builtin_macro_redefined = value; break; - case OPT_Wcomment: - cpp_opts->warn_comments = value; - break; - case OPT_Wc___compat: cpp_opts->warn_cxx_operator_names = value; break; case OPT_Wdeprecated: @@ -405,16 +400,12 @@ c_common_handle_option (size_t scode, co break; case OPT_Wmissing_include_dirs: cpp_opts->warn_missing_include_dirs = value; break; - - case OPT_Wmultichar: - cpp_opts->warn_multichar = value; - break; - case OPT_Wnormalized_: + /* FIXME: Move all this to c.opt. */ if (kind == DK_ERROR) { gcc_assert (!arg); inform (input_location, "-Werror=normalized=: set -Wnormalized=nfc"); cpp_opts->warn_normalize = normalized_C; @@ -1294,11 +1285,10 @@ sanitize_cpp_opts (void) else if (cpp_opts->deps.missing_files) error ("-MG may only be used with -M or -MM"); cpp_opts->unsigned_char = !flag_signed_char; cpp_opts->stdc_0_in_system_headers = STDC_0_IN_SYSTEM_HEADERS; - cpp_opts->warn_date_time = cpp_warn_date_time; cpp_opts->cpp_warn_c90_c99_compat = warn_c90_c99_compat; /* Wlong-long is disabled by default. It is enabled by: [-Wpedantic | -Wtraditional] -std=[gnu|c]++98 ; or [-Wpedantic | -Wtraditional] -std=non-c99 ; or Index: gcc/testsuite/gcc.dg/wdate-time.c =================================================================== --- gcc/testsuite/gcc.dg/wdate-time.c (revision 214220) +++ gcc/testsuite/gcc.dg/wdate-time.c (working copy) @@ -1,6 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-Wdate-time" } */ - -const char time[] = __TIME__; /* { dg-warning "might prevent reproducible builds" } */ -const char date[] = __DATE__; /* { dg-warning "might prevent reproducible builds" } */ -const char timestamp[] = __TIMESTAMP__; /* { dg-warning "might prevent reproducible builds" } */ Index: gcc/testsuite/g++.dg/warn/wdate-time.C =================================================================== --- gcc/testsuite/g++.dg/warn/wdate-time.C (revision 214220) +++ gcc/testsuite/g++.dg/warn/wdate-time.C (working copy) @@ -1,6 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-Wdate-time" } */ - -const char time[] = __TIME__; /* { dg-warning "might prevent reproducible builds" } */ -const char date[] = __DATE__; /* { dg-warning "might prevent reproducible builds" } */ -const char timestamp[] = __TIMESTAMP__; /* { dg-warning "might prevent reproducible builds" } */