From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 9FA96385AC3F for ; Tue, 20 Jul 2021 20:16:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9FA96385AC3F Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-601-DwARXk3YOamC3wSy1qvirQ-1; Tue, 20 Jul 2021 16:16:22 -0400 X-MC-Unique: DwARXk3YOamC3wSy1qvirQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 86C811084F4B; Tue, 20 Jul 2021 20:16:20 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-143.ams2.redhat.com [10.36.112.143]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4FFF15D6A1; Tue, 20 Jul 2021 20:16:19 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 16KKGGU81993088 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 20 Jul 2021 22:16:16 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 16KKGEKF1993087; Tue, 20 Jul 2021 22:16:14 +0200 Date: Tue, 20 Jul 2021 22:16:14 +0200 From: Jakub Jelinek To: Martin Sebor Cc: Thomas Schwinge , gcc-patches@gcc.gnu.org, Andrew Stubbs , Hafiz Abid Qadeer , doko@debian.org, David Malcolm Subject: Re: '#pragma GCC diagnostic' (mis-)use in 'statement' of 'if' Message-ID: <20210720201614.GH2380545@tucnak> Reply-To: Jakub Jelinek References: <816ce216-bf6a-75ca-4241-4861ec43ab27@gmail.com> <87pmvii29w.fsf@euler.schwinge.homeip.net> <2e085663-b619-5240-6a40-961420341ebd@codesourcery.com> <87bl6ybsic.fsf@euler.schwinge.homeip.net> <87v9558n4j.fsf@euler.schwinge.homeip.net> <87sg098jk9.fsf@euler.schwinge.homeip.net> <21cf55d5-9a95-dd71-a939-10883d781b7f@gmail.com> MIME-Version: 1.0 In-Reply-To: <21cf55d5-9a95-dd71-a939-10883d781b7f@gmail.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jul 2021 20:16:26 -0000 On Tue, Jul 20, 2021 at 01:47:01PM -0600, Martin Sebor wrote: > > Addressing that is for another day. > > David Malcolm (CC'd) has a patch attached to pr63326 to issue > a warning to point out that #pragmas are treated as statements > that would help prevent this type of a bug. David, do you still > plan to submit it? That patch doesn't look correct. c_parser_pragma and cp_parser_pragma is already told if it appears in a context for which treating the pragma as standalone statement changes the behavior and in contexts where it doesn't - pragma_stmt stands for the problematic ones, pragma_compound for the correct ones (there are other values for namespace scope, class scope etc.). OpenMP/OpenACC pragmas shouldn't be touched, those already do the right thing the standard asks for, for the remaining ones there should be a warning for the pragma_stmt cases. Jakub