From: Sam James Date: Wed, 1 Jan 2025 18:56:51 +0000 (+0000) Subject: Fix GCC version detection for __attribute__((deprecated)) (#2472) X-Git-Tag: v3.7.8~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=83721b498dafc6ab8e34c753e13f3294e1cad7cc;p=thirdparty%2Flibarchive.git Fix GCC version detection for __attribute__((deprecated)) (#2472) The #if condition as-written fails for any major >= 3 if minor < 1, e.g. GCC 15.0 (while in development). Use the idiom described in the GCC docs [0] to avoid this. [0] https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html Fixes: ab94a813b0f64cbc1bcb952bf55424a2d9c7f1d9 (cherry picked from commit a186d9662b4e3bc2e0f39d3248f9c1244c4346cb) --- diff --git a/libarchive/archive_entry.h b/libarchive/archive_entry.h index 97f5cdafb..22c4be24a 100644 --- a/libarchive/archive_entry.h +++ b/libarchive/archive_entry.h @@ -127,7 +127,8 @@ typedef ssize_t la_ssize_t; # define __LA_DECL #endif -#if defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >= 1 +#if defined(__GNUC__) && (__GNUC__ > 3 || \ + (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) # define __LA_DEPRECATED __attribute__((deprecated)) #else # define __LA_DEPRECATED