From c774790975f136bcff70dd4e9fa444f100f34003 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Mon, 4 Jul 2022 15:33:37 -0600 Subject: [PATCH] LibArchive: Guard against major() and minor() macros from old glibc glibc before 2.28 defines major() and minor() macros from sys/types.h. This triggers a Lagom warning for old distros that use versions older than that, such as Ubuntu 18.04. This fixes a break in the compiler-explorer Lagom build, which is based off 18.04 docker containers. --- Userland/Libraries/LibArchive/Tar.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Userland/Libraries/LibArchive/Tar.h b/Userland/Libraries/LibArchive/Tar.h index 7474c9cb2a..af2bd9f171 100644 --- a/Userland/Libraries/LibArchive/Tar.h +++ b/Userland/Libraries/LibArchive/Tar.h @@ -13,6 +13,16 @@ #include #include +// glibc before 2.28 defines these from sys/types.h, but we don't want +// TarFileHeader::major() and TarFileHeader::minor() to use those macros +#ifdef minor +# undef minor +#endif + +#ifdef major +# undef major +#endif + namespace Archive { enum class TarFileType : char {