Skip to content

Commit

Permalink
rename <stdatomic.h> to <__msvc_cxx_stdatomic.h> (#3183)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
barcharcraz and CaseyCarter committed Oct 27, 2022
1 parent 48eb4a4 commit c873cf0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions stl/inc/__msvc_all_public_headers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,11 @@
#include <vector>

#ifndef _M_CEE_PURE
#include <__msvc_cxx_stdatomic.hpp>
#include <atomic>
#include <barrier>
#include <latch>
#include <semaphore>
#ifndef __clang__ // TRANSITION, GH-2862
#include <stdatomic.h>
#endif // TRANSITION, GH-2862
#include <stop_token>
#endif // _M_CEE_PURE

Expand Down
8 changes: 4 additions & 4 deletions stl/inc/stdatomic.h → stl/inc/__msvc_cxx_stdatomic.hpp
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion stl/inc/header-units.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -101,7 +102,6 @@
"sstream",
"stack",
"stacktrace",
"stdatomic.h",
"stdexcept",
"stop_token",
"streambuf",
Expand Down
2 changes: 1 addition & 1 deletion tests/std/tests/P0943R6_stdatomic_h/test.compile.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

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

static_assert(ATOMIC_BOOL_LOCK_FREE == 2);
static_assert(ATOMIC_CHAR_LOCK_FREE == 2);
Expand Down

0 comments on commit c873cf0

Please sign in to comment.