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 [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id EAED73858005 for ; Tue, 27 Sep 2022 13:01:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EAED73858005 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664283663; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8NFMvlkPQ+VjfvvgACrO8ooi3inUrpio068QRPQLys8=; b=IgPwQDVOKftI9Oo2v68G34WYh5F64AUph3us0AFUYxPt8sDqwS64FxPAC9FAja0bF5Qesx ps3OhTmi+o6dLwVuYG9nQpfRk9xB/Fe5yWesPbWrvU77lv7/wEIoGcMjtycP2uHJq3O4Gn au+782roaJEsy2mrRg8uRR5R2Y2eOqE= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-600-LdR1gTQBPti_sb0Yj_hMoQ-1; Tue, 27 Sep 2022 09:01:00 -0400 X-MC-Unique: LdR1gTQBPti_sb0Yj_hMoQ-1 Received: by mail-qt1-f200.google.com with SMTP id w4-20020a05622a134400b0035cbc5ec9a2so6742831qtk.14 for ; Tue, 27 Sep 2022 06:01:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date; bh=8NFMvlkPQ+VjfvvgACrO8ooi3inUrpio068QRPQLys8=; b=RvxrbGvFrfCfOjNABxsMozPWbWs5fdoc8aG5u5QXFB7svcq80QYUzSF2lEWByMVRUO AkbcG2Ivdn07QwC0clyxdqVVJ3uWg5Q79W62YNgeQHyod4OcrSqp53q0mPcwq+jQd2K1 hscWQyL/v75SrorFGnQaYuoe6OCFV6j9PRkrIcE2tHAi1rd2rdrOLC6yLWeR1QBqlW76 fw9lJjzvNIrYNLowk4aq6l4NwKMy/J7tGbS2JYLTOK+T7eK/IaCGIpPiktH1YwisZ+S2 4z5jFhH6P3JeoohlqRWlEtSBkKKLDhHhOFVDQCzh3qlusIs58Cqv1Z+kKHpP4EQ+Vvww NcJg== X-Gm-Message-State: ACrzQf1o9NyKs/tXPCHwxgW77YRbdJIkn94nJpJ/xmixYGEwPjw0FAq4 TeEB1W5/Gk5cpM7InBt2OM3xEs63KflWivVbfbTYdI59rwY14y0KHlvK+2TdaTtP+rPffFXR5RX nzbi/V57OJzodMT8rHg== X-Received: by 2002:a37:aacd:0:b0:6cd:d0b4:9a2e with SMTP id t196-20020a37aacd000000b006cdd0b49a2emr18501041qke.652.1664283659746; Tue, 27 Sep 2022 06:00:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GApdj8T9EVAn58xniovcXQFUV7g6+e4XoE4semH5Z3JyOtkMqT0L7yfJ2ZWJ9+CC8VhlV2A== X-Received: by 2002:a37:aacd:0:b0:6cd:d0b4:9a2e with SMTP id t196-20020a37aacd000000b006cdd0b49a2emr18501016qke.652.1664283659151; Tue, 27 Sep 2022 06:00:59 -0700 (PDT) Received: from redhat.com (2603-7000-9500-2e39-0000-0000-0000-1db4.res6.spectrum.com. [2603:7000:9500:2e39::1db4]) by smtp.gmail.com with ESMTPSA id m17-20020a05620a24d100b006cbcdc6efedsm960164qkn.41.2022.09.27.06.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 06:00:58 -0700 (PDT) Date: Tue, 27 Sep 2022 09:00:56 -0400 From: Marek Polacek To: Richard Biener Cc: Jason Merrill , GCC Patches Subject: Re: [PATCH v2] c++: Don't quote nothrow in diagnostic Message-ID: References: <20220923184026.379494-1-polacek@redhat.com> <5b9a9ee4-f6ed-14d3-b069-e3222739f8d2@redhat.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/2.2.7 (2022-08-07) 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.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,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 Tue, Sep 27, 2022 at 10:41:29AM +0200, Richard Biener wrote: > On Mon, Sep 26, 2022 at 9:54 PM Marek Polacek wrote: > > > > On Mon, Sep 26, 2022 at 12:34:04PM -0400, Jason Merrill wrote: > > > On 9/26/22 03:50, Richard Biener wrote: > > > > On Fri, Sep 23, 2022 at 8:41 PM Marek Polacek via Gcc-patches > > > > wrote: > > > > > > > > > > In > > > > > Jason noticed that we quote "nothrow" in diagnostics even though it's > > > > > not a keyword in C++. Just removing the quotes didn't work because > > > > > then -Wformat-diag complains, so this patch replaces it with "no-throw". > > > > > > > > > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? > > > > > > > > That doesn't look like an improvement to me. Can we quote 'nothrow()' instead? > > > > Understood. > > > > > nothrow() is a syntax error; the C++11 keyword is 'noexcept'. std::nothrow > > > is a dummy placement argument used to indicate that a new-expression should > > > return null rather than throw on failure. > > > > > > But bizarrely, the library traits use the word "nothrow". Marek's patch > > > clarifies that we are not trying to refer to anything in the language. > > > > > > > I'd rather leave it alone than changing it to no-throw. Why does -Wformat-diag > > > > complain? If we shouldn't quote nothrow that should be adjusted? > > > > > > I think -Wformat-diag complains because "nothrow" is an attribute; it also > > > includes some other attribute names in the list of "keywords". > > > > > > I would also be fine with just removing the quotes and removing nothrow from > > > c_keywords. > > > > Like below? Bootstrapped/regtested on x86_64-pc-linux-gnu. > > Yes. I assume that terms like "nothrow constructible" are used in the > C++ standard? I don't really see that. [meta.unary.prop] says "known not to throw any exceptions" for the _nothrow built-ins. That may be too long to use in diagnostics. And the warning would probably complain about the unquoted 'throw' in it. :) > > Note that now I see warnings with my system compiler (gcc-12.2.1). Can > > I commit the c-format.cc hunk to gcc 12 so that eventually even gcc 12 > > stops warning? > > Sure. Thanks. Marek