@@ -334,14 +334,17 @@ CString libc_make_test_file_path_func(const char *file_name);
334
334
return " [ParamType = " #TYPE " ]" ; \
335
335
}
336
336
337
+ #define LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA (x ) _Pragma (#x);
337
338
338
- #define DO_PRAGMA (x ) _Pragma (#x);
339
+ #define LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_BEGIN \
340
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA (GCC diagnostic push)
339
341
340
- #define DO_PRAGMA_BEGIN DO_PRAGMA (GCC diagnostic push)
342
+ #define LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_BODY \
343
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA (GCC diagnostic ignored \
344
+ " -Wglobal-constructors" )
341
345
342
- #define DO_PRAGMA_BODY DO_PRAGMA (GCC diagnostic ignored " -Wglobal-constructors" )
343
-
344
- #define DO_PRAGMA_END DO_PRAGMA (GCC diagnostic pop)
346
+ #define LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_END \
347
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA (GCC diagnostic pop)
345
348
346
349
#define TYPED_TEST (SuiteName, TestName, TypeList ) \
347
350
static_assert ( \
@@ -360,11 +363,11 @@ CString libc_make_test_file_path_func(const char *file_name);
360
363
void Run () override ; \
361
364
const char *getName () const override { return name; } \
362
365
}; \
363
- DO_PRAGMA_BEGIN \
364
- DO_PRAGMA_BODY \
366
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_BEGIN \
367
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_BODY \
365
368
TypeList::Tests<SuiteName##_##TestName>::type \
366
369
SuiteName##_##TestName##_Instance; \
367
- DO_PRAGMA_END \
370
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_END \
368
371
template <typename T> void SuiteName##_##TestName<T>::Run()
369
372
370
373
#define TYPED_TEST_F (SuiteClass, TestName, TypeList ) \
@@ -383,11 +386,11 @@ CString libc_make_test_file_path_func(const char *file_name);
383
386
void Run () override ; \
384
387
const char *getName () const override { return name; } \
385
388
}; \
386
- DO_PRAGMA_BEGIN \
387
- DO_PRAGMA_BODY \
389
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_BEGIN \
390
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_BODY \
388
391
TypeList::Tests<SuiteClass##_##TestName>::type \
389
392
SuiteClass##_##TestName##_Instance; \
390
- DO_PRAGMA_END \
393
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_END \
391
394
template <typename T> void SuiteClass##_##TestName<T>::Run()
392
395
393
396
#define TEST (SuiteName, TestName ) \
@@ -399,10 +402,10 @@ CString libc_make_test_file_path_func(const char *file_name);
399
402
void Run () override ; \
400
403
const char *getName () const override { return #SuiteName " ." #TestName; } \
401
404
}; \
402
- DO_PRAGMA_BEGIN \
403
- DO_PRAGMA_BODY \
405
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_BEGIN \
406
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_BODY \
404
407
SuiteName##_##TestName SuiteName##_##TestName##_Instance; \
405
- DO_PRAGMA_END \
408
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_END \
406
409
void SuiteName##_##TestName::Run()
407
410
408
411
#define TEST_F (SuiteClass, TestName ) \
@@ -415,10 +418,10 @@ CString libc_make_test_file_path_func(const char *file_name);
415
418
void Run () override ; \
416
419
const char *getName () const override { return #SuiteClass " ." #TestName; } \
417
420
}; \
418
- DO_PRAGMA_BEGIN \
419
- DO_PRAGMA_BODY \
421
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_BEGIN \
422
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_BODY \
420
423
SuiteClass##_##TestName SuiteClass##_##TestName##_Instance; \
421
- DO_PRAGMA_END \
424
+ LIBC_TEST_GLOBAL_CTOR_DO_PRAGMA_END \
422
425
void SuiteClass##_##TestName::Run()
423
426
424
427
// Helper to trick the compiler into ignoring lack of braces on the else
0 commit comments