This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch/rfc] The zap true/false patch
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 24 Feb 2002 16:20:03 -0500
- Subject: [patch/rfc] The zap true/false patch
Hello,
The attatched cuts the more obvious true/false uses. See earlier
discussion (actually on the binutils list but also here as to why this
is necessary).
I intend committing this in a few days once my target builds have all
finished.
Andrew
2002-02-24 Andrew Cagney <ac131313@redhat.com>
* rdi-share/host.h: Comment out true/false mess. Just define
TRUE/FALSE and YES/NO blindly.
* rdi-share/angel.h: Ditto.
* memattr.c (mem_command): Eliminate ``true'' and ``false''.
* osfsolib.c (solib_map_sections): Ditto.
* irix5-nat.c (solib_map_sections): Ditto.
* corelow.c (gdb_check_format): Ditto.
* symfile.c (symfile_bfd_open): Ditto.
* solib.c (solib_map_sections): Ditto.
Fix PR gdb/354.
Index: corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.18
diff -u -r1.18 corelow.c
--- corelow.c 2001/11/01 16:17:08 1.18
+++ corelow.c 2002/02/24 21:12:35
@@ -169,10 +169,10 @@
{
if (cf->check_format (abfd))
{
- return (true);
+ return (1);
}
}
- return (false);
+ return (0);
}
/* Discard all vestiges of any previous core file and mark data and stack
Index: irix5-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/irix5-nat.c,v
retrieving revision 1.16
diff -u -r1.16 irix5-nat.c
--- irix5-nat.c 2001/11/01 16:17:08 1.16
+++ irix5-nat.c 2002/02/24 21:12:59
@@ -434,7 +434,7 @@
}
/* Leave bfd open, core_xfer_memory and "info files" need it. */
so->abfd = abfd;
- abfd->cacheable = true;
+ abfd->cacheable = 1;
if (!bfd_check_format (abfd, bfd_object))
{
Index: memattr.c
===================================================================
RCS file: /cvs/src/src/gdb/memattr.c,v
retrieving revision 1.9
diff -u -r1.9 memattr.c
--- memattr.c 2002/02/13 19:00:47 1.9
+++ memattr.c 2002/02/24 21:13:00
@@ -31,9 +31,9 @@
{
MEM_RW, /* mode */
MEM_WIDTH_UNSPECIFIED,
- false, /* hwbreak */
- false, /* cache */
- false /* verify */
+ 0, /* hwbreak */
+ 0, /* cache */
+ 0 /* verify */
};
static struct mem_region *mem_region_chain = NULL;
@@ -183,21 +183,21 @@
#if 0
else if (strcmp (tok, "hwbreak") == 0)
- attrib.hwbreak = true;
+ attrib.hwbreak = 1;
else if (strcmp (tok, "swbreak") == 0)
- attrib.hwbreak = false;
+ attrib.hwbreak = 0;
#endif
else if (strcmp (tok, "cache") == 0)
- attrib.cache = true;
+ attrib.cache = 1;
else if (strcmp (tok, "nocache") == 0)
- attrib.cache = false;
+ attrib.cache = 0;
#if 0
else if (strcmp (tok, "verify") == 0)
- attrib.verify = true;
+ attrib.verify = 1;
else if (strcmp (tok, "noverify") == 0)
- attrib.verify = false;
+ attrib.verify = 0;
#endif
else
Index: osfsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/osfsolib.c,v
retrieving revision 1.12
diff -u -r1.12 osfsolib.c
--- osfsolib.c 2001/11/01 16:17:08 1.12
+++ osfsolib.c 2002/02/24 21:13:12
@@ -253,7 +253,7 @@
}
/* Leave bfd open, core_xfer_memory and "info files" need it. */
so->abfd = abfd;
- abfd->cacheable = true;
+ abfd->cacheable = 1;
if (!bfd_check_format (abfd, bfd_object))
{
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.47
diff -u -r1.47 solib.c
--- solib.c 2002/01/08 18:55:26 1.47
+++ solib.c 2002/02/24 21:13:12
@@ -237,7 +237,7 @@
/* Leave bfd open, core_xfer_memory and "info files" need it. */
so->abfd = abfd;
- abfd->cacheable = true;
+ abfd->cacheable = 1;
/* copy full path name into so_name, so that later symbol_file_add
can find it */
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.53
diff -u -r1.53 symfile.c
--- symfile.c 2002/02/06 18:31:07 1.53
+++ symfile.c 2002/02/24 21:13:25
@@ -1094,7 +1094,7 @@
error ("\"%s\": can't open to read symbols: %s.", name,
bfd_errmsg (bfd_get_error ()));
}
- sym_bfd->cacheable = true;
+ sym_bfd->cacheable = 1;
if (!bfd_check_format (sym_bfd, bfd_object))
{
Index: rdi-share/angel.h
===================================================================
RCS file: /cvs/src/src/gdb/rdi-share/angel.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 angel.h
--- angel.h 1999/04/16 01:34:27 1.1.1.1
+++ angel.h 2002/02/24 21:13:26
@@ -101,34 +101,53 @@
* yet another solution for the bool/boolean problem, this one is
* copied from Scott's modifications to clx/host.h
*/
-# ifdef IMPLEMENT_BOOL_AS_ENUM
- enum _bool { _false, _true };
-# define _bool enum _bool
-# elif defined(IMPLEMENT_BOOL_AS_INT) || !defined(__cplusplus)
-# define _bool int
-# define _false 0
-# define _true 1
-# endif
-
-# ifdef _bool
-# define bool _bool
-# endif
-
-# ifndef true
-# define true _true
-# define false _false
-# endif
-
-# ifndef YES
-# define YES true
-# define NO false
-# endif
-# undef TRUE /* some OSF headers define as 1 */
-# define TRUE true
+/* NOTE: cagney/2002-02-24: This true/false mess has been commented
+ out as it is effectively impossible to get it portably right.
+ Instead GDB has banned ``true'' and ``false''. Code using ``TRUE''
+ or ``FALSE'' is only just tolerated for similar reasons. Sigh! */
-# undef FALSE /* some OSF headers define as 1 */
-# define FALSE false
+/* # ifdef IMPLEMENT_BOOL_AS_ENUM */
+/* enum _bool { _false, _true }; */
+/* # define _bool enum _bool */
+/* # elif defined(IMPLEMENT_BOOL_AS_INT) || !defined(__cplusplus) */
+/* # define _bool int */
+/* # define _false 0 */
+/* # define _true 1 */
+/* # endif */
+
+/* # ifdef _bool */
+/* # define bool _bool */
+/* # endif */
+
+/* # ifndef true */
+/* # define true _true */
+/* # define false _false */
+/* # endif */
+
+/* # ifndef YES */
+/* # define YES true */
+/* # define NO false */
+/* # endif */
+
+/* # undef TRUE *//* some OSF headers define as 1 */
+/* # define TRUE true */
+
+/* # undef FALSE *//* some OSF headers define as 1 */
+/* # define FALSE false */
+
+#ifndef YES
+#define YES 1
+#endif
+#ifndef NO
+#define NO 0
+#endif
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 1
+#endif
# ifndef NULL
# define NULL 0
Index: rdi-share/host.h
===================================================================
RCS file: /cvs/src/src/gdb/rdi-share/host.h,v
retrieving revision 1.5
diff -u -r1.5 host.h
--- host.h 2002/02/06 20:09:18 1.5
+++ host.h 2002/02/24 21:13:27
@@ -105,35 +105,54 @@
/* and real 'bool' under C++. It also avoids warnings such as */
/* C++ keyword 'bool' used as identifier. It can be overridden by */
/* defining IMPLEMENT_BOOL_AS_ENUM or IMPLEMENT_BOOL_AS_INT. */
-#undef _bool
-#ifdef IMPLEMENT_BOOL_AS_ENUM
- enum _bool { _false, _true };
-# define _bool enum _bool
-#elif defined(IMPLEMENT_BOOL_AS_INT) || !defined(__cplusplus)
-# define _bool int
-# define _false 0
-# define _true 1
-#endif
+/* NOTE: cagney/2002-02-24: This true/false mess has been commented
+ out as it is effectively impossible to get it portably right.
+ Instead GDB has banned ``true'' and ``false''. Code using ``TRUE''
+ or ``FALSE'' is only just tolerated for similar reasons. Sigh! */
-#ifdef _bool
-# if defined(_MFC_VER) || defined(__CC_NORCROFT) /* When using MS Visual C/C++ v4.2 */
-# define bool _bool /* avoids "'bool' is reserved word" warning */
-# else
-# ifndef bool
- typedef _bool bool;
-# endif
-# endif
-# define true _true
-# define false _false
-#endif
+/* #undef _bool */
+
+/* #ifdef IMPLEMENT_BOOL_AS_ENUM */
+/* enum _bool { _false, _true }; */
+/* # define _bool enum _bool */
+/* #elif defined(IMPLEMENT_BOOL_AS_INT) || !defined(__cplusplus) */
+/* # define _bool int */
+/* # define _false 0 */
+/* # define _true 1 */
+/* #endif */
+
+/* #ifdef _bool */
+/* # if defined(_MFC_VER) || defined(__CC_NORCROFT) *//* When using MS Visual C/C++ v4.2 */
+/* # define bool _bool *//* avoids "'bool' is reserved word" warning */
+/* # else */
+/* # ifndef bool */
+/* typedef _bool bool; */
+/* # endif */
+/* # endif */
+/* # define true _true */
+/* # define false _false */
+/* #endif */
+
+/* #define YES true */
+/* #define NO false */
+/* #undef TRUE *//* some OSF headers define as 1 */
+/* #define TRUE true */
+/* #undef FALSE *//* some OSF headers define as 1 */
+/* #define FALSE false */
-#define YES true
-#define NO false
-#undef TRUE /* some OSF headers define as 1 */
-#define TRUE true
-#undef FALSE /* some OSF headers define as 1 */
-#define FALSE false
+#ifndef YES
+#define YES 1
+#endif
+#ifndef NO
+#define NO 0
+#endif
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 1
+#endif
/* 'uint' conflicts with some Unixen sys/types.h, so we now don't define it */
typedef unsigned8 uint8;