From c873cf01323f2f37ce3021f344d905dc84411fe3 Mon Sep 17 00:00:00 2001 From: Charlie Barto Date: Thu, 27 Oct 2022 12:07:20 -0700 Subject: [PATCH] rename `` to `<__msvc_cxx_stdatomic.h>` (#3183) * rename stl stdatomic.h to __msvc_cxx_stdatomic.h * rename inclusions of cxx stdatomic. * rename __msvc_cxx_stdatomic.h to __msvc_cxx_stdatomic.hpp * correct include guards and header comments. * Apply suggestions from code review * remove stdatomic.h from stl's CMakeLists.txt so it's no copied during github build. * remove stdatomic.h from header-units.json Co-authored-by: Casey Carter --- stl/CMakeLists.txt | 2 +- stl/inc/__msvc_all_public_headers.hpp | 4 +--- stl/inc/{stdatomic.h => __msvc_cxx_stdatomic.hpp} | 8 ++++---- stl/inc/header-units.json | 2 +- tests/std/tests/P0943R6_stdatomic_h/test.compile.pass.cpp | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) rename stl/inc/{stdatomic.h => __msvc_cxx_stdatomic.hpp} (93%) diff --git a/stl/CMakeLists.txt b/stl/CMakeLists.txt index ce5a5d44ce..2d4a34d982 100644 --- a/stl/CMakeLists.txt +++ b/stl/CMakeLists.txt @@ -4,6 +4,7 @@ set(HEADERS ${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_all_public_headers.hpp ${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_chrono.hpp + ${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_cxx_stdatomic.hpp ${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_format_ucd_tables.hpp ${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_int128.hpp ${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_iter_core.hpp @@ -191,7 +192,6 @@ set(HEADERS ${CMAKE_CURRENT_LIST_DIR}/inc/sstream ${CMAKE_CURRENT_LIST_DIR}/inc/stack ${CMAKE_CURRENT_LIST_DIR}/inc/stacktrace - ${CMAKE_CURRENT_LIST_DIR}/inc/stdatomic.h ${CMAKE_CURRENT_LIST_DIR}/inc/stdexcept ${CMAKE_CURRENT_LIST_DIR}/inc/stop_token ${CMAKE_CURRENT_LIST_DIR}/inc/streambuf diff --git a/stl/inc/__msvc_all_public_headers.hpp b/stl/inc/__msvc_all_public_headers.hpp index 51f553b946..35c2128d17 100644 --- a/stl/inc/__msvc_all_public_headers.hpp +++ b/stl/inc/__msvc_all_public_headers.hpp @@ -139,13 +139,11 @@ #include #ifndef _M_CEE_PURE +#include <__msvc_cxx_stdatomic.hpp> #include #include #include #include -#ifndef __clang__ // TRANSITION, GH-2862 -#include -#endif // TRANSITION, GH-2862 #include #endif // _M_CEE_PURE diff --git a/stl/inc/stdatomic.h b/stl/inc/__msvc_cxx_stdatomic.hpp similarity index 93% rename from stl/inc/stdatomic.h rename to stl/inc/__msvc_cxx_stdatomic.hpp index 2e821f7f9f..ab3396f637 100644 --- a/stl/inc/stdatomic.h +++ b/stl/inc/__msvc_cxx_stdatomic.hpp @@ -1,11 +1,11 @@ -// stdatomic.h standard header +// __msvc_cxx_stdatomic.hpp internal header // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #pragma once -#ifndef _STDATOMIC_H_ -#define _STDATOMIC_H_ +#ifndef __MSVC_CXX_STDATOMIC_HPP +#define __MSVC_CXX_STDATOMIC_HPP // see _STL_COMPILER_PREPROCESSOR in yvals_core.h #if !defined(RC_INVOKED) && !defined(Q_MOC_RUN) && !defined(__midl) @@ -136,4 +136,4 @@ _STL_RESTORE_CLANG_WARNINGS #endif // ^^^ _HAS_CXX23 ^^^ #endif // !defined(RC_INVOKED) && !defined(Q_MOC_RUN) && !defined(__midl) -#endif // _STDATOMIC_H_ +#endif // __MSVC_CXX_STDATOMIC_HPP diff --git a/stl/inc/header-units.json b/stl/inc/header-units.json index da7529b510..cb5aa43c89 100644 --- a/stl/inc/header-units.json +++ b/stl/inc/header-units.json @@ -6,6 +6,7 @@ "BuildAsHeaderUnits": [ // "__msvc_all_public_headers.hpp", // for testing, not production "__msvc_chrono.hpp", + "__msvc_cxx_stdatomic.hpp", "__msvc_format_ucd_tables.hpp", "__msvc_int128.hpp", "__msvc_iter_core.hpp", @@ -101,7 +102,6 @@ "sstream", "stack", "stacktrace", - "stdatomic.h", "stdexcept", "stop_token", "streambuf", diff --git a/tests/std/tests/P0943R6_stdatomic_h/test.compile.pass.cpp b/tests/std/tests/P0943R6_stdatomic_h/test.compile.pass.cpp index 5f3322f7d7..8a77f29065 100644 --- a/tests/std/tests/P0943R6_stdatomic_h/test.compile.pass.cpp +++ b/tests/std/tests/P0943R6_stdatomic_h/test.compile.pass.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #ifndef __clang__ // TRANSITION, GH-2862 -#include +#include <__msvc_cxx_stdatomic.hpp> static_assert(ATOMIC_BOOL_LOCK_FREE == 2); static_assert(ATOMIC_CHAR_LOCK_FREE == 2);