From patchwork Wed Jun 19 20:32:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 252653 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id C2AA22C0097 for ; Thu, 20 Jun 2013 06:33:51 +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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=EDEYji25MvXzeg02n dpvHJQSNk0mDVwZoyl/d+YAXB6hjBJ/FJ8+Ne+rDdD+Ix8cBYvTFZ6mYk1hAq1j1 32vBAYLNMMeCmDVO9c06NWBffdp+iZtoIk0lX3VYfdQc5nGytLmbLaDgNWycKCIP +rHCVFOdyWMkGeWL0ONCC3CgsA= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=AhD22jvkrZrRPEuNA406fiy xClI=; b=DskPSMhxJ9NPphA33A1OKbO9mbd2+KmpdNUu6iMZMHa3WmvRyHprc7V 2EvLg0iMknyiiUCCBFFjm/RtqfzcnGG14FWkGqKOmKFo8RG3PlB2cg6GZGlv7giJ mder3Z1FUIs+iyNK46sf8bNpmjEAxEEwis0UhWtkLbv4/M4DqNjU= Received: (qmail 16856 invoked by alias); 19 Jun 2013 20:33:26 -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 16786 invoked by uid 89); 19 Jun 2013 20:33:25 -0000 X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, TW_CX autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 19 Jun 2013 20:33:24 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UpP4D-00067G-Q7 from Sandra_Loosemore@mentor.com ; Wed, 19 Jun 2013 13:33:21 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 19 Jun 2013 13:33:21 -0700 Received: from [IPv6:::1] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Wed, 19 Jun 2013 13:33:35 -0700 Message-ID: <51C2157B.9090707@codesourcery.com> Date: Wed, 19 Jun 2013 14:32:59 -0600 From: Sandra Loosemore User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: "Joseph S. Myers" CC: Julian Brown , Richard Biener , Jakub Jelinek , GCC Patches Subject: patch [6/5] check for conflict with -fstrict-volatile-bitfields and -std= References: <51BE0D1C.9070404@codesourcery.com> <20130616192653.GP2336@tucnak.redhat.com> <20130617123120.7451adb3@octopus> <51BF3ED7.6000206@codesourcery.com> <51BFA3A2.5030402@codesourcery.com> In-Reply-To: <51BFA3A2.5030402@codesourcery.com> X-Virus-Found: No On 06/17/2013 06:02 PM, Sandra Loosemore wrote: > > I had another thought: perhaps -fstrict-volatile-bitfields could remain > the default on targets where it currently is, but it can be overridden > by an appropriate -std= option. Perhaps also GCC could give an error if > -fstrict-volatile-bitfields is given explicitly with an incompatible > -std= option. Like this. This patch is intended to be applied on top of the other 5 pieces in this series, although in theory it's independent of them. OK to commit, and does this resolve the objection to part 3? -Sandra Index: gcc/c-family/c-opts.c =================================================================== --- gcc/c-family/c-opts.c (revision 199963) +++ gcc/c-family/c-opts.c (working copy) @@ -813,6 +813,18 @@ c_common_post_options (const char **pfil C_COMMON_OVERRIDE_OPTIONS; #endif + /* C11 and C++11 specify a memory model that is incompatible with + -fstrict-volatile-bitfields. Warn if that option is given explicitly + and prevent backends from defaulting to turning it on. */ + if (flag_isoc11 || cxx_dialect >= cxx11) + { + if (flag_strict_volatile_bitfields > 0) + warning (0, "-fstrict-volatile-bitfields conflicts with the " + "C11 and C++11 memory model"); + else + flag_strict_volatile_bitfields = 0; + } + /* Excess precision other than "fast" requires front-end support. */ if (c_dialect_cxx ()) Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 199963) +++ gcc/doc/invoke.texi (working copy) @@ -20899,4 +20899,12 @@ AAPCS, @option{-fstrict-volatile-bitfields} is the default. +Note that @option{-fstrict-volatile-bitfields} is incompatible with +the bit-field access behavior required by the ISO C11 and C++11 +standards. GCC warns if @option{-fstrict-volatile-bitfields} is given +explicitly with an incompatible @option{-std=} option. On targets +that otherwise default to @option{-fstrict-volatile-bitfields}, +providing an incompatible @option{-std=} option implicitly disables +@option{-fstrict-volatile-bitfields}. + @item -fsync-libcalls @opindex fsync-libcalls