Message ID | 1ca1a503-d571-2162-bf31-8059aae2564c@redhat.com |
---|---|
State | New |
Headers | show |
Whoops, I didn't think of that. Thanks for the patch! (Btw: in the future please forward e-mails to martingalvan@sourceware.org, as I no longer work at Taller Technologies).
On Saturday 24 December 2016 12:19 AM, Carlos O'Donell wrote: > In my build scripts I use: > > export CFLAGS="-g -O2 -Wl,--build-id=none" > ... > export CPPFLAGS="-g -O2 -Wl,--build-id=none" > > The CPPFLAGS end up _after_ the per-test CFLAGS. > > This means that the pretty printer tests compile at -O2 and fail. -O2 is a C flag, not a cpp flag, so maybe the script is wrong? Likewise, -Wl... flags ought to be in LDFLAGS. Siddhesh
On Dez 23 2016, Carlos O'Donell <carlos@redhat.com> wrote: > In my build scripts I use: > > export CFLAGS="-g -O2 -Wl,--build-id=none" > ... > export CPPFLAGS="-g -O2 -Wl,--build-id=none" > > The CPPFLAGS end up _after_ the per-test CFLAGS. Don't do that then. > diff --git a/README.pretty-printers b/README.pretty-printers > index 8662900..a2536ca 100644 > --- a/README.pretty-printers > +++ b/README.pretty-printers > @@ -126,11 +126,12 @@ You can use the existing unit tests as examples. > > 4. Add the names of the pretty printer tests to the 'tests-printers' variable > in your submodule's Makefile (without extensions). In addition, for each test > -program you must define a corresponding CFLAGS-* variable and set it to > -$(CFLAGS-printers-tests) to ensure they're compiled correctly. For example, > -test-foo-printer.c requires the following: > +program you must define a corresponding CFLAGS-* and CPPFLAGS-* variable and > +set it to $(CFLAGS-printers-tests) to ensure they're compiled correctly. For > +example, test-foo-printer.c requires the following: > > CFLAGS-test-foo-printer.c := $(CFLAGS-printers-tests) > +CPPFLAGS-test-foo-printer.c := $(CFLAGS-printers-tests) CPPFLAGS should only use CPPFLAGS. Andreas.
diff --git a/README.pretty-printers b/README.pretty-printers index 8662900..a2536ca 100644 --- a/README.pretty-printers +++ b/README.pretty-printers @@ -126,11 +126,12 @@ You can use the existing unit tests as examples. 4. Add the names of the pretty printer tests to the 'tests-printers' variable in your submodule's Makefile (without extensions). In addition, for each test -program you must define a corresponding CFLAGS-* variable and set it to -$(CFLAGS-printers-tests) to ensure they're compiled correctly. For example, -test-foo-printer.c requires the following: +program you must define a corresponding CFLAGS-* and CPPFLAGS-* variable and +set it to $(CFLAGS-printers-tests) to ensure they're compiled correctly. For +example, test-foo-printer.c requires the following: CFLAGS-test-foo-printer.c := $(CFLAGS-printers-tests) +CPPFLAGS-test-foo-printer.c := $(CFLAGS-printers-tests) Finally, if your programs need to be linked with a specific library, you can add its name to the 'tests-printers-libs' variable in your submodule's Makefile. diff --git a/nptl/Makefile b/nptl/Makefile index 7ac9196..bed5bab 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -318,12 +318,22 @@ tests-printers := test-mutexattr-printers test-mutex-printers \ test-condattr-printers test-cond-printers \ test-rwlockattr-printers test-rwlock-printers +# We must specify both CFLAGS and CPPFLAGS to override any +# compiler options the user might have provided that conflict +# with what we need e.g. user specifies CPPFLAGS with -O2 and +# we need -O0. CFLAGS-test-mutexattr-printers.c := $(CFLAGS-printers-tests) CFLAGS-test-mutex-printers.c := $(CFLAGS-printers-tests) CFLAGS-test-condattr-printers.c := $(CFLAGS-printers-tests) CFLAGS-test-cond-printers.c := $(CFLAGS-printers-tests) CFLAGS-test-rwlockattr-printers.c := $(CFLAGS-printers-tests) CFLAGS-test-rwlock-printers.c := $(CFLAGS-printers-tests) +CPPFLAGS-test-mutexattr-printers.c := $(CFLAGS-printers-tests) +CPPFLAGS-test-mutex-printers.c := $(CFLAGS-printers-tests) +CPPFLAGS-test-condattr-printers.c := $(CFLAGS-printers-tests) +CPPFLAGS-test-cond-printers.c := $(CFLAGS-printers-tests) +CPPFLAGS-test-rwlockattr-printers.c := $(CFLAGS-printers-tests) +CPPFLAGS-test-rwlock-printers.c := $(CFLAGS-printers-tests) ifeq ($(build-shared),yes) tests-printers-libs := $(shared-thread-library)