list/sort: workaround for GCC nonnull comparison bug

This commit is contained in:
Danny Robson 2021-04-28 14:25:07 +10:00
parent c61aac5f41
commit e38cf27d6d

View File

@ -109,6 +109,15 @@ namespace cruft::list {
#if defined(COMPILER_CLANG) #if defined(COMPILER_CLANG)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpointer-bool-conversion" #pragma GCC diagnostic ignored "-Wpointer-bool-conversion"
#elif defined(COMPILER_GCC)
// gcc#11 If we rely on the _Pragma embedded in `CHECK` then GCC 11
// will still issue a warning for the null assert we're about to do
// (but oddly only for some uses of this file...).
//
// Issuing the _Pragma locally is an effective workaround.
// It's unclear how we can produce a repro for this.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnonnull-compare"
#endif #endif
CHECK (first); CHECK (first);
@ -146,6 +155,8 @@ namespace cruft::list {
#if defined(COMPILER_CLANG) #if defined(COMPILER_CLANG)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#elif defined(COMPILER_GCC)
#pragma GCC diagnostic pop
#endif #endif
return head; return head;