From: Marco Bettini Date: Mon, 2 May 2022 13:12:26 +0000 (+0000) Subject: lib: Fix for clang Wstrict-bool pragma failing on unpatched clang X-Git-Tag: 2.3.20~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e56bb5e361d13d8819c6facfc5c645650e971bcd;p=thirdparty%2Fdovecot%2Fcore.git lib: Fix for clang Wstrict-bool pragma failing on unpatched clang Note that clang recognises GCC diagnostic pragmas too, so there is no need for distinct pragmas in this case --- diff --git a/src/lib/event-filter-lexer.l b/src/lib/event-filter-lexer.l index 08af117789..8df4ddc510 100644 --- a/src/lib/event-filter-lexer.l +++ b/src/lib/event-filter-lexer.l @@ -24,25 +24,18 @@ result = event_filter_parser_input_proc(buf, max_size, yyscanner) static size_t event_filter_parser_input_proc(char *buf, size_t size, yyscan_t scanner); -#ifdef __clang__ -#pragma clang diagnostic push -/* ignore "unknown warning" warning if we're using unpatched clang */ -#pragma clang diagnostic ignored "-Wunknown-warning-option" +#pragma GCC diagnostic push + /* ignore strict bool warnings in generated code */ -#pragma clang diagnostic ignored "-Wstrict-bool" +#ifdef HAVE_STRICT_BOOL +# pragma GCC diagnostic ignored "-Wstrict-bool" +#endif /* ignore sign comparison errors (buggy flex) */ -#pragma clang diagnostic ignored "-Wsign-compare" -/* ignore unused functions */ -#pragma clang diagnostic ignored "-Wunused-function" -/* ignore unused parameters */ -#pragma clang diagnostic ignored "-Wunused-parameter" -#else -/* and same for gcc */ -#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wsign-compare" +/* ignore unused functions */ #pragma GCC diagnostic ignored "-Wunused-function" +/* ignore unused parameters */ #pragma GCC diagnostic ignored "-Wunused-parameter" -#endif %} @@ -100,9 +93,8 @@ static size_t event_filter_parser_input_proc(char *buf, size_t size, yyscan_t sc return (unsigned char) *yytext; } %% -#ifdef __clang__ -#pragma clang diagnostic pop -#endif + +#pragma GCC diagnostic pop void *yyalloc(size_t bytes, void* yyscanner ATTR_UNUSED) { diff --git a/src/lib/event-filter-parser.y b/src/lib/event-filter-parser.y index 652b896ba6..61aae10477 100644 --- a/src/lib/event-filter-parser.y +++ b/src/lib/event-filter-parser.y @@ -129,12 +129,11 @@ static struct event_filter_node *logic(struct event_filter_parser_state *state, return node; } -#ifdef __clang__ -/* ignore "unknown warning" warning if we're using unpatched clang */ -#pragma clang diagnostic ignored "-Wunknown-warning-option" /* ignore strict bool warnings in generated code */ -#pragma clang diagnostic ignored "-Wstrict-bool" +#ifdef HAVE_STRICT_BOOL +# pragma GCC diagnostic ignored "-Wstrict-bool" #endif + %} %union {