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.129.124]) by sourceware.org (Postfix) with ESMTPS id 31BD1384E20B for ; Mon, 12 Dec 2022 14:01:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 31BD1384E20B 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=1670853703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Rwg8gGv3foMsbI4vKhajtmEGN+vj5hEvCLqWziPvBPQ=; b=Wm5I2rxz5rYfIYo/dH1cmqGsIvZOl5YBwsA12QR7KVGSTafkntwNgoCaE6iE2AIEgm5LGI c+egyEQMmP6/yq6aGo6iKI60lpRkk+kwyeBJ9ZVPI0BgZ7wsL2sWAcQVdfEMdEw+rwPSZy NnhJc3E9QTGKsqGh0RMNqQqe5Y3RkXA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-655-VIikZblQNrKF5yyebLV2EQ-1; Mon, 12 Dec 2022 09:01:36 -0500 X-MC-Unique: VIikZblQNrKF5yyebLV2EQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B568E85A5A6; Mon, 12 Dec 2022 14:01:35 +0000 (UTC) Received: from localhost (unknown [10.33.36.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B04840C2006; Mon, 12 Dec 2022 14:01:35 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Change names that clash with Win32 or Clang Date: Mon, 12 Dec 2022 14:01:32 +0000 Message-Id: <20221212140132.716931-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,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: Tested x86_64-linux. Pushed to trunk. -- >8-- Clang now defines an __is_unsigned built-in, and Windows defines an _Out_ macro. Replace uses of those as identifiers. There might also be a problem with __is_signed, which we use in several places. libstdc++-v3/ChangeLog: * include/std/chrono (hh_mm_ss): Rename __is_unsigned member to _S_is_unsigned. * include/std/format (basic_format_context): Rename _Out_ template parameter to _Out2. * testsuite/17_intro/names.cc: Add Windows SAL annotation macros. --- libstdc++-v3/include/std/chrono | 6 +++--- libstdc++-v3/include/std/format | 8 ++++---- libstdc++-v3/testsuite/17_intro/names.cc | 11 +++++++++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono index 38ecd3142bc..4c5fbfaeb83 100644 --- a/libstdc++-v3/include/std/chrono +++ b/libstdc++-v3/include/std/chrono @@ -2344,7 +2344,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr bool is_negative() const noexcept { - if constexpr (!__is_unsigned) + if constexpr (!_S_is_unsigned) return _M_is_neg; else return false; @@ -2373,7 +2373,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr precision to_duration() const noexcept { - if constexpr (!__is_unsigned) + if constexpr (!_S_is_unsigned) if (_M_is_neg) return -(_M_h + _M_m + _M_s + subseconds()); return _M_h + _M_m + _M_s + subseconds(); @@ -2382,7 +2382,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // TODO: Implement operator<<. private: - static constexpr bool __is_unsigned + static constexpr bool _S_is_unsigned = __and_v, is_unsigned>; diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index 1072e2c17db..269f8f6cc6a 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -3345,10 +3345,10 @@ namespace __format : _M_args(__args), _M_out(std::move(__out)), _M_loc(__loc) { } - template - friend _Out_ - __format::__do_vformat_to(_Out_, basic_string_view<_CharT_>, - const basic_format_args<_Context_>&, + template + friend _Out2 + __format::__do_vformat_to(_Out2, basic_string_view<_CharT2>, + const basic_format_args<_Context2>&, const locale*); public: diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc index 963f74c11f3..16c104a438d 100644 --- a/libstdc++-v3/testsuite/17_intro/names.cc +++ b/libstdc++-v3/testsuite/17_intro/names.cc @@ -205,6 +205,17 @@ #define ValueT ValueT is not a reserved name #define ValueType ValueType is not a reserved name +#ifndef _WIN32 +// Windows SAL annotations +#define _In_ cannot be used as an identifier +#define _Inout_ cannot be used as an identifier +#define _Out_ cannot be used as an identifier +#define _Reserved_ cannot be used as an identifier +#define __inout cannot be used as an identifier +#define __in_opt cannot be used as an identifier +#define __out_opt cannot be used as an identifier +#endif + #ifdef _AIX // See https://gcc.gnu.org/ml/libstdc++/2017-03/msg00015.html #undef f -- 2.38.1