@@ -352,26 +352,28 @@ void __sanitizer::BufferedStackTrace::UnwindImpl(
352
352
353
353
using namespace __msan ;
354
354
355
- # define PRINT_FAULTING_INSTRUCTION ( instname ) \
356
- if (__msan::flags()->print_faulting_instruction) { \
357
- Printf (" Instruction that failed the shadow check: %s\n " , instname); \
358
- Printf (" \n " ); \
355
+ static inline void PrintFaultingInstruction ( char * instname) {
356
+ if (__msan::flags ()->print_faulting_instruction ) {
357
+ Printf (" Instruction that failed the shadow check: %s\n " , instname);
358
+ Printf (" \n " );
359
359
}
360
+ }
360
361
361
- # define WARN_IF_PRINT_FAULTING_INSTRUCTION_REQUESTED \
362
- if (__msan::flags()->print_faulting_instruction) { \
363
- Printf ( \
364
- " Error: print_faulting_instruction requested but code was not " \
365
- " instrumented with -mllvm -embed-faulting-instruction.\n " ); \
366
- Printf (" \n " ); \
362
+ static inline void WarnIfPrintFaultingInstructionRequested () {
363
+ if (__msan::flags ()->print_faulting_instruction ) {
364
+ Printf (
365
+ " Error: print_faulting_instruction requested but code was not "
366
+ " instrumented with -mllvm -embed-faulting-instruction.\n " );
367
+ Printf (" \n " );
367
368
}
369
+ }
368
370
369
371
#define MSAN_MAYBE_WARNING_INSTNAME (type, size, instname ) \
370
372
void __msan_maybe_warning_instname_##size(type s, u32 o, char *instname) { \
371
373
GET_CALLER_PC_BP; \
372
374
if (UNLIKELY (s)) { \
373
375
if (instname) \
374
- PRINT_FAULTING_INSTRUCTION (instname); \
376
+ PrintFaultingInstruction (instname); \
375
377
PrintWarningWithOrigin (pc, bp, o); \
376
378
if (__msan::flags ()->halt_on_error ) { \
377
379
Printf (" Exiting\n " ); \
@@ -389,7 +391,7 @@ MSAN_MAYBE_WARNING_INSTNAME(u64, 8, instname)
389
391
void __msan_maybe_warning_##size(type s, u32 o) { \
390
392
GET_CALLER_PC_BP; \
391
393
if (UNLIKELY (s)) { \
392
- WARN_IF_PRINT_FAULTING_INSTRUCTION_REQUESTED; \
394
+ WarnIfPrintFaultingInstructionRequested (); \
393
395
PrintWarningWithOrigin (pc, bp, o); \
394
396
if (__msan::flags ()->halt_on_error ) { \
395
397
Printf (" Exiting\n " ); \
@@ -439,12 +441,12 @@ MSAN_MAYBE_STORE_ORIGIN(u64, 8)
439
441
}
440
442
441
443
void __msan_warning () {
442
- WARN_IF_PRINT_FAULTING_INSTRUCTION_REQUESTED ;
444
+ WarnIfPrintFaultingInstructionRequested () ;
443
445
__MSAN_WARNING_BODY
444
446
}
445
447
446
448
void __msan_warning_instname (char *instname) {
447
- PRINT_FAULTING_INSTRUCTION (instname);
449
+ PrintFaultingInstruction (instname);
448
450
__MSAN_WARNING_BODY
449
451
}
450
452
@@ -457,12 +459,12 @@ void __msan_warning_instname(char *instname) {
457
459
Die ();
458
460
459
461
void __msan_warning_noreturn () {
460
- WARN_IF_PRINT_FAULTING_INSTRUCTION_REQUESTED ;
462
+ WarnIfPrintFaultingInstructionRequested () ;
461
463
__MSAN_WARNING_NORETURN_BODY
462
464
}
463
465
464
466
void __msan_warning_noreturn_instname (char *instname) {
465
- PRINT_FAULTING_INSTRUCTION (instname);
467
+ PrintFaultingInstruction (instname);
466
468
__MSAN_WARNING_NORETURN_BODY
467
469
}
468
470
@@ -477,12 +479,12 @@ void __msan_warning_noreturn_instname(char *instname) {
477
479
}
478
480
479
481
void __msan_warning_with_origin (u32 origin) {
480
- WARN_IF_PRINT_FAULTING_INSTRUCTION_REQUESTED ;
482
+ WarnIfPrintFaultingInstructionRequested () ;
481
483
__MSAN_WARNING_WITH_ORIGIN_BODY (origin)
482
484
}
483
485
484
486
void __msan_warning_with_origin_instname (u32 origin, char *instname) {
485
- PRINT_FAULTING_INSTRUCTION (instname);
487
+ PrintFaultingInstruction (instname);
486
488
__MSAN_WARNING_WITH_ORIGIN_BODY (origin)
487
489
}
488
490
@@ -495,12 +497,12 @@ void __msan_warning_with_origin_instname(u32 origin, char *instname) {
495
497
Die ();
496
498
497
499
void __msan_warning_with_origin_noreturn (u32 origin) {
498
- WARN_IF_PRINT_FAULTING_INSTRUCTION_REQUESTED ;
500
+ WarnIfPrintFaultingInstructionRequested () ;
499
501
__MSAN_WARNING_WITH_ORIGIN_NORETURN_BODY (origin)
500
502
}
501
503
502
504
void __msan_warning_with_origin_noreturn_instname (u32 origin, char *instname) {
503
- PRINT_FAULTING_INSTRUCTION (instname);
505
+ PrintFaultingInstruction (instname);
504
506
__MSAN_WARNING_WITH_ORIGIN_NORETURN_BODY (origin)
505
507
}
506
508
0 commit comments