c6d234
commit 9536661c6e8045f810cd227a7d676eaff19bf1b8
c6d234
Author: Joseph Myers <joseph@codesourcery.com>
c6d234
Date:   Wed Aug 19 00:51:07 2015 +0000
c6d234
c6d234
    Fix -Wundef warnings in elf/tst-execstack.c.
c6d234
    
c6d234
    To remove -Wno-error=undef, we need to fix the remaining cases where
c6d234
    there are -Wundef warnings in the testsuite.  One of those places is
c6d234
    in elf/tst-execstack.c.
c6d234
    
c6d234
    tst-execstack.c tests USE_PTHREADS with #if.  nptl/tst-execstack.c
c6d234
    defines USE_PTHREADS to 1 before including ../elf/tst-execstack.c,
c6d234
    while elf/tst-execstack.c, when compiled directly, leaves it
c6d234
    undefined.
c6d234
    
c6d234
    This patch adds a setting of CPPFLAGS-tst-execstack.c to
c6d234
    elf/Makefile.  An alternative approach would be to rename
c6d234
    tst-execstack.c to tst-execstack-main.c and have two different
c6d234
    tst-execstack.c files include it, each with an appropriate
c6d234
    USE_PTHREADS #define.
c6d234
    
c6d234
    Tested for x86_64.
c6d234
    
c6d234
            * elf/Makefile [$(have-z-execstack) = yes]
c6d234
            (CPPFLAGS-tst-execstack.c): New variable.
c6d234
c6d234
diff --git a/elf/Makefile b/elf/Makefile
c6d234
index 862e04eb484fa3f5..dea66ca1c12e5c29 100644
c6d234
--- a/elf/Makefile
c6d234
+++ b/elf/Makefile
c6d234
@@ -866,6 +866,7 @@ endif
c6d234
 ifeq ($(have-z-execstack),yes)
c6d234
 $(objpfx)tst-execstack: $(libdl)
c6d234
 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
c6d234
+CPPFLAGS-tst-execstack.c = -DUSE_PTHREADS=0
c6d234
 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
c6d234
 LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
c6d234