This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [patch] switch defs.h and readline/tilde.h includes
- From: Elena Zannoni <ezannoni at redhat dot com>
- To: David Carlton <carlton at math dot stanford dot edu>
- Cc: gdb-patches at sources dot redhat dot com, Elena Zannoni <ezannoni at redhat dot com>, Fernando Nasser <fnasser at redhat dot com>
- Date: Thu, 19 Dec 2002 11:58:30 -0500
- Subject: Re: [patch] switch defs.h and readline/tilde.h includes
- References: <ro1hednynei.fsf@jackfruit.Stanford.EDU>
David Carlton writes:
> When compiling GDB, I get the following error:
>
> gcc -c -g -O2 -I. -I. -I./config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../readline/.. -I../bfd -I./../bfd -I./../include -I../intl -I./../intl -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE -DMI_OUT=1 -DUI_OUT=1 -Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wuninitialized -Werror ./cli/cli-cmds.c
> In file included from defs.h:46,
> from cli/cli-cmds.c:23:
> ../include/ansidecl.h:152:1: "PARAMS" redefined
> In file included from cli/cli-cmds.c:22:
> ../readline/tilde.h:37:1: this is the location of the previous definition
> make: *** [cli-cmds.o] Error 1
>
> What's going on is that cli-cmds.c says
>
> #include <readline/tilde.h>
> #include "defs.h"
>
> and, while both of these files #define PARAMS essentially identically,
> the former definition is conditional on PARAMS not already being
> defined, while the latter isn't. So changing the order of includes to
> be
>
> #include "defs.h"
> #include <readline/tilde.h>
>
> fixes the problem.
>
> cli-setshow.c suffers from the same problem.
>
> This patch seems obvious; I'll commit it latter today unless somebody
> complains, since I'm probably not the only person who can't compile
> GDB because of it.
>
I didn't see this at all, but thanks for fixing it.
Elena
> David Carlton
> carlton@math.stanford.edu
>
> 2002-12-09 David Carlton <carlton@math.stanford.edu>
>
> * cli/cli-setshow.c: #include <readline/tilde.h> after defs.h.
> * cli/cli-cmds.c: Ditto.
>
> Index: cli-cmds.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
> retrieving revision 1.25
> diff -u -p -r1.25 cli-cmds.c
> --- cli-cmds.c 8 Dec 2002 22:31:36 -0000 1.25
> +++ cli-cmds.c 9 Dec 2002 19:51:41 -0000
> @@ -19,8 +19,8 @@
> Foundation, Inc., 59 Temple Place - Suite 330,
> Boston, MA 02111-1307, USA. */
>
> -#include <readline/tilde.h>
> #include "defs.h"
> +#include <readline/tilde.h>
> #include "completer.h"
> #include "target.h" /* For baud_rate, remote_debug and remote_timeout */
> #include "gdb_wait.h" /* For shell escape implementation */
> Index: cli-setshow.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 cli-setshow.c
> --- cli-setshow.c 8 Dec 2002 22:31:36 -0000 1.10
> +++ cli-setshow.c 9 Dec 2002 19:33:07 -0000
> @@ -17,8 +17,8 @@
> Foundation, Inc., 59 Temple Place - Suite 330,
> Boston, MA 02111-1307, USA. */
>
> -#include <readline/tilde.h>
> #include "defs.h"
> +#include <readline/tilde.h>
> #include "value.h"
> #include <ctype.h>
> #include "gdb_string.h"