Skip to content

Commit c873cf0

Browse files
rename <stdatomic.h> 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 <[email protected]>
1 parent 48eb4a4 commit c873cf0

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

stl/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
set(HEADERS
55
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_all_public_headers.hpp
66
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_chrono.hpp
7+
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_cxx_stdatomic.hpp
78
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_format_ucd_tables.hpp
89
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_int128.hpp
910
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_iter_core.hpp
@@ -191,7 +192,6 @@ set(HEADERS
191192
${CMAKE_CURRENT_LIST_DIR}/inc/sstream
192193
${CMAKE_CURRENT_LIST_DIR}/inc/stack
193194
${CMAKE_CURRENT_LIST_DIR}/inc/stacktrace
194-
${CMAKE_CURRENT_LIST_DIR}/inc/stdatomic.h
195195
${CMAKE_CURRENT_LIST_DIR}/inc/stdexcept
196196
${CMAKE_CURRENT_LIST_DIR}/inc/stop_token
197197
${CMAKE_CURRENT_LIST_DIR}/inc/streambuf

stl/inc/__msvc_all_public_headers.hpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,11 @@
139139
#include <vector>
140140

141141
#ifndef _M_CEE_PURE
142+
#include <__msvc_cxx_stdatomic.hpp>
142143
#include <atomic>
143144
#include <barrier>
144145
#include <latch>
145146
#include <semaphore>
146-
#ifndef __clang__ // TRANSITION, GH-2862
147-
#include <stdatomic.h>
148-
#endif // TRANSITION, GH-2862
149147
#include <stop_token>
150148
#endif // _M_CEE_PURE
151149

stl/inc/stdatomic.h renamed to stl/inc/__msvc_cxx_stdatomic.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// stdatomic.h standard header
1+
// __msvc_cxx_stdatomic.hpp internal header
22

33
// Copyright (c) Microsoft Corporation.
44
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

66
#pragma once
7-
#ifndef _STDATOMIC_H_
8-
#define _STDATOMIC_H_
7+
#ifndef __MSVC_CXX_STDATOMIC_HPP
8+
#define __MSVC_CXX_STDATOMIC_HPP
99

1010
// see _STL_COMPILER_PREPROCESSOR in yvals_core.h
1111
#if !defined(RC_INVOKED) && !defined(Q_MOC_RUN) && !defined(__midl)
@@ -136,4 +136,4 @@ _STL_RESTORE_CLANG_WARNINGS
136136
#endif // ^^^ _HAS_CXX23 ^^^
137137

138138
#endif // !defined(RC_INVOKED) && !defined(Q_MOC_RUN) && !defined(__midl)
139-
#endif // _STDATOMIC_H_
139+
#endif // __MSVC_CXX_STDATOMIC_HPP

stl/inc/header-units.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"BuildAsHeaderUnits": [
77
// "__msvc_all_public_headers.hpp", // for testing, not production
88
"__msvc_chrono.hpp",
9+
"__msvc_cxx_stdatomic.hpp",
910
"__msvc_format_ucd_tables.hpp",
1011
"__msvc_int128.hpp",
1112
"__msvc_iter_core.hpp",
@@ -101,7 +102,6 @@
101102
"sstream",
102103
"stack",
103104
"stacktrace",
104-
"stdatomic.h",
105105
"stdexcept",
106106
"stop_token",
107107
"streambuf",

tests/std/tests/P0943R6_stdatomic_h/test.compile.pass.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

44
#ifndef __clang__ // TRANSITION, GH-2862
5-
#include <stdatomic.h>
5+
#include <__msvc_cxx_stdatomic.hpp>
66

77
static_assert(ATOMIC_BOOL_LOCK_FREE == 2);
88
static_assert(ATOMIC_CHAR_LOCK_FREE == 2);

0 commit comments

Comments
 (0)