diff options
author | Jim Meyering <meyering@fb.com> | 2017-05-21 09:23:18 -0700 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2017-05-21 12:07:57 -0700 |
commit | 1e1e23358050f201f5630a16609c441b9e7955a0 (patch) | |
tree | 647047b09474367701bfc1a8b45c4907145aceee /src/system.h | |
parent | 9e2c89397916d9587f1945528eb5d5651c0b4edb (diff) | |
download | grep-1e1e23358050f201f5630a16609c441b9e7955a0.tar.gz |
maint: accommodate GCC7's -Werror=duplicated-branches
* src/system.h (IGNORE_DUPLICATE_BRANCH_WARNING): Define.
* src/grep.c (grepfile): Use it.
* src/kwset.c (bmexec, acexec): Use it.
Diffstat (limited to 'src/system.h')
-rw-r--r-- | src/system.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/system.h b/src/system.h index f9747935..bac78235 100644 --- a/src/system.h +++ b/src/system.h @@ -115,4 +115,18 @@ __asan_unpoison_memory_region (void const volatile *addr, size_t size) { } # endif #endif +/* When we deliberately use duplicate branches, use this macro to + disable gcc's -Wduplicated-branches in the containing expression. */ +#if 7 <= __GNUC__ +# define IGNORE_DUPLICATE_BRANCH_WARNING(exp) \ + ({ \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wduplicated-branches\"") \ + exp; \ + _Pragma ("GCC diagnostic pop") \ + }) +#else +# define IGNORE_DUPLICATE_BRANCH_WARNING(exp) exp +#endif + #endif |