From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by sourceware.org (Postfix) with ESMTPS id 892193858D33 for ; Wed, 15 Feb 2023 21:10:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 892193858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f44.google.com with SMTP id l2so38605wry.0 for ; Wed, 15 Feb 2023 13:10:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xamUeWq7vT5/QqfcJSAGMacMnV1s+GNdLRy+99tOVEI=; b=myMtJp9ZHhCTIYUg/Au7quK4HzdqZosQItfs6hgooYY/O4igcJe72TiQyce4vSKiqn DASAF/x/NM2BJKGdD/V5aWKLla4okmz1Bw22c+mUBsTsAF44oYBR159uDBlLm42lrqtO sItJgntfvy+zKeBQ3YwaFvLPCD1WB4mAd8BNbJc6HNLr7HQIZmOBNypdOd0fkiWY5Z9J OFYIX4JsfHPwJJLECrqtbzvksm/kD3MrqINcRQAXyJTxcIVHdxQlSh6ouyVuwPkivgmK jYrkLIPZc4moerAbsHHhS8iORODXrozaAJMHYb4BCfJXFv87JPaRnFjt1wX7A3BmmIoY /o0A== X-Gm-Message-State: AO0yUKUExCHPe5gtUaxGKHN0dBtWpvoTDLBJue8EE64FxW3FtmQpvkx1 1U/neEMGX8hHYM1N9V7dG9I4AORjXeDHoA== X-Google-Smtp-Source: AK7set9TusgcENs5q6kxWdmyUQW1S695EEWYimcgOrIN9Vm6rzaiTV3DRBK7hX+nBzERuxSlH6UMDQ== X-Received: by 2002:adf:cf10:0:b0:2c3:dd9e:8ccc with SMTP id o16-20020adfcf10000000b002c3dd9e8cccmr3029959wrj.64.1676495406196; Wed, 15 Feb 2023 13:10:06 -0800 (PST) Received: from ?IPv6:2001:8a0:f92b:9e00::1fe? ([2001:8a0:f92b:9e00::1fe]) by smtp.gmail.com with ESMTPSA id v2-20020a5d6102000000b002be5bdbe40csm16375584wrt.27.2023.02.15.13.10.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Feb 2023 13:10:05 -0800 (PST) Subject: Re: [PATCH 1/6] Fix "ptype INTERNAL_FUNC" (PR gdb/30105) To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20230210233604.2228450-1-pedro@palves.net> <20230210233604.2228450-2-pedro@palves.net> <873578uv3e.fsf@tromey.com> From: Pedro Alves Message-ID: <01c8ca93-d5e0-a12d-c331-eaadc0048835@palves.net> Date: Wed, 15 Feb 2023 21:10:03 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <873578uv3e.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_LOTSOFHASH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-02-14 3:26 p.m., Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > > Pedro> That comment quoted above says that gcc -Wall will reveal any types > Pedro> that haven't been handled, but that's not actually true, at least with > Pedro> modern GCCs. You would need to enable -Wswitch-enum for that, which > Pedro> we don't. > > We could do it for selected switches using a pragma, if we wanted. Yeah, that is actually what I had done locally, to check which enums we weren't handling, with the patch below. > (What would be cool is an attribute to apply to the switch so we didn't > have to wrap the whole thing.) Yeah! I have the vague impression of once seeing that clang has something like that, but I may be wrong. > > I tried enabling it globally but it has a lot of noise, and adding > "default" all over defeats the purpose of the flag. *nod* >From 715b0e7d83f02fe2e6356ea297d81dd6e3105858 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 9 Feb 2023 21:26:50 +0000 Subject: [PATCH] -Wswitch-enum Change-Id: I09d8bab56abe241e21564812e910452a68752b1e --- gdb/c-typeprint.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index dca96231117..3966961f149 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -372,6 +372,9 @@ c_type_print_varspec_prefix (struct type *type, QUIT; +DIAGNOSTIC_PUSH +DIAGNOSTIC_ERROR ("-Wswitch-enum") + switch (type->code ()) { case TYPE_CODE_PTR: @@ -467,6 +470,8 @@ c_type_print_varspec_prefix (struct type *type, error (_("type not handled in c_type_print_varspec_prefix()")); break; } + +DIAGNOSTIC_POP } /* Print out "const" and "volatile" attributes, @@ -763,6 +768,9 @@ c_type_print_varspec_suffix (struct type *type, QUIT; +DIAGNOSTIC_PUSH +DIAGNOSTIC_ERROR ("-Wswitch-enum") + switch (type->code ()) { case TYPE_CODE_ARRAY: @@ -848,6 +856,9 @@ c_type_print_varspec_suffix (struct type *type, error (_("type not handled in c_type_print_varspec_suffix()")); break; } + +DIAGNOSTIC_POP + } /* A helper for c_type_print_base that displays template base-commit: b885aea1bb987435929b4298982ac6fc27f69403 prerequisite-patch-id: 8137bd248a83bbcb2cacfb0250eef1994eafaeac prerequisite-patch-id: 78b3c4f199e7af4170c5fc713bd88fd4ac62dc36 -- 2.36.0