From patchwork Fri Jun 11 20:10:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 55361 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]) by ozlabs.org (Postfix) with SMTP id D8E57B6ED0 for ; Sat, 12 Jun 2010 06:10:13 +1000 (EST) Received: (qmail 30855 invoked by alias); 11 Jun 2010 20:10:09 -0000 Received: (qmail 30843 invoked by uid 22791); 11 Jun 2010 20:10:08 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Jun 2010 20:10:04 +0000 Received: (qmail 27460 invoked from network); 11 Jun 2010 20:10:02 -0000 Received: from unknown (HELO digraph.polyomino.org.uk) (joseph@127.0.0.2) by mail.codesourcery.com with ESMTPA; 11 Jun 2010 20:10:02 -0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.69) (envelope-from ) id 1ONAYC-00056E-Qv for gcc-patches@gcc.gnu.org; Fri, 11 Jun 2010 20:10:00 +0000 Date: Fri, 11 Jun 2010 20:10:00 +0000 (UTC) From: "Joseph S. Myers" To: gcc-patches@gcc.gnu.org Subject: Add RejectNegative to some common.opt entries Message-ID: MIME-Version: 1.0 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 In the course of other options changes I found that several options in common.opt had Joined and UInteger but not RejectNegative. The combination of Joined or Separate with UInteger means that an unsigned integer operand is read and its value overrides the 0 from a -fno-/-Wno- option or the 1 from the positive form of an option; that is, options such as -fno-abi-version=N act exactly the same as -fabi-version=N. I believe the "no-" forms of the options in question are nonsensical and should be rejected, which this patch does. There are options with arguments for which "no-" versions make sense - such as -Wno-error= - but most -[fmW] options with arguments should be using RejectNegative. (The correct negative form of all -Wstrict-aliasing=N is just plain -Wno-strict-aliasing, which comes from the Wstrict-aliasing entry in common.opt not Wstrict-aliasing=, for example.) Bootstrapped with no regressions on x86_64-unknown-linux-gnu. OK to commit? 2010-06-11 Joseph Myers * common.opt (Wstrict-aliasing=, Wstrict-overflow=, fabi-version=, flto-compression-level=, ftree-parallelize-loops=): Add RejectNegative. testsuite: 2010-06-11 Joseph Myers * gcc.dg/opts-1.c: New test. Index: common.opt =================================================================== --- common.opt (revision 160599) +++ common.opt (working copy) @@ -173,7 +173,7 @@ Warn about code which might break strict aliasing rules Wstrict-aliasing= -Common Joined UInteger Var(warn_strict_aliasing) Init(-1) Warning +Common Joined RejectNegative UInteger Var(warn_strict_aliasing) Init(-1) Warning Warn about code which might break strict aliasing rules Wstrict-overflow @@ -181,7 +181,7 @@ Warn about optimizations that assume that signed overflow is undefined Wstrict-overflow= -Common Joined UInteger Var(warn_strict_overflow) Init(-1) Warning +Common Joined RejectNegative UInteger Var(warn_strict_overflow) Init(-1) Warning Warn about optimizations that assume that signed overflow is undefined Wsuggest-attribute=const @@ -301,7 +301,7 @@ ; Additional positive integers will be assigned as new versions of ; the ABI become the default version of the ABI. fabi-version= -Common Joined UInteger Var(flag_abi_version) Init(2) +Common Joined RejectNegative UInteger Var(flag_abi_version) Init(2) falign-functions Common Report Var(align_functions,0) Optimization UInteger @@ -790,7 +790,7 @@ ; The initial value of -1 comes from Z_DEFAULT_COMPRESSION in zlib.h. flto-compression-level= -Common Joined UInteger Var(flag_lto_compression_level) Init(-1) +Common Joined RejectNegative UInteger Var(flag_lto_compression_level) Init(-1) -flto-compression-level= Use zlib compression level for IL flto-report @@ -1334,7 +1334,7 @@ Enable loop optimizations on tree level ftree-parallelize-loops= -Common Report Joined UInteger Var(flag_tree_parallelize_loops) Init(1) +Common Report Joined RejectNegative UInteger Var(flag_tree_parallelize_loops) Init(1) Enable automatic parallelization of loops ftree-phiprop Index: testsuite/gcc.dg/opts-1.c =================================================================== --- testsuite/gcc.dg/opts-1.c (revision 0) +++ testsuite/gcc.dg/opts-1.c (revision 0) @@ -0,0 +1,9 @@ +/* Test negative forms of various options are rejected. */ +/* { dg-do compile } */ +/* { dg-options "-Wno-strict-aliasing=1 -Wno-strict-overflow=1 -fno-abi-version=1 -fno-lto-compression-level=1 -fno-tree-parallelize-loops=1" } */ + +/* { dg-error "-fno-abi-version" "-fno-abi-version" { target *-*-* } 0 } */ +/* { dg-error "-fno-lto-compression-level" "-fno-lto-compression-level" { target *-*-* } 0 } */ +/* { dg-error "-fno-tree-parallelize-loops" "-fno-tree-parallelize-loops" { target *-*-* } 0 } */ +/* { dg-warning "-Wno-strict-overflow" "-Wno-strict-overflow" { target *-*-* } 0 } */ +/* { dg-warning "-Wno-strict-aliasing" "-Wno-strict-aliasing" { target *-*-* } 0 } */