From e9744ba05801d4cd66bed532a1f0e74675573747 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 16 May 2024 21:09:28 -0700 Subject: [PATCH] sort: better -Wmissing-variable-declarations MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * src/sort.c: Ignore -Wmissing-variable-declarations only with GCC 14 and newer, since it didn’t exist earlier. Ignore the warning only when including md5.h, where it needs to be ignored, as the warning might be useful elsewhere. --- src/sort.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/sort.c b/src/sort.c index 32e4c73a2f..6c273fab99 100644 --- a/src/sort.c +++ b/src/sort.c @@ -2093,8 +2093,7 @@ getmonth (char const *month, char **ea) This causes the compiler's -lcrypto option to have no effect, as sort.o no longer uses any crypto symbols statically. */ -# if 4 < __GNUC__ + (8 <= __GNUC_MINOR__) - /* Pacify gcc -Wmissing-variable-declarations through at least GCC 14. */ +# if 14 <= __GNUC__ # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wmissing-variable-declarations" # endif @@ -2106,6 +2105,9 @@ getmonth (char const *month, char **ea) #include "md5.h" #if DLOPEN_LIBCRYPTO && HAVE_OPENSSL_MD5 +# if 14 <= __GNUC__ +# pragma GCC diagnostic pop +# endif # include /* Diagnose a dynamic linking failure. */ @@ -2137,9 +2139,6 @@ link_libcrypto (void) ptr_MD5_Init = symbol_address (handle, "MD5_Init"); ptr_MD5_Update = symbol_address (handle, "MD5_Update"); ptr_MD5_Final = symbol_address (handle, "MD5_Final"); -# if 4 < __GNUC__ + (8 <= __GNUC_MINOR__) -# pragma GCC diagnostic pop -# endif #endif } -- 2.47.2