Skip to content

Commit 8b4ebdc

Browse files
Merge branch 'main' into issue_165752
2 parents 992b359 + 7a73e69 commit 8b4ebdc

File tree

24 files changed

+241
-100
lines changed

24 files changed

+241
-100
lines changed

clang/test/AST/ByteCode/c.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,3 +387,8 @@ void bar2(void) {
387387
int a[2][3][4][5]; // all-note {{array 'a' declared here}}
388388
foo2(&a[0][4]); // all-warning {{array index 4 is past the end of the array}}
389389
}
390+
391+
void plainComplex(void) {
392+
_Complex cd; // all-warning {{_Complex double}}
393+
cd = *(_Complex *)&(struct { double r, i; }){0.0, 0.0}; // all-warning {{_Complex double}}
394+
}

flang-rt/lib/runtime/environment.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
#ifdef _WIN32
1919
extern char **_environ;
20+
#elif defined(__FreeBSD__)
21+
// FreeBSD has environ in crt rather than libc. Using "extern char** environ"
22+
// in the code of a shared library makes it fail to link with -Wl,--no-undefined
23+
// See https://reviews.freebsd.org/D30842#840642
2024
#else
2125
extern char **environ;
2226
#endif
@@ -104,6 +108,11 @@ void ExecutionEnvironment::Configure(int ac, const char *av[],
104108

105109
#ifdef _WIN32
106110
envp = _environ;
111+
#elif defined(__FreeBSD__)
112+
auto envpp{reinterpret_cast<char ***>(dlsym(RTLD_DEFAULT, "environ"))};
113+
if (envpp) {
114+
envp = *envpp;
115+
}
107116
#else
108117
envp = environ;
109118
#endif

libcxx/include/__memory/temp_value.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <__config>
1313
#include <__memory/addressof.h>
1414
#include <__memory/allocator_traits.h>
15-
#include <__type_traits/aligned_storage.h>
1615
#include <__utility/forward.h>
1716

1817
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -26,7 +25,7 @@ struct __temp_value {
2625
typedef allocator_traits<_Alloc> _Traits;
2726

2827
#ifdef _LIBCPP_CXX03_LANG
29-
typename aligned_storage<sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)>::type __v;
28+
_ALIGNAS_TYPE(_Tp) char __v[sizeof(_Tp)];
3029
#else
3130
union {
3231
_Tp __v;

libcxx/include/any

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ namespace std {
8888
# include <__new/allocate.h>
8989
# include <__type_traits/add_cv_quals.h>
9090
# include <__type_traits/add_pointer.h>
91-
# include <__type_traits/aligned_storage.h>
9291
# include <__type_traits/conditional.h>
9392
# include <__type_traits/decay.h>
9493
# include <__type_traits/enable_if.h>
@@ -147,14 +146,13 @@ template <class _ValueType>
147146
_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any*) _NOEXCEPT;
148147

149148
namespace __any_imp {
150-
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
151-
using _Buffer _LIBCPP_NODEBUG = aligned_storage_t<3 * sizeof(void*), alignof(void*)>;
152-
_LIBCPP_SUPPRESS_DEPRECATED_POP
149+
inline constexpr size_t __small_buffer_size = 3 * sizeof(void*);
150+
inline constexpr size_t __small_buffer_alignment = alignof(void*);
153151

154152
template <class _Tp>
155153
using _IsSmallObject _LIBCPP_NODEBUG =
156154
integral_constant<bool,
157-
sizeof(_Tp) <= sizeof(_Buffer) && alignof(_Buffer) % alignof(_Tp) == 0 &&
155+
sizeof(_Tp) <= __small_buffer_size && alignof(_Tp) <= __small_buffer_alignment &&
158156
is_nothrow_move_constructible<_Tp>::value >;
159157

160158
enum class _Action { _Destroy, _Copy, _Move, _Get, _TypeInfo };
@@ -284,7 +282,7 @@ private:
284282
union _Storage {
285283
_LIBCPP_HIDE_FROM_ABI constexpr _Storage() : __ptr(nullptr) {}
286284
void* __ptr;
287-
__any_imp::_Buffer __buf;
285+
alignas(__any_imp::__small_buffer_alignment) char __buf[__any_imp::__small_buffer_size];
288286
};
289287

290288
_LIBCPP_HIDE_FROM_ABI void*

libcxx/include/future

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,12 +584,9 @@ inline future_status __assoc_sub_state::wait_for(const chrono::duration<_Rep, _P
584584
template <class _Rp>
585585
class _LIBCPP_HIDDEN __assoc_state : public __assoc_sub_state {
586586
typedef __assoc_sub_state base;
587-
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
588-
typedef typename aligned_storage<sizeof(_Rp), _LIBCPP_ALIGNOF(_Rp)>::type _Up;
589-
_LIBCPP_SUPPRESS_DEPRECATED_POP
590587

591588
protected:
592-
_Up __value_;
589+
_ALIGNAS_TYPE(_Rp) char __value_[sizeof(_Rp)];
593590

594591
_LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
595592

libcxx/src/exception.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,12 @@
99
#define _LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION
1010
#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
1111

12-
#include <exception>
13-
#include <new>
14-
#include <typeinfo>
15-
16-
#if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
17-
# include <cxxabi.h>
18-
using namespace __cxxabiv1;
19-
# define HAVE_DEPENDENT_EH_ABI 1
20-
#endif
12+
#include <__config>
2113

2214
#if defined(_LIBCPP_ABI_MICROSOFT)
2315
# include "support/runtime/exception_msvc.ipp"
2416
# include "support/runtime/exception_pointer_msvc.ipp"
25-
#elif defined(_LIBCPPABI_VERSION)
17+
#elif defined(LIBCXX_BUILDING_LIBCXXABI)
2618
# include "support/runtime/exception_libcxxabi.ipp"
2719
# include "support/runtime/exception_pointer_cxxabi.ipp"
2820
#elif defined(LIBCXXRT)

libcxx/src/support/runtime/exception_fallback.ipp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
//===----------------------------------------------------------------------===//
99

1010
#include <__verbose_abort>
11+
#include <exception>
12+
#include "include/atomic_support.h"
1113

1214
namespace std {
1315

libcxx/src/support/runtime/exception_glibcxx.ipp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# error header can only be used when targeting libstdc++ or libsupc++
1212
#endif
1313

14+
#include <exception>
15+
#include <new>
16+
1417
namespace std {
1518

1619
bad_alloc::bad_alloc() noexcept {}

libcxx/src/support/runtime/exception_libcxxabi.ipp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10+
#include <exception>
11+
12+
#include <cxxabi.h>
13+
1014
#ifndef _LIBCPPABI_VERSION
1115
# error this header can only be used with libc++abi
1216
#endif
@@ -17,9 +21,9 @@ bool uncaught_exception() noexcept { return uncaught_exceptions() > 0; }
1721

1822
int uncaught_exceptions() noexcept {
1923
#if _LIBCPPABI_VERSION > 1001
20-
return __cxa_uncaught_exceptions();
24+
return abi::__cxa_uncaught_exceptions();
2125
#else
22-
return __cxa_uncaught_exception() ? 1 : 0;
26+
return abi::__cxa_uncaught_exception() ? 1 : 0;
2327
#endif
2428
}
2529

libcxx/src/support/runtime/exception_libcxxrt.ipp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
# error this header may only be used when targeting libcxxrt
1212
#endif
1313

14+
#include <exception>
15+
1416
namespace std {
1517

1618
bad_exception::~bad_exception() noexcept {}

0 commit comments

Comments
 (0)