]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: tools: properly guard __GLIBC__ with defined()
authorWilly Tarreau <w@1wt.eu>
Mon, 30 Aug 2021 08:15:35 +0000 (10:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 30 Aug 2021 08:16:30 +0000 (10:16 +0200)
The test on the glibc versions based on #if (__GLIBC > 2 ...) fails to
build under -Wundef, let's prepend defined(__GLIBC__) first.

src/tools.c

index cc71d45358af0f4cb94c7c2a23a26ad0d94b848a..76a0cd7f132d805081f9e0ad05a7a75883c4c725 100644 (file)
@@ -43,7 +43,7 @@ extern void *__elf_aux_vector;
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
+#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
 #include <sys/auxv.h>
 #endif
 
@@ -4768,7 +4768,7 @@ const char *get_exec_path()
 {
        const char *ret = NULL;
 
-#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
+#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
        long execfn = getauxval(AT_EXECFN);
 
        if (execfn && execfn != ENOENT)
@@ -4800,7 +4800,7 @@ const char *get_exec_path()
 static int dladdr_and_size(const void *addr, Dl_info *dli, size_t *size)
 {
        int ret;
-#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) // most detailed one
+#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) // most detailed one
        const ElfW(Sym) *sym;
 
        ret = dladdr1(addr, dli, (void **)&sym, RTLD_DL_SYMENT);