From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id F010A3858D20 for ; Wed, 15 Nov 2023 05:54:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F010A3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F010A3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::629 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700027650; cv=none; b=vXv9QREW9niMh0Fji+FlY4fA/DNBrcedpqwgtreY+LEoicgqr2p7f06JrrR/P6GFoo7cCIbazHUjhWdmKF/x6xNj9+42/vs+r6PRGtkL67YgBcktRkfC4BAFfCXErnkVSJH4YopAMg8LO5mpGMj0kY43XthIW8gMY6Rrs7SRI3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700027650; c=relaxed/simple; bh=DCfYXxVmYDwcGl7CCLcUvUXDcT+CHxABACh6PZ9kFVY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=VmIk5qJIWgGbAw/m24JOv2rzQS58+sukv4gbAStzkJI9HrfeOCC4N4qy5HIuvBy7bd10StzpuqeMysiIRolyqDDr7aTfZtgTJ58BLM3frNhszMYQlN1r95CGIk0tI9cBoi8RxufA22eqyklc91XQgegAa4uffueSKPtwWEglzKw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1cc53d0030fso4274065ad.0 for ; Tue, 14 Nov 2023 21:54:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1700027647; x=1700632447; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yhkEm1rrW0WRMUSjoHy2FwRG3GzjTJ4eKa3EZWQKYHc=; b=RmI192vBRZvKueqEuQ3fG+Xm1wj/jpw7d1dqXnHkRToSwsuWtdsIsbzIWhx6Y7wBd0 C3dt5HtD3KArqyx9+GAOOowlFYXD5p1pcCcllCzsmUDXkmOEDL1zegaUaolG9cc5boaE LtcctXrRAWZ7S3fpktkGi+PMD3ZeDvmP79aui9QuleW7vp1D2uyBCFM4cW3bv4/4SaO2 i9pLXBel2c+iZ6bN41cDyNjRZM+q7NmKWu+zSWPca80PvZtlm8OG/TgNqK8qT6lZEpnb 7TMJiu2synAZUpwGdRpljPNK7X1o3e2yNRAF3zCQHgY9KeJ0CHzgmwO4HJH+5KKPLLzp Pj3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700027647; x=1700632447; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yhkEm1rrW0WRMUSjoHy2FwRG3GzjTJ4eKa3EZWQKYHc=; b=QlBFt+2lU2APp9uKL0AgM6hYG5WbDb7f7+FOF99pZ5pMU8eQOepnjYLE0ZgpC+k65h ESzk/wxv+JHm+5xaGOokAoDBRxYtcsbscJfotqY6zYbNlFvNhPIL6kiupfzcK39p2b2i zilszn5tIy10tv6qeOZQVCZoeyKJih+gjrYJjKME9OC5EdGuFY6jYS1q2NRKW1MhXcIj VP2/fieKy7eCgrnE5sYWNDPw7wDehnDswYHPaYHmUGVhJCgEbGEj0paf5W9vucSh6mnz GnPiZr9JwVgK8mz7A6IlljN2juAbrapK7MYn11iYFKYMu0VJ9CwfgsaV+TXoBlmZISav ux4g== X-Gm-Message-State: AOJu0Yx0NnO15jmsfAJL2zYlsor8QKJ3/5oA6CE+FM1ylnxXu7bBhF67 +tkzKGt0o6BpmZsmtt1RxmhnOA== X-Google-Smtp-Source: AGHT+IE+ZXOGyHV4qplAmoB635S7gTaRacgT828on8BkDPgc8Vk8BHhJOtHVCQKX9n9EktXIrrlcLg== X-Received: by 2002:a17:903:1ca:b0:1cc:476c:8974 with SMTP id e10-20020a17090301ca00b001cc476c8974mr6234829plh.0.1700027646850; Tue, 14 Nov 2023 21:54:06 -0800 (PST) Received: from free.home ([2804:7f1:2080:27a6:3b92:27bb:be38:1ee3]) by smtp.gmail.com with ESMTPSA id jw16-20020a170903279000b001b53953f306sm6690947plb.178.2023.11.14.21.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 21:54:06 -0800 (PST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 3AF5rreV2424535 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 02:53:54 -0300 From: Alexandre Oliva To: Patrick Palka Cc: Jonathan Wakely , =?utf-8?Q?Fran=C3=A7ois?= Dumont , Jonathan Wakely , libstdc++ Subject: Re: [PATCH] libstdc++: bvector: undef always_inline macro Organization: Free thinker, does not speak for AdaCore References: <0e2723e5-a60d-484e-b4f4-951bc8dfde8d@gmail.com> <0bc0279d-0f50-a0a6-1535-50dbb6ce1110@idea> Date: Wed, 15 Nov 2023 02:53:53 -0300 In-Reply-To: <0bc0279d-0f50-a0a6-1535-50dbb6ce1110@idea> (Patrick Palka's message of "Tue, 14 Nov 2023 21:20:55 -0500 (EST)") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,WEIRD_QUOTING 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 Nov 14, 2023, Patrick Palka wrote: > Hmm, in which headers do we currently undef _GLIBCXX_ALWAYS_INLINE? None whatsoever, AFAICT. Of the 7 headers that mention _GLIBCXX_ALWAYS_INLINE, some (but not all) #define it, and none #undef it. Bringing them in line with the alleged custom would require an (untested) patch like this. (It also makes sure that no #include stands between the #define and the uses) libstdc++: define and undefine always_inline macro wherever used --- libstdc++-v3/include/bits/atomic_base.h | 10 ++++++---- libstdc++-v3/include/bits/atomic_futex.h | 2 ++ libstdc++-v3/include/bits/char_traits.h | 8 +++++--- libstdc++-v3/include/bits/semaphore_base.h | 7 +++++++ libstdc++-v3/include/bits/stl_bvector.h | 10 ++++++---- libstdc++-v3/include/std/barrier | 8 ++++++++ libstdc++-v3/include/std/latch | 7 +++++++ 7 files changed, 41 insertions(+), 11 deletions(-) diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h index 974872ad7a630..5562365c74c74 100644 --- a/libstdc++-v3/include/bits/atomic_base.h +++ b/libstdc++-v3/include/bits/atomic_base.h @@ -42,14 +42,14 @@ #include #endif -#ifndef _GLIBCXX_ALWAYS_INLINE -#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) -#endif - #define __glibcxx_want_atomic_value_initialization #define __glibcxx_want_atomic_flag_test #include +#ifndef _GLIBCXX_ALWAYS_INLINE +#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) +#endif + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -2067,4 +2067,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace std +#undef _GLIBCXX_ALWAYS_INLINE + #endif diff --git a/libstdc++-v3/include/bits/atomic_futex.h b/libstdc++-v3/include/bits/atomic_futex.h index 6b37ce5ed120e..0f370fa82de06 100644 --- a/libstdc++-v3/include/bits/atomic_futex.h +++ b/libstdc++-v3/include/bits/atomic_futex.h @@ -357,4 +357,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace std +#undef _GLIBCXX_ALWAYS_INLINE + #endif diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h index e9b4e84af994f..e56818b254b67 100644 --- a/libstdc++-v3/include/bits/char_traits.h +++ b/libstdc++-v3/include/bits/char_traits.h @@ -57,13 +57,13 @@ # include #endif +#define __glibcxx_want_constexpr_char_traits +#include + #ifndef _GLIBCXX_ALWAYS_INLINE # define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) #endif -#define __glibcxx_want_constexpr_char_traits -#include - namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -1027,4 +1027,6 @@ _GLIBCXX_END_NAMESPACE_VERSION #endif // C++11 +#undef _GLIBCXX_ALWAYS_INLINE + #endif // _CHAR_TRAITS_H diff --git a/libstdc++-v3/include/bits/semaphore_base.h b/libstdc++-v3/include/bits/semaphore_base.h index 2b3c196040baa..06a45f6876a26 100644 --- a/libstdc++-v3/include/bits/semaphore_base.h +++ b/libstdc++-v3/include/bits/semaphore_base.h @@ -45,6 +45,10 @@ # include // sem_t, sem_init, sem_wait, sem_post etc. #endif +#ifndef _GLIBCXX_ALWAYS_INLINE +#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) +#endif + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -274,4 +278,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace std + +#undef _GLIBCXX_ALWAYS_INLINE + #endif // _GLIBCXX_SEMAPHORE_BASE_H diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 64f04c1f4f599..c1aa3396414d2 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -56,15 +56,15 @@ #ifndef _STL_BVECTOR_H #define _STL_BVECTOR_H 1 -#ifndef _GLIBCXX_ALWAYS_INLINE -#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) -#endif - #if __cplusplus >= 201103L #include #include #endif +#ifndef _GLIBCXX_ALWAYS_INLINE +#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) +#endif + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -1630,4 +1630,6 @@ _GLIBCXX_END_NAMESPACE_CONTAINER _GLIBCXX_END_NAMESPACE_VERSION } // namespace std +#undef _GLIBCXX_ALWAYS_INLINE + #endif diff --git a/libstdc++-v3/include/std/barrier b/libstdc++-v3/include/std/barrier index 8e03a5820c6e5..5aaffa62086c4 100644 --- a/libstdc++-v3/include/std/barrier +++ b/libstdc++-v3/include/std/barrier @@ -52,6 +52,10 @@ #include +#ifndef _GLIBCXX_ALWAYS_INLINE +#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) +#endif + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -261,5 +265,9 @@ It looks different from literature pseudocode for two main reasons: _GLIBCXX_END_NAMESPACE_VERSION } // namespace + +#undef _GLIBCXX_ALWAYS_INLINE + #endif // __cpp_lib_barrier + #endif // _GLIBCXX_BARRIER diff --git a/libstdc++-v3/include/std/latch b/libstdc++-v3/include/std/latch index 27cd80d71005f..0548ddd67ae57 100644 --- a/libstdc++-v3/include/std/latch +++ b/libstdc++-v3/include/std/latch @@ -40,6 +40,10 @@ #include #include +#ifndef _GLIBCXX_ALWAYS_INLINE +#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) +#endif + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -90,5 +94,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace + +#undef _GLIBCXX_ALWAYS_INLINE + #endif // __cpp_lib_latch #endif // _GLIBCXX_LATCH -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Excluding neuro-others for not behaving ""normal"" is *not* inclusive