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.
This commit is contained in:
Andrew Kaster 2022-07-04 15:33:37 -06:00 committed by Andreas Kling
parent d40167f7bb
commit c774790975
Notes: sideshowbarker 2024-07-17 09:47:09 +09:00

View file

@ -13,6 +13,16 @@
#include <string.h>
#include <sys/types.h>
// 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 {