From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119879 invoked by alias); 12 Jul 2019 18:39:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 119870 invoked by uid 89); 12 Jul 2019 18:39:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Jul 2019 18:39:03 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 05A1F30842A0 for ; Fri, 12 Jul 2019 18:39:02 +0000 (UTC) Received: from redhat.com (unknown [10.20.4.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9573E60635; Fri, 12 Jul 2019 18:39:01 +0000 (UTC) Date: Fri, 12 Jul 2019 18:41:00 -0000 From: Marek Polacek To: Matthew Beliveau Cc: Jason Merrill , gcc-patches@gcc.gnu.org Subject: Re: [C++ PATCH] PR c++/90590 Suppress warning for enumeration value not handled in switch warning Message-ID: <20190712183859.GQ5989@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-SW-Source: 2019-07/txt/msg00998.txt.bz2 On Fri, Jul 12, 2019 at 02:34:37PM -0400, Matthew Beliveau wrote: > @@ -1628,6 +1629,16 @@ c_do_switch_warnings (splay_tree cases, location_t switch_location, > if (cond && tree_int_cst_compare (cond, value)) > continue; > > + /* If the enumerator is defined in a system header and uses a reserved > + name, then we continue to avoid throwing a warning. */ > + location_t loc = DECL_SOURCE_LOCATION > + (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (type))); As I mentioned before, I wonder if we can get away without the TYPE_MAIN_VARIANT here. > + if (in_system_header_at (loc) > + && name_reserved_for_implementation_p > + (IDENTIFIER_POINTER (TREE_PURPOSE (chain)))) > + continue; > + > + Please drop one newline here. Marek