Skip to content

Commit d7127f0

Browse files
committed
[libc++][C++03] Use __cxx03/ headers in C++03 mode
1 parent df30222 commit d7127f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+7141
-6347
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
fail-fast: false
5656
matrix:
5757
config: [
58+
'cxx03-main-headers',
5859
'generic-cxx03',
5960
'generic-cxx26',
6061
'generic-modules'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
set(LIBCXX_TEST_PARAMS "std=c++03;test-cxx03-headers=True" CACHE STRING "")
2+
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")

libcxx/include/__config

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <__configuration/abi.h>
1515
#include <__configuration/availability.h>
1616
#include <__configuration/compiler.h>
17+
#include <__configuration/cxx03.h>
1718
#include <__configuration/platform.h>
1819

1920
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
@@ -151,11 +152,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
151152
# define _LIBCPP_TOSTRING2(x) #x
152153
# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
153154

154-
// NOLINTNEXTLINE(libcpp-cpp-version-check)
155-
# if __cplusplus < 201103L
156-
# define _LIBCPP_CXX03_LANG
157-
# endif
158-
159155
# ifndef __has_constexpr_builtin
160156
# define __has_constexpr_builtin(x) 0
161157
# endif
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef _LIBCPP___CONFIGURATION_CXX03_H
10+
#define _LIBCPP___CONFIGURATION_CXX03_H
11+
12+
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
13+
# pragma GCC system_header
14+
#endif
15+
16+
// NOLINTNEXTLINE(libcpp-cpp-version-check)
17+
# if __cplusplus < 201103L
18+
# define _LIBCPP_CXX03_LANG
19+
# endif
20+
21+
#endif // _LIBCPP___CONFIGURATION_CXX03_H

libcxx/include/__cxx03/__config

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
157157
# define _LIBCPP_TOSTRING2(x) #x
158158
# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
159159

160-
// NOLINTNEXTLINE(libcpp-cpp-version-check)
161-
# if __cplusplus < 201103L
162-
# define _LIBCPP_CXX03_LANG
163-
# endif
164-
165160
# ifndef __has_constexpr_builtin
166161
# define __has_constexpr_builtin(x) 0
167162
# endif

libcxx/include/__flat_map/sorted_unique.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
#ifndef _LIBCPP___FLAT_MAP_SORTED_UNIQUE_H
1010
#define _LIBCPP___FLAT_MAP_SORTED_UNIQUE_H
1111

12-
#include <__config>
12+
#include <__configuration/cxx03.h>
1313

14-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
15-
# pragma GCC system_header
16-
#endif
14+
#if defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_USE_CXX03_HEADERS)
15+
# include <__cxx03/locale.h>
16+
#else
17+
# include <__config>
1718

1819
#if _LIBCPP_STD_VER >= 23
1920

0 commit comments

Comments
 (0)