From patchwork Fri Dec 23 18:49:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos O'Donell X-Patchwork-Id: 18669 Received: (qmail 67939 invoked by alias); 23 Dec 2016 18:49:13 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 67929 invoked by uid 89); 23 Dec 2016 18:49:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy=submodules, CPPFLAGS, wl, --build-id, Wl, --build-id X-HELO: mail-qk0-f181.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:organization:message-id:date :user-agent:mime-version:content-transfer-encoding; bh=K8y/732yZ5I2Os+vDeLxEz7sDy/euPArQ4ln2H4v/Nk=; b=PHqgsOcZZXKTqEdFfIAxrrfqu1mEqi0bfXE5YUVuYDBSptd3nR5RtKEbbrI/q2VAwd BaU1bz9pqa88I7moaeRqkvQb9ascYaTFrG9wyWIt2eVQSRBwV1sXNTRVygbFy7NrTtaD gkB7NzyicQ+DMecJATuy664R6inCye7cIubHaBgD/PIRM/4MWX0O/yUDsGfYVRAFplgE PdWuPlCfxZxJaSVtutx45VQB/u1iMr5QMo/dXPMoQXzamCloKu5314Mw8dnF8Ge/pzha 3rM/SRgGpbTn4YUyhwNiW7iJPDOfNbGIBtXXIRR50/DsaYjr4vzp6/NoEcqt+xVRVEMb 3bLQ== X-Gm-Message-State: AIkVDXIKyR4zMtvM148sthWeOpvmHD1CfVtBc6ezlPdNmaYKhrDpTwUFU1lDvkAaDWGP6zsG X-Received: by 10.55.5.145 with SMTP id 139mr16596730qkf.77.1482518950325; Fri, 23 Dec 2016 10:49:10 -0800 (PST) To: GNU C Library , Siddhesh Poyarekar , Martin Galvan From: Carlos O'Donell Subject: [PATCH COMMITTED] Fix pretty printer failures when CPPFLAGS is defined with optimizations. Message-ID: <1ca1a503-d571-2162-bf31-8059aae2564c@redhat.com> Date: Fri, 23 Dec 2016 13:49:08 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 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. The solution is that the pretty-printer tests must specify both CFLAGS and CPPFLAGS. I've committed this as obvious until someone comes up with a better fix. In the meantime it fixes anyone whose build specifies CPPFLAGS that conflict with the pretty-printer requirements. Committed. 2016-12-23 Carlos O'Donell * README.pretty-printers: Must specify CPPFLAGS-* also. * nptl/Makefile (CPPFLAGS-test-mutexattr-printers.c): Define. (CPPFLAGS-test-mutex-printers.c): Define. (CPPFLAGS-test-condattr-printers.c): Define. (CPPFLAGS-test-cond-printers.c): Define. (CPPFLAGS-test-rwlockattr-printers.c): Define. (CPPFLAGS-test-rwlock-printers.c): Define. 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)