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 4483F3858D35 for ; Mon, 13 Feb 2023 10:18:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4483F3858D35 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=1676283535; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HlHBfem3Rn4QjUi5Ou6i+nbH+sYfytIHCxY1eYUCdig=; b=ZRwT+3jecVroFtN3kYUgkj9nfI/GDzVBXJIkstjxl5H67vNedcOBASWAhPn0uX8GPcKqO+ fXBNf9ZlGqrPeImq0GJtUuh1zqPSBpns78/vaH+wces12wHyftpNe6OnK4R+wihuNVb8r3 8KMSF/DZasZXlMTsSL1BpDsPy9+S0ag= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-518-KgNTZwlTNZOOzDDIT8fvpw-1; Mon, 13 Feb 2023 05:18:54 -0500 X-MC-Unique: KgNTZwlTNZOOzDDIT8fvpw-1 Received: by mail-ej1-f72.google.com with SMTP id i11-20020a1709061ccb00b008aadd9cb12fso7286150ejh.5 for ; Mon, 13 Feb 2023 02:18:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HlHBfem3Rn4QjUi5Ou6i+nbH+sYfytIHCxY1eYUCdig=; b=DcFy4XphV2wSPHsri68nPHrBuPiLGzgsVzENqbA0bBuAZaeYhMST4dzTeIv1w7SGBB g99Mef/FpbkJcq8qglDsvpw7l8lWg3BLSKjXeNlj3ku5gEmkK1sbYx0dGpil9nTggD6P ppreIDGqdlMH8yjSzB/2P6gv5i0LTj+dQ9buxWg3npSpDQeDN7/qCneRvAWSYun5Ttbo Jw2lZTAaC2uGIg7TshAHO9VQhLwvAJirphU9d8S9AUh/BthnHuvgEZZaN7a754cfY8Uh qYS9zBCnQbZ7JBVI493XRJ1nwzoop02PKKxze+x+JaPivB6MOQlRFRkTyRwtRjA60KVX ruww== X-Gm-Message-State: AO0yUKX7WInguAesD7dF/d2Gai8DbsbVxZpz7G7EvVpdrz1l13EhqHaG wp+WaiwxWc//n0rzcgh/W19Ly7F0usotWHYC8IN7mA3Z3HiuBsrnTzjf8o0wMsXuW4/bWSbZgXN GmYhPRqexnhVr7uRQwGcLHkj8ExBSIeigdObd9w7WZRd/XkIijBchocT/y8rhae1po80K7DEe X-Received: by 2002:a50:8acc:0:b0:4ac:b4f3:b8a7 with SMTP id k12-20020a508acc000000b004acb4f3b8a7mr7865250edk.7.1676283533104; Mon, 13 Feb 2023 02:18:53 -0800 (PST) X-Google-Smtp-Source: AK7set/Fm9s4wDUwM2e/GLmwpOyYFUEhHZlfujo4jfhZDzS6PgmGDsJYn3PmRc9yTqBvikF33t0lDA== X-Received: by 2002:a50:8acc:0:b0:4ac:b4f3:b8a7 with SMTP id k12-20020a508acc000000b004acb4f3b8a7mr7865232edk.7.1676283532787; Mon, 13 Feb 2023 02:18:52 -0800 (PST) Received: from [192.168.188.47] (dynamic-078-050-122-166.78.50.pool.telefonica.de. [78.50.122.166]) by smtp.gmail.com with ESMTPSA id i8-20020a508708000000b004ab104b3bc6sm6488501edb.55.2023.02.13.02.18.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Feb 2023 02:18:52 -0800 (PST) Message-ID: <09dcc5b3-1479-9b1d-59e5-5e067f65d22b@redhat.com> Date: Mon, 13 Feb 2023 11:18:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: Add clang-format for libstdc++ To: libstdc++@gcc.gnu.org Cc: Jonathan Wakely References: <94bf3c92-0913-0f13-36a0-a65cbecd429a@redhat.com> From: Stephan Bergmann In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 11/02/2023 00:02, Jonathan Wakely wrote: > On Fri, 10 Feb 2023 at 22:05, Stephan Bergmann via Libstdc++ >>> /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.1/../../../../include/c++/13.0.1/bits/fs_path.h:523:41: warning: ParmVar uses unreserved identifier 'base' [stdlibunreserved] >>> path lexically_relative(const path& base) const; >>> ~~~~~~~~~~~~^~~~ >>> /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.1/../../../../include/c++/13.0.1/bits/fs_path.h:524:42: warning: ParmVar uses unreserved identifier 'base' [stdlibunreserved] >>> path lexically_proximate(const path& base) const; >>> ~~~~~~~~~~~~^~~~ > > 'base' is reserved since C++98, due to std::reverse_iterator::base(). > > From a quick glance at the code, I don't see where it figures out > which non-reserved names (i.e. not _[A-Z_]*) are actually reserved and > which to warn about. It doesn't do that at all for now. (But we could of course add an exclude list to filter out known false positives. Short of adding all identifiers used by the standard library to such an exclude list.) So it currently warns about all function parameters that are using unreserved identifiers, even if those identifiers happen to be safe, like in this case. For some other kinds of declarations, it uses the heuristic of only warning if the declaration is a private class member (and all others are assumed to be part of the standard); that's why things like a private member function do_allocate, a private typedef match_flag_type, or a private alias value_type showed up. >>> /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.1/../../../../include/c++/13.0.1/bits/iterator_concepts.h:968:21: warning: TemplateTypeParm uses unreserved identifier 'auto:1' [stdlibunreserved] >>> void begin(auto&) = delete; >>> ~~~~~^ >>> /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.1/../../../../include/c++/13.0.1/bits/iterator_concepts.h:969:27: warning: TemplateTypeParm uses unreserved identifier 'auto:1' [stdlibunreserved] >>> void begin(const auto&) = delete; >>> ~~~~~^ > > That's a keyword :-) almost (note the trailing ":1"); I'd failed to filter out implicit Decls > There are a lot of false positives here, but it's already found a lot > of real bugs, thanks! If there's interest, maybe we could put this into some auxiliary tool directory in the GCC git repo, to be manually run on demand?