@@ -552,12 +552,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
552
552
# define _LIBCPP_USING_DEV_RANDOM
553
553
# endif
554
554
555
- # if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)
556
- # define _LIBCPP_NO_CFI __attribute__ ((__no_sanitize__(" cfi" )))
557
- # else
558
- # define _LIBCPP_NO_CFI
559
- # endif
560
-
561
555
# ifndef _LIBCPP_CXX03_LANG
562
556
563
557
# define _LIBCPP_ALIGNOF (_Tp ) alignof (_Tp)
@@ -629,11 +623,6 @@ typedef __char32_t char32_t;
629
623
# define _LIBCPP_HAS_NO_ASAN
630
624
# endif
631
625
632
- // Allow for build-time disabling of unsigned integer sanitization
633
- # if __has_attribute(no_sanitize)
634
- # define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__ ((__no_sanitize__(" unsigned-integer-overflow" )))
635
- # endif
636
-
637
626
# define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
638
627
639
628
# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
@@ -857,18 +846,6 @@ typedef __char32_t char32_t;
857
846
# define _LIBCPP_HAS_NO_INT128
858
847
# endif
859
848
860
- # if __has_attribute(__malloc__)
861
- # define _LIBCPP_NOALIAS __attribute__ ((__malloc__))
862
- # else
863
- # define _LIBCPP_NOALIAS
864
- # endif
865
-
866
- # if __has_attribute(__using_if_exists__)
867
- # define _LIBCPP_USING_IF_EXISTS __attribute__ ((__using_if_exists__))
868
- # else
869
- # define _LIBCPP_USING_IF_EXISTS
870
- # endif
871
-
872
849
# ifdef _LIBCPP_CXX03_LANG
873
850
# define _LIBCPP_DECLARE_STRONG_ENUM (x ) \
874
851
struct _LIBCPP_EXPORTED_FROM_ABI x { \
@@ -1038,29 +1015,6 @@ typedef __char32_t char32_t;
1038
1015
# define _LIBCPP_CONSTEXPR_SINCE_CXX23
1039
1016
# endif
1040
1017
1041
- # if __has_cpp_attribute(nodiscard)
1042
- # define _LIBCPP_NODISCARD [[__nodiscard__]]
1043
- # else
1044
- // We can't use GCC's [[gnu::warn_unused_result]] and
1045
- // __attribute__((warn_unused_result)), because GCC does not silence them via
1046
- // (void) cast.
1047
- # define _LIBCPP_NODISCARD
1048
- # endif
1049
-
1050
- // _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not
1051
- // specified as such as an extension.
1052
- # if !defined(_LIBCPP_DISABLE_NODISCARD_EXT)
1053
- # define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD
1054
- # else
1055
- # define _LIBCPP_NODISCARD_EXT
1056
- # endif
1057
-
1058
- # if _LIBCPP_STD_VER >= 20 || !defined(_LIBCPP_DISABLE_NODISCARD_EXT)
1059
- # define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD
1060
- # else
1061
- # define _LIBCPP_NODISCARD_AFTER_CXX17
1062
- # endif
1063
-
1064
1018
# ifndef _LIBCPP_HAS_NO_ASAN
1065
1019
extern " C" _LIBCPP_EXPORTED_FROM_ABI void
1066
1020
__sanitizer_annotate_contiguous_container (const void *, const void *, const void *, const void *);
@@ -1196,10 +1150,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
1196
1150
# endif
1197
1151
# endif
1198
1152
1199
- # ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1200
- # define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1201
- # endif
1202
-
1203
1153
# if defined(__FreeBSD__) && defined(__clang__) && __has_attribute(__no_thread_safety_analysis__)
1204
1154
# define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS __attribute__ ((__no_thread_safety_analysis__))
1205
1155
# else
@@ -1232,51 +1182,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
1232
1182
# define _LIBCPP_CONSTINIT
1233
1183
# endif
1234
1184
1235
- # if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
1236
- # define _LIBCPP_DIAGNOSE_WARNING (...) __attribute__((__diagnose_if__(__VA_ARGS__, " warning" )))
1237
- # else
1238
- # define _LIBCPP_DIAGNOSE_WARNING (...)
1239
- # endif
1240
-
1241
- // Use a function like macro to imply that it must be followed by a semicolon
1242
- # if __has_cpp_attribute(fallthrough)
1243
- # define _LIBCPP_FALLTHROUGH () [[fallthrough]]
1244
- # elif __has_attribute(__fallthrough__)
1245
- # define _LIBCPP_FALLTHROUGH () __attribute__((__fallthrough__))
1246
- # else
1247
- # define _LIBCPP_FALLTHROUGH () ((void )0 )
1248
- # endif
1249
-
1250
- # if __has_cpp_attribute(_Clang::__lifetimebound__)
1251
- # define _LIBCPP_LIFETIMEBOUND [[_Clang::__lifetimebound__]]
1252
- # else
1253
- # define _LIBCPP_LIFETIMEBOUND
1254
- # endif
1255
-
1256
- # if __has_attribute(__nodebug__)
1257
- # define _LIBCPP_NODEBUG __attribute__ ((__nodebug__))
1258
- # else
1259
- # define _LIBCPP_NODEBUG
1260
- # endif
1261
-
1262
- # if __has_attribute(__standalone_debug__)
1263
- # define _LIBCPP_STANDALONE_DEBUG __attribute__ ((__standalone_debug__))
1264
- # else
1265
- # define _LIBCPP_STANDALONE_DEBUG
1266
- # endif
1267
-
1268
- # if __has_attribute(__preferred_name__)
1269
- # define _LIBCPP_PREFERRED_NAME (x ) __attribute__((__preferred_name__(x)))
1270
- # else
1271
- # define _LIBCPP_PREFERRED_NAME (x )
1272
- # endif
1273
-
1274
- # if __has_attribute(__no_sanitize__)
1275
- # define _LIBCPP_NO_SANITIZE (...) __attribute__((__no_sanitize__(__VA_ARGS__)))
1276
- # else
1277
- # define _LIBCPP_NO_SANITIZE (...)
1278
- # endif
1279
-
1280
1185
// We often repeat things just for handling wide characters in the library.
1281
1186
// When wide characters are disabled, it can be useful to have a quick way of
1282
1187
// disabling it without having to resort to #if-#endif, which has a larger
@@ -1287,12 +1192,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
1287
1192
# define _LIBCPP_IF_WIDE_CHARACTERS (...) __VA_ARGS__
1288
1193
# endif
1289
1194
1290
- # if defined(_LIBCPP_ABI_MICROSOFT) && __has_declspec_attribute(empty_bases)
1291
- # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec (empty_bases)
1292
- # else
1293
- # define _LIBCPP_DECLSPEC_EMPTY_BASES
1294
- # endif
1295
-
1296
1195
# if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES)
1297
1196
# define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
1298
1197
# define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
@@ -1336,21 +1235,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
1336
1235
# define _LIBCPP_FOPEN_CLOEXEC_MODE
1337
1236
# endif
1338
1237
1339
- # if __has_attribute(__init_priority__)
1340
- # define _LIBCPP_INIT_PRIORITY_MAX __attribute__ ((__init_priority__(100 )))
1341
- # else
1342
- # define _LIBCPP_INIT_PRIORITY_MAX
1343
- # endif
1344
-
1345
- # if __has_attribute(__format__)
1346
- // The attribute uses 1-based indices for ordinary and static member functions.
1347
- // The attribute uses 2-based indices for non-static member functions.
1348
- # define _LIBCPP_ATTRIBUTE_FORMAT (archetype, format_string_index, first_format_arg_index ) \
1349
- __attribute__ ((__format__(archetype, format_string_index, first_format_arg_index)))
1350
- # else
1351
- # define _LIBCPP_ATTRIBUTE_FORMAT (archetype, format_string_index, first_format_arg_index ) /* nothing */
1352
- # endif
1353
-
1354
1238
# if __has_cpp_attribute(msvc::no_unique_address)
1355
1239
// MSVC implements [[no_unique_address]] as a silent no-op currently.
1356
1240
// (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.)
@@ -1390,12 +1274,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
1390
1274
# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED (str )
1391
1275
# endif
1392
1276
1393
- # if __has_attribute(__packed__)
1394
- # define _LIBCPP_PACKED __attribute__ ((__packed__))
1395
- # else
1396
- # define _LIBCPP_PACKED
1397
- # endif
1398
-
1399
1277
// c8rtomb() and mbrtoc8() were added in C++20 and C23. Support for these
1400
1278
// functions is gradually being added to existing C libraries. The conditions
1401
1279
// below check for known C library versions and conditions under which these
@@ -1484,6 +1362,134 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
1484
1362
1485
1363
# define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
1486
1364
1365
+ // Optional attributes - these are useful for a better QoI, but not required to be available
1366
+
1367
+ # if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)
1368
+ # define _LIBCPP_NO_CFI __attribute__ ((__no_sanitize__(" cfi" )))
1369
+ # else
1370
+ # define _LIBCPP_NO_CFI
1371
+ # endif
1372
+
1373
+ # if __has_attribute(__malloc__)
1374
+ # define _LIBCPP_NOALIAS __attribute__ ((__malloc__))
1375
+ # else
1376
+ # define _LIBCPP_NOALIAS
1377
+ # endif
1378
+
1379
+ # if __has_attribute(__using_if_exists__)
1380
+ # define _LIBCPP_USING_IF_EXISTS __attribute__ ((__using_if_exists__))
1381
+ # else
1382
+ # define _LIBCPP_USING_IF_EXISTS
1383
+ # endif
1384
+
1385
+ # if __has_cpp_attribute(nodiscard)
1386
+ # define _LIBCPP_NODISCARD [[__nodiscard__]]
1387
+ # else
1388
+ // We can't use GCC's [[gnu::warn_unused_result]] and
1389
+ // __attribute__((warn_unused_result)), because GCC does not silence them via
1390
+ // (void) cast.
1391
+ # define _LIBCPP_NODISCARD
1392
+ # endif
1393
+
1394
+ // _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not
1395
+ // specified as such as an extension.
1396
+ # if !defined(_LIBCPP_DISABLE_NODISCARD_EXT)
1397
+ # define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD
1398
+ # else
1399
+ # define _LIBCPP_NODISCARD_EXT
1400
+ # endif
1401
+
1402
+ # if _LIBCPP_STD_VER >= 20 || !defined(_LIBCPP_DISABLE_NODISCARD_EXT)
1403
+ # define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD
1404
+ # else
1405
+ # define _LIBCPP_NODISCARD_AFTER_CXX17
1406
+ # endif
1407
+
1408
+ # if __has_attribute(__no_destroy__)
1409
+ # define _LIBCPP_NO_DESTROY __attribute__ ((__no_destroy__))
1410
+ # else
1411
+ # define _LIBCPP_NO_DESTROY
1412
+ # endif
1413
+
1414
+ # if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
1415
+ # define _LIBCPP_DIAGNOSE_WARNING (...) __attribute__((__diagnose_if__(__VA_ARGS__, " warning" )))
1416
+ # else
1417
+ # define _LIBCPP_DIAGNOSE_WARNING (...)
1418
+ # endif
1419
+
1420
+ // Use a function like macro to imply that it must be followed by a semicolon
1421
+ # if __has_cpp_attribute(fallthrough)
1422
+ # define _LIBCPP_FALLTHROUGH () [[fallthrough]]
1423
+ # elif __has_attribute(__fallthrough__)
1424
+ # define _LIBCPP_FALLTHROUGH () __attribute__((__fallthrough__))
1425
+ # else
1426
+ # define _LIBCPP_FALLTHROUGH () ((void )0 )
1427
+ # endif
1428
+
1429
+ # if __has_cpp_attribute(_Clang::__lifetimebound__)
1430
+ # define _LIBCPP_LIFETIMEBOUND [[_Clang::__lifetimebound__]]
1431
+ # else
1432
+ # define _LIBCPP_LIFETIMEBOUND
1433
+ # endif
1434
+
1435
+ # if __has_attribute(__nodebug__)
1436
+ # define _LIBCPP_NODEBUG __attribute__ ((__nodebug__))
1437
+ # else
1438
+ # define _LIBCPP_NODEBUG
1439
+ # endif
1440
+
1441
+ # if __has_attribute(__standalone_debug__)
1442
+ # define _LIBCPP_STANDALONE_DEBUG __attribute__ ((__standalone_debug__))
1443
+ # else
1444
+ # define _LIBCPP_STANDALONE_DEBUG
1445
+ # endif
1446
+
1447
+ # if __has_attribute(__preferred_name__)
1448
+ # define _LIBCPP_PREFERRED_NAME (x ) __attribute__((__preferred_name__(x)))
1449
+ # else
1450
+ # define _LIBCPP_PREFERRED_NAME (x )
1451
+ # endif
1452
+
1453
+ # if __has_attribute(__no_sanitize__)
1454
+ # define _LIBCPP_NO_SANITIZE (...) __attribute__((__no_sanitize__(__VA_ARGS__)))
1455
+ # else
1456
+ # define _LIBCPP_NO_SANITIZE (...)
1457
+ # endif
1458
+
1459
+ # if __has_attribute(__init_priority__)
1460
+ # define _LIBCPP_INIT_PRIORITY_MAX __attribute__ ((__init_priority__(100 )))
1461
+ # else
1462
+ # define _LIBCPP_INIT_PRIORITY_MAX
1463
+ # endif
1464
+
1465
+ # if __has_attribute(__format__)
1466
+ // The attribute uses 1-based indices for ordinary and static member functions.
1467
+ // The attribute uses 2-based indices for non-static member functions.
1468
+ # define _LIBCPP_ATTRIBUTE_FORMAT (archetype, format_string_index, first_format_arg_index ) \
1469
+ __attribute__ ((__format__(archetype, format_string_index, first_format_arg_index)))
1470
+ # else
1471
+ # define _LIBCPP_ATTRIBUTE_FORMAT (archetype, format_string_index, first_format_arg_index ) /* nothing */
1472
+ # endif
1473
+
1474
+ # if __has_attribute(__packed__)
1475
+ # define _LIBCPP_PACKED __attribute__ ((__packed__))
1476
+ # else
1477
+ # define _LIBCPP_PACKED
1478
+ # endif
1479
+
1480
+ # if defined(_LIBCPP_ABI_MICROSOFT) && __has_declspec_attribute(empty_bases)
1481
+ # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec (empty_bases)
1482
+ # else
1483
+ # define _LIBCPP_DECLSPEC_EMPTY_BASES
1484
+ # endif
1485
+
1486
+ // Allow for build-time disabling of unsigned integer sanitization
1487
+ # if __has_attribute(no_sanitize) && !defined(_LIBCPP_COMPILER_GCC)
1488
+ # define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__ ((__no_sanitize__(" unsigned-integer-overflow" )))
1489
+ # else
1490
+ # define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1491
+ # endif
1492
+
1487
1493
#endif // __cplusplus
1488
1494
1489
1495
#endif // _LIBCPP___CONFIG
0 commit comments