Skip to content

Commit

Permalink
[libc++][C++03] Use __cxx03/ headers in C++03 mode
Browse files Browse the repository at this point in the history
  • Loading branch information
philnik777 committed Oct 30, 2024
1 parent df30222 commit d7127f0
Show file tree
Hide file tree
Showing 131 changed files with 7,141 additions and 6,347 deletions.
1 change: 1 addition & 0 deletions .github/workflows/libcxx-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
fail-fast: false
matrix:
config: [
'cxx03-main-headers',
'generic-cxx03',
'generic-cxx26',
'generic-modules'
Expand Down
2 changes: 2 additions & 0 deletions libcxx/cmake/caches/cxx03-headers.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set(LIBCXX_TEST_PARAMS "std=c++03;test-cxx03-headers=True" CACHE STRING "")
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
6 changes: 1 addition & 5 deletions libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <__configuration/abi.h>
#include <__configuration/availability.h>
#include <__configuration/compiler.h>
#include <__configuration/cxx03.h>
#include <__configuration/platform.h>

#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
Expand Down Expand Up @@ -151,11 +152,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_TOSTRING2(x) #x
# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)

// NOLINTNEXTLINE(libcpp-cpp-version-check)
# if __cplusplus < 201103L
# define _LIBCPP_CXX03_LANG
# endif

# ifndef __has_constexpr_builtin
# define __has_constexpr_builtin(x) 0
# endif
Expand Down
21 changes: 21 additions & 0 deletions libcxx/include/__configuration/cxx03.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP___CONFIGURATION_CXX03_H
#define _LIBCPP___CONFIGURATION_CXX03_H

#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
# pragma GCC system_header
#endif

// NOLINTNEXTLINE(libcpp-cpp-version-check)
# if __cplusplus < 201103L
# define _LIBCPP_CXX03_LANG
# endif

#endif // _LIBCPP___CONFIGURATION_CXX03_H
5 changes: 0 additions & 5 deletions libcxx/include/__cxx03/__config
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_TOSTRING2(x) #x
# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)

// NOLINTNEXTLINE(libcpp-cpp-version-check)
# if __cplusplus < 201103L
# define _LIBCPP_CXX03_LANG
# endif

# ifndef __has_constexpr_builtin
# define __has_constexpr_builtin(x) 0
# endif
Expand Down
9 changes: 5 additions & 4 deletions libcxx/include/__flat_map/sorted_unique.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
#ifndef _LIBCPP___FLAT_MAP_SORTED_UNIQUE_H
#define _LIBCPP___FLAT_MAP_SORTED_UNIQUE_H

#include <__config>
#include <__configuration/cxx03.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
#if defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_USE_CXX03_HEADERS)
# include <__cxx03/locale.h>
#else
# include <__config>

#if _LIBCPP_STD_VER >= 23

Expand Down
Loading

0 comments on commit d7127f0

Please sign in to comment.