public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [commit] Build memmem with -Wno-error.
Date: Tue, 31 Aug 2010 22:04:00 -0000	[thread overview]
Message-ID: <20100831220358.GP2986@adacore.com> (raw)
In-Reply-To: <201008312048.35034.pedro@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 601 bytes --]

> 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

[-- Attachment #2: gdbserver-memmem.diff --]
[-- Type: text/x-diff, Size: 1923 bytes --]

commit c16350d2bf3a0fcd4fc6f746837d381c3268eaeb
Author: Joel Brobecker <brobecker@adacore.com>
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
 

  parent reply	other threads:[~2010-08-31 22:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31 19:08 Joel Brobecker
2010-08-31 19:48 ` Pedro Alves
2010-08-31 20:15   ` Jan Kratochvil
2010-08-31 20:34     ` Pedro Alves
2010-08-31 21:22       ` Joel Brobecker
2010-08-31 21:59         ` Pedro Alves
2010-08-31 22:07           ` Joel Brobecker
2010-08-31 22:13             ` Jan Kratochvil
2010-08-31 22:21               ` Pedro Alves
2010-09-02 14:54       ` Jan Kratochvil
2010-08-31 22:04   ` Joel Brobecker [this message]
2010-08-31 22:23     ` Pedro Alves
2010-09-01  1:56       ` Joel Brobecker

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=20100831220358.GP2986@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    /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).