[libcxx-commits] [libcxx] [libc++] Enable C++ stdatomic.h for all C++ versions (PR #95498)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 15 10:59:51 PDT 2024


================
@@ -1,22 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: no-threads
-// REQUIRES: c++03 || c++11 || c++14 || c++17 || c++20
-
-// This test ensures that we issue a reasonable diagnostic when including <atomic> after
----------------
ldionne wrote:

This patch trades flexibility for diagnostic quality, IIUC. When we happen to include `<stdatomic.h>` on an implementation where the headers are not compatible, we'll now get the confusing errors mentioned in this comment.

Is that right? Do you see a way that we can somehow detect whether the implementations are compatible and issue a nice diagnostic if they are not compatible?

The `<stdatomic.h>` header had originally been introduced with strict standards conformance and simplicity in mind because the situation is already very confusing for users. The intent was to fail very clearly when users do something they're not supposed to do. Unfortunately, I fear that this patch loses that property. Am I mistaken?

https://github.com/llvm/llvm-project/pull/95498


More information about the libcxx-commits mailing list