public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: elfutils-devel@sourceware.org
Subject: [PATCH 1/2] configure: Fix -D_FORTIFY_SOURCE=2 check when CFLAGS contains -Wno-error
Date: Thu, 12 Dec 2019 00:23:00 -0000	[thread overview]
Message-ID: <de31b08b8187cd3eede5b2cd9b8acb92b64a7216.1576110086.git.osandov@fb.com> (raw)
In-Reply-To: <cover.1576110086.git.osandov@fb.com>

From: Omar Sandoval <osandov@fb.com>

If CFLAGS contains -Wno-error, then the check for -D_FORTIFY_SOURCE=2
won't fail when appropriate. E.g., compiling with:

  ./configure CFLAGS='-Wno-error -O0' &&

Results in a flood of "_FORTIFY_SOURCE requires compiling with
optimization (-O)" warnings.

Make sure we add -Werror after the user-defined CFLAGS.

Signed-off-by: Omar Sandoval <osandov@fb.com>
---
 ChangeLog    | 5 +++++
 configure.ac | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index ed5f5866..ff012e3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-11  Omar Sandoval  <osandov@fb.com>
+
+	* configure.ac: Apply -Werror after user-defined CFLAGS in
+	-D_FORTIFY_SOURCE=2 check.
+
 2019-12-06  Mark Wielaard  <mark@klomp.org>
 
 	* configure.ac: Add ac_cv_buildid check.
diff --git a/configure.ac b/configure.ac
index 36a6b6c2..25555d0b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -273,7 +273,7 @@ case "$CFLAGS" in
     ;;
   *)
     save_CFLAGS="$CFLAGS"
-    CFLAGS="-D_FORTIFY_SOURCE=2 -Werror $CFLAGS"
+    CFLAGS="-D_FORTIFY_SOURCE=2 $CFLAGS -Werror"
     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
       #include <string.h>
       int main() { return 0; }
-- 
2.24.0

  reply	other threads:[~2019-12-12  0:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12  0:23 [PATCH 0/2] elfutils: minor build system fixes Omar Sandoval
2019-12-12  0:23 ` Omar Sandoval [this message]
2019-12-12  0:23 ` [PATCH 2/2] libcpu: Compile i386_lex.c with -Wno-implicit-fallthrough Omar Sandoval
2019-12-12 11:17 ` [PATCH 0/2] elfutils: minor build system fixes Mark Wielaard
2019-12-12 15:25   ` Omar Sandoval

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=de31b08b8187cd3eede5b2cd9b8acb92b64a7216.1576110086.git.osandov@fb.com \
    --to=osandov@osandov.com \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).