From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29650 invoked by alias); 31 Aug 2010 22:04:13 -0000 Received: (qmail 29438 invoked by uid 22791); 31 Aug 2010 22:04:12 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 31 Aug 2010 22:04:07 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id EA9102BAB43; Tue, 31 Aug 2010 18:04:05 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Tt5G5rUsmpbH; Tue, 31 Aug 2010 18:04:05 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 9ACC82BAB18; Tue, 31 Aug 2010 18:04:05 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 29153F599F; Wed, 1 Sep 2010 00:03:58 +0200 (CEST) Date: Tue, 31 Aug 2010 22:04:00 -0000 From: Joel Brobecker To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [commit] Build memmem with -Wno-error. Message-ID: <20100831220358.GP2986@adacore.com> References: <1283281706-30409-1-git-send-email-brobecker@adacore.com> <201008312048.35034.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="uQr8t48UFsdbeI+V" Content-Disposition: inline In-Reply-To: <201008312048.35034.pedro@codesourcery.com> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-08/txt/msg00580.txt.bz2 --uQr8t48UFsdbeI+V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 601 > Sorry, I didn't realize you were talking about "-Wno-error" literally. > This may break non-gcc compilers. It would be better to come up with > an $(INTERNAL_CFLAGS) variant that does not include -Werror in the first > place, and use that instead in the memmem.o rule. gdb/Makefile.in uses > INTERNAL_WARN_CFLAGS for exactly that. I suggest to do the same here. Take > a look at the monitor.o rule in gdb/Makefile.in. Duh - rookie mistake :-(. Here is a new version that separates the warning flags, -Werror flags and the rest into 3 separate variables... Retested on x86_64-linux. -- Joel --uQr8t48UFsdbeI+V Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="gdbserver-memmem.diff" Content-length: 1923 commit c16350d2bf3a0fcd4fc6f746837d381c3268eaeb Author: Joel Brobecker Date: Tue Aug 31 11:17:39 2010 -0400 Compile memmem.o without -Werror. This reproduces the same approach as in GDB to allow us to build specific files without -Werror. gdb/gdbserver/ChangeLog: * Makefile.in (INTERNAL_CFLAGS_BASE): New variable. Extracted from INTERNAL_CFLAGS. (INTERNAL_WARN_CFLAGS): New variable. (INTERNAL_CFLAGS): Adjust, using INTERNAL_WARN_CFLAGS. diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index e397bd7..ffbb14a 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -94,8 +94,10 @@ WERROR_CFLAGS = @WERROR_CFLAGS@ CFLAGS = @CFLAGS@ # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros. -INTERNAL_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) ${CFLAGS} ${GLOBAL_CFLAGS} \ +INTERNAL_CFLAGS_BASE = ${CFLAGS} ${GLOBAL_CFLAGS} \ ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} +INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS) +INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) # LDFLAGS is specifically reserved for setting from the command line # when running make. @@ -347,8 +349,13 @@ gdbreplay.o: gdbreplay.c config.h signals.o: ../common/signals.c $(server_h) $(signals_def) $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER +# We build memmem.c without -Werror because this file is not under +# our control. On LynxOS, the compiler generates some warnings +# because str-two-way.h uses a constant (MAX_SIZE) whose definition +# makes it ambiguous whether it is signed or unsigned ("warning: this +# decimal constant is unsigned only in ISO C90"). memmem.o: ../gnulib/memmem.c - $(CC) -o memmem.o -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< + $(CC) -o memmem.o -c $(CPPFLAGS) $(INTERNAL_WARN_CFLAGS) $< i386_low_h = $(srcdir)/i386-low.h --uQr8t48UFsdbeI+V--