131
131
# define FMT_CONSTEXPR20
132
132
#endif
133
133
134
+ #if defined(FMT_USE_NONTYPE_TEMPLATE_ARGS)
135
+ // Use the provided definition.
136
+ #elif defined(__NVCOMPILER)
137
+ # define FMT_USE_NONTYPE_TEMPLATE_ARGS 0
138
+ #elif FMT_GCC_VERSION >= 903 && FMT_CPLUSPLUS >= 201709L
139
+ # define FMT_USE_NONTYPE_TEMPLATE_ARGS 0
140
+ #elif defined(__cpp_nontype_template_args) && \
141
+ __cpp_nontype_template_args >= 201911L
142
+ # define FMT_USE_NONTYPE_TEMPLATE_ARGS 1
143
+ #else
144
+ # define FMT_USE_NONTYPE_TEMPLATE_ARGS 0
145
+ #endif
146
+
134
147
// Check if exceptions are disabled.
135
148
#ifdef FMT_EXCEPTIONS
136
149
// Use the provided definition.
197
210
# endif
198
211
#endif
199
212
213
+ // GCC < 5 requires this-> in decltype.
214
+ #if FMT_GCC_VERSION && FMT_GCC_VERSION < 500
215
+ # define FMT_DECLTYPE_THIS this ->
216
+ #else
217
+ # define FMT_DECLTYPE_THIS
218
+ #endif
219
+
200
220
#if FMT_MSC_VERSION
201
221
# define FMT_MSC_WARNING (...) __pragma(warning(__VA_ARGS__))
202
222
# define FMT_UNCHECKED_ITERATOR (It ) \
238
258
# define FMT_UNICODE !FMT_MSC_VERSION
239
259
#endif
240
260
241
- #ifndef FMT_USE_NONTYPE_TEMPLATE_ARGS
242
- # if defined(__cpp_nontype_template_args) && \
243
- ((FMT_GCC_VERSION >= 903 && FMT_CPLUSPLUS >= 201709L ) || \
244
- __cpp_nontype_template_args >= 201911L ) && \
245
- !defined(__NVCOMPILER) && !defined(__LCC__)
246
- # define FMT_USE_NONTYPE_TEMPLATE_ARGS 1
247
- # else
248
- # define FMT_USE_NONTYPE_TEMPLATE_ARGS 0
249
- # endif
250
- #endif
251
-
252
- // GCC < 5 requires this-> in decltype.
253
- #ifndef FMT_DECLTYPE_THIS
254
- # if FMT_GCC_VERSION && FMT_GCC_VERSION < 500
255
- # define FMT_DECLTYPE_THIS this ->
256
- # else
257
- # define FMT_DECLTYPE_THIS
258
- # endif
259
- #endif
260
-
261
261
// Enable minimal optimizations for more compact code in debug mode.
262
262
FMT_GCC_PRAGMA (" GCC push_options" )
263
- #if !defined(__OPTIMIZE__) && !defined(__NVCOMPILER) && !defined(__LCC__) && \
264
- !defined(__CUDACC__)
263
+ #if !defined(__OPTIMIZE__) && !defined(__CUDACC__)
265
264
FMT_GCC_PRAGMA (" GCC optimize(\" Og\" )" )
266
265
#endif
267
266
@@ -777,10 +776,8 @@ class compile_parse_context : public basic_format_parse_context<Char> {
777
776
778
777
FMT_CONSTEXPR void check_dynamic_spec (int arg_id) {
779
778
detail::ignore_unused (arg_id);
780
- #if !defined(__LCC__)
781
779
if (arg_id < num_args_ && types_ && !is_integral_type (types_[arg_id]))
782
780
throw_format_error (" width/precision is not integer" );
783
- #endif
784
781
}
785
782
};
786
783
@@ -1315,42 +1312,33 @@ template <typename T>
1315
1312
struct has_format_as
1316
1313
: bool_constant<!std::is_same<format_as_t <T>, void >::value> {};
1317
1314
1315
+ #define FMT_MAP_API FMT_CONSTEXPR FMT_INLINE
1316
+
1318
1317
// Maps formatting arguments to core types.
1319
1318
// arg_mapper reports errors by returning unformattable instead of using
1320
1319
// static_assert because it's used in the is_formattable trait.
1321
1320
template <typename Context> struct arg_mapper {
1322
1321
using char_type = typename Context::char_type;
1323
1322
1324
- FMT_CONSTEXPR FMT_INLINE auto map (signed char val) -> int { return val; }
1325
- FMT_CONSTEXPR FMT_INLINE auto map (unsigned char val) -> unsigned {
1323
+ FMT_MAP_API auto map (signed char val) -> int { return val; }
1324
+ FMT_MAP_API auto map (unsigned char val) -> unsigned { return val; }
1325
+ FMT_MAP_API auto map (short val) -> int { return val; }
1326
+ FMT_MAP_API auto map (unsigned short val) -> unsigned { return val; }
1327
+ FMT_MAP_API auto map (int val) -> int { return val; }
1328
+ FMT_MAP_API auto map (unsigned val) -> unsigned { return val; }
1329
+ FMT_MAP_API auto map (long val) -> long_type { return val; }
1330
+ FMT_MAP_API auto map (unsigned long val) -> ulong_type { return val; }
1331
+ FMT_MAP_API auto map (long long val) -> long long { return val; }
1332
+ FMT_MAP_API auto map (unsigned long long val) -> unsigned long long {
1326
1333
return val;
1327
1334
}
1328
- FMT_CONSTEXPR FMT_INLINE auto map (short val) -> int { return val; }
1329
- FMT_CONSTEXPR FMT_INLINE auto map (unsigned short val) -> unsigned {
1330
- return val;
1331
- }
1332
- FMT_CONSTEXPR FMT_INLINE auto map (int val) -> int { return val; }
1333
- FMT_CONSTEXPR FMT_INLINE auto map (unsigned val) -> unsigned { return val; }
1334
- FMT_CONSTEXPR FMT_INLINE auto map (long val) -> long_type { return val; }
1335
- FMT_CONSTEXPR FMT_INLINE auto map (unsigned long val) -> ulong_type {
1336
- return val;
1337
- }
1338
- FMT_CONSTEXPR FMT_INLINE auto map (long long val) -> long long { return val; }
1339
- FMT_CONSTEXPR FMT_INLINE auto map (unsigned long long val)
1340
- -> unsigned long long {
1341
- return val;
1342
- }
1343
- FMT_CONSTEXPR FMT_INLINE auto map (int128_opt val) -> int128_opt {
1344
- return val;
1345
- }
1346
- FMT_CONSTEXPR FMT_INLINE auto map (uint128_opt val) -> uint128_opt {
1347
- return val;
1348
- }
1349
- FMT_CONSTEXPR FMT_INLINE auto map (bool val) -> bool { return val; }
1335
+ FMT_MAP_API auto map (int128_opt val) -> int128_opt { return val; }
1336
+ FMT_MAP_API auto map (uint128_opt val) -> uint128_opt { return val; }
1337
+ FMT_MAP_API auto map (bool val) -> bool { return val; }
1350
1338
1351
1339
template <typename T, FMT_ENABLE_IF(std::is_same<T, char >::value ||
1352
1340
std::is_same<T, char_type>::value)>
1353
- FMT_CONSTEXPR FMT_INLINE auto map (T val) -> char_type {
1341
+ FMT_MAP_API auto map (T val) -> char_type {
1354
1342
return val;
1355
1343
}
1356
1344
template <typename T, enable_if_t <(std::is_same<T, wchar_t >::value ||
@@ -1361,42 +1349,32 @@ template <typename Context> struct arg_mapper {
1361
1349
std::is_same<T, char32_t >::value) &&
1362
1350
!std::is_same<T, char_type>::value,
1363
1351
int > = 0 >
1364
- FMT_CONSTEXPR FMT_INLINE auto map (T) -> unformattable_char {
1352
+ FMT_MAP_API auto map (T) -> unformattable_char {
1365
1353
return {};
1366
1354
}
1367
1355
1368
- FMT_CONSTEXPR FMT_INLINE auto map (float val) -> float { return val; }
1369
- FMT_CONSTEXPR FMT_INLINE auto map (double val) -> double { return val; }
1370
- FMT_CONSTEXPR FMT_INLINE auto map (long double val) -> long double {
1371
- return val;
1372
- }
1356
+ FMT_MAP_API auto map (float val) -> float { return val; }
1357
+ FMT_MAP_API auto map (double val) -> double { return val; }
1358
+ FMT_MAP_API auto map (long double val) -> long double { return val; }
1373
1359
1374
- FMT_CONSTEXPR FMT_INLINE auto map (char_type* val) -> const char_type* {
1375
- return val;
1376
- }
1377
- FMT_CONSTEXPR FMT_INLINE auto map (const char_type* val) -> const char_type* {
1378
- return val;
1379
- }
1360
+ FMT_MAP_API auto map (char_type* val) -> const char_type* { return val; }
1361
+ FMT_MAP_API auto map (const char_type* val) -> const char_type* { return val; }
1380
1362
template <typename T, typename Char = char_t <T>,
1381
1363
FMT_ENABLE_IF (std::is_same<Char, char_type>::value &&
1382
1364
!std::is_pointer<T>::value)>
1383
- FMT_CONSTEXPR FMT_INLINE auto map (const T& val) -> basic_string_view<Char> {
1365
+ FMT_MAP_API auto map (const T& val) -> basic_string_view<Char> {
1384
1366
return to_string_view (val);
1385
1367
}
1386
1368
template <typename T, typename Char = char_t <T>,
1387
1369
FMT_ENABLE_IF (!std::is_same<Char, char_type>::value &&
1388
1370
!std::is_pointer<T>::value)>
1389
- FMT_CONSTEXPR FMT_INLINE auto map (const T&) -> unformattable_char {
1371
+ FMT_MAP_API auto map (const T&) -> unformattable_char {
1390
1372
return {};
1391
1373
}
1392
1374
1393
- FMT_CONSTEXPR FMT_INLINE auto map (void * val) -> const void* { return val; }
1394
- FMT_CONSTEXPR FMT_INLINE auto map (const void * val) -> const void* {
1395
- return val;
1396
- }
1397
- FMT_CONSTEXPR FMT_INLINE auto map (std::nullptr_t val) -> const void* {
1398
- return val;
1399
- }
1375
+ FMT_MAP_API auto map (void * val) -> const void* { return val; }
1376
+ FMT_MAP_API auto map (const void * val) -> const void* { return val; }
1377
+ FMT_MAP_API auto map (std::nullptr_t val) -> const void* { return val; }
1400
1378
1401
1379
// Use SFINAE instead of a const T* parameter to avoid a conflict with the
1402
1380
// array overload.
@@ -1413,15 +1391,14 @@ template <typename Context> struct arg_mapper {
1413
1391
1414
1392
template <typename T, std::size_t N,
1415
1393
FMT_ENABLE_IF (!std::is_same<T, wchar_t >::value)>
1416
- FMT_CONSTEXPR FMT_INLINE auto map (const T (&values)[N]) -> const T (&)[N] {
1394
+ FMT_MAP_API auto map (const T (&values)[N]) -> const T (&)[N] {
1417
1395
return values;
1418
1396
}
1419
1397
1420
1398
// Only map owning types because mapping views can be unsafe.
1421
1399
template <typename T, typename U = format_as_t <T>,
1422
1400
FMT_ENABLE_IF (std::is_arithmetic<U>::value)>
1423
- FMT_CONSTEXPR FMT_INLINE auto map(const T& val)
1424
- -> decltype(FMT_DECLTYPE_THIS map (U())) {
1401
+ FMT_MAP_API auto map(const T& val) -> decltype(FMT_DECLTYPE_THIS map (U())) {
1425
1402
return map (format_as (val));
1426
1403
}
1427
1404
@@ -1431,11 +1408,11 @@ template <typename Context> struct arg_mapper {
1431
1408
!std::is_const<T>::value)> {};
1432
1409
1433
1410
template <typename T, FMT_ENABLE_IF(formattable<T>::value)>
1434
- FMT_CONSTEXPR FMT_INLINE auto do_map(T& val) -> T& {
1411
+ FMT_MAP_API auto do_map(T& val) -> T& {
1435
1412
return val;
1436
1413
}
1437
1414
template <typename T, FMT_ENABLE_IF(!formattable<T>::value)>
1438
- FMT_CONSTEXPR FMT_INLINE auto do_map(T&) -> unformattable {
1415
+ FMT_MAP_API auto do_map(T&) -> unformattable {
1439
1416
return {};
1440
1417
}
1441
1418
@@ -1445,13 +1422,12 @@ template <typename Context> struct arg_mapper {
1445
1422
!has_to_string_view<U>::value && !is_char<U>::value &&
1446
1423
!is_named_arg<U>::value &&
1447
1424
!std::is_arithmetic<format_as_t <U>>::value)>
1448
- FMT_CONSTEXPR FMT_INLINE auto map (T& val)
1449
- -> decltype(FMT_DECLTYPE_THIS do_map (val)) {
1425
+ FMT_MAP_API auto map (T& val) -> decltype(FMT_DECLTYPE_THIS do_map (val)) {
1450
1426
return do_map (val);
1451
1427
}
1452
1428
1453
1429
template <typename T, FMT_ENABLE_IF(is_named_arg<T>::value)>
1454
- FMT_CONSTEXPR FMT_INLINE auto map(const T& named_arg)
1430
+ FMT_MAP_API auto map(const T& named_arg)
1455
1431
-> decltype(FMT_DECLTYPE_THIS map (named_arg.value)) {
1456
1432
return map (named_arg.value );
1457
1433
}
@@ -1584,7 +1560,7 @@ struct format_arg_store {
1584
1560
named_arg_info<typename Context::char_type> named_args[NUM_NAMED_ARGS];
1585
1561
1586
1562
template <typename ... T>
1587
- FMT_CONSTEXPR FMT_INLINE format_arg_store (T&... values)
1563
+ FMT_MAP_API format_arg_store (T&... values)
1588
1564
: args{{named_args, NUM_NAMED_ARGS},
1589
1565
make_arg<NUM_ARGS <= max_packed_args, Context>(values)...} {
1590
1566
using dummy = int [];
0 commit comments