This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bye-bye boolean


Here goes my biggest commit.  s/boolean/bfd_boolean/ s/true/TRUE/
s/false/FALSE/ practically everywhere in binutils, excepts for all
those awkward places that make this sort of change unsafe to automate,
like "/* Is this still true?  */", or "DW_ATE_boolean = 0x2,"..

bfd/ChangeLog
	* bfd-in.h (TRUE_FALSE_ALREADY_DEFINED, BFD_TRUE_FALSE): Delete.
	(enum bfd_boolean, boolean): Delete.
	(bfd_boolean): Typedef to an int.
	(FALSE, TRUE): Define.
	* aix386-core.c, aix5ppc-core.c, aout-adobe.c, aout-arm.c, aout-cris.c,
	aout-encap.c, aout-ns32k.c, aout-target.h, aout-tic30.c, aoutf1.h,
	aoutx.h, archive.c, archive64.c, archures.c, bfd-in.h, bfd.c, bfdwin.c,
	binary.c, bout.c, cache.c, cisco-core.c, coff-a29k.c, coff-alpha.c,
	coff-apollo.c, coff-arm.c, coff-aux.c, coff-h8300.c, coff-h8500.c,
	coff-i386.c, coff-i860.c, coff-i960.c, coff-ia64.c, coff-m68k.c,
	coff-m88k.c, coff-mcore.c, coff-mips.c, coff-or32.c, coff-ppc.c,
	coff-rs6000.c, coff-sh.c, coff-sparc.c, coff-stgo32.c, coff-tic30.c,
	coff-tic4x.c, coff-tic54x.c, coff-tic80.c, coff-w65.c, coff-we32k.c,
	coff-z8k.c, coff64-rs6000.c, coffcode.h, coffgen.c, cofflink.c,
	corefile.c, cpu-a29k.c, cpu-alpha.c, cpu-arc.c, cpu-arm.c, cpu-avr.c,
	cpu-cris.c, cpu-d10v.c, cpu-d30v.c, cpu-dlx.c, cpu-fr30.c, cpu-frv.c,
	cpu-h8300.c, cpu-h8500.c, cpu-hppa.c, cpu-i370.c, cpu-i386.c,
	cpu-i860.c, cpu-i960.c, cpu-ia64.c, cpu-ip2k.c, cpu-m10200.c,
	cpu-m10300.c, cpu-m32r.c, cpu-m68hc11.c, cpu-m68hc12.c, cpu-m68k.c,
	cpu-m88k.c, cpu-mcore.c, cpu-mips.c, cpu-mmix.c, cpu-ns32k.c,
	cpu-openrisc.c, cpu-or32.c, cpu-pdp11.c, cpu-pj.c, cpu-powerpc.c,
	cpu-rs6000.c, cpu-s390.c, cpu-sh.c, cpu-sparc.c, cpu-tic30.c,
	cpu-tic4x.c, cpu-tic54x.c, cpu-tic80.c, cpu-v850.c, cpu-vax.c,
	cpu-w65.c, cpu-we32k.c, cpu-xstormy16.c, cpu-z8k.c, dwarf1.c,
	dwarf2.c, ecoff.c, ecofflink.c, efi-app-ia32.c, efi-app-ia64.c,
	elf-bfd.h, elf-eh-frame.c, elf-hppa.h, elf-m10200.c, elf-m10300.c,
	elf-strtab.c, elf.c, elf32-arc.c, elf32-arm.h, elf32-avr.c,
	elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c,
	elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-hppa.h,
	elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c,
	elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c,
	elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c,
	elf32-pj.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-sh64-com.c,
	elf32-sh64.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c,
	elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c,
	elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-ppc.h, elf64-s390.c,
	elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c,
	elfarm-oabi.c, elfcode.h, elfcore.h, elflink.c, elflink.h,
	elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c, elfxx-mips.h,
	elfxx-target.h, format.c, freebsd.h, genlink.h, hash.c, hp300hpux.c,
	hppabsd-core.c, hpux-core.c, i386aout.c, i386linux.c, i386lynx.c,
	i386mach3.c, i386msdos.c, i386os9k.c, ieee.c, ihex.c, irix-core.c,
	libaout.h, libbfd-in.h, libbfd.c, libcoff-in.h, libecoff.h, libieee.h,
	libnlm.h, liboasys.h, libpei.h, libxcoff.h, linker.c, lynx-core.c,
	m68klinux.c, m68klynx.c, mach-o.c, mach-o.h, merge.c, mipsbsd.c,
	mmo.c, netbsd-core.c, netbsd.h, nlm.c, nlm32-alpha.c, nlm32-i386.c,
	nlm32-ppc.c, nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
	pc532-mach.c, pdp11.c, pe-arm.c, pe-i386.c, pe-mcore.c, pe-mips.c,
	pe-sh.c, peXXigen.c, pef.c, pei-arm.c, pei-i386.c, pei-mcore.c,
	pei-mips.c, pei-sh.c, peicode.h, ppcboot.c, ptrace-core.c, reloc.c,
	reloc16.c, riscix.c, rs6000-core.c, sco5-core.c, section.c, simple.c,
	som.c, som.h, sparclinux.c, sparclynx.c, srec.c, stabs.c, sunos.c,
	syms.c, targets.c, tekhex.c, ticoff.h, trad-core.c, versados.c,	
	vms-gsd.c, vms-hdr.c, vms-misc.c, vms-tir.c, vms.c, vms.h,
	xcoff-target.h, xcofflink.c, xsym.c, xsym.h: Replace boolean with
	bfd_boolean, true with TRUE, false with FALSE.  Simplify comparisons
	of bfd_boolean vars with TRUE/FALSE.  Formatting.
	* bfd-in2.h, libbfd.h, libcoff.h: Regenerate

include/ChangeLog
	* bfdlink.h: Replace boolean with bfd_boolean.  Formatting.

include/coff/ChangeLog
	* ecoff.h: Replace boolean with bfd_boolean.
	* xcoff.h: Likewise.

include/elf/ChangeLog
	* mmix.h: Replace boolean with bfd_boolean.
	* sh.h: Likewise.

opcodes/ChangeLog
	*arm-dis.c, cris-dis.c, h8300-dis.c, mips-dis.c, mmix-dis.c, sh-dis.c,
	sh64-dis.c, v850-dis.c: Replace boolean with bfd_boolean, true with
	TRUE, false with FALSE.  Simplify comparisons of bfd_boolean vars
	with TRUE/FALSE.  Formatting.

binutils/ChangeLog
	* addr2line.c, ar.c, arsup.c, binemul.c, binemul.h, bucomm.c, bucomm.h,
	budbg.h, debug.c, debug.h, dlltool.c, emul_aix.c, ieee.c, nlmconv.c,
	nlmconv.h, nlmheader.y, nm.c, objcopy.c, objdump.c, prdbg.c, rdcoff.c,
	rddbg.c, readelf.c, rename.c, size.c, stabs.c, strings.c,
	unwind-ia64.h, wrstabs.c: Replace boolean with bfd_boolean, true with
	TRUE, false with FALSE.  Simplify comparisons of bfd_boolean vars
	with TRUE/FALSE.  Formatting.

gas/ChangeLog
	* dwarf2dbg.c, write.c, config/obj-aout.c, config/obj-coff.c,
	config/obj-ecoff.c, config/obj-elf.c, config/obj-som.c,
	config/tc-arm.c, config/tc-arm.h, config/tc-avr.c, config/tc-cris.c,
	config/tc-d10v.c, config/tc-d10v.h, config/tc-d30v.c, config/tc-d30v.h,
	config/tc-dlx.c, config/tc-dlx.h, config/tc-fr30.c, config/tc-fr30.h,
	config/tc-frv.c, config/tc-frv.h, config/tc-hppa.c, config/tc-i370.c,
	config/tc-i386.c, config/tc-i386.h, config/tc-m32r.c,
	config/tc-m68hc11.c, config/tc-mcore.c, config/tc-mcore.h,
	config/tc-mips.c, config/tc-mips.h, config/tc-mn10200.c,
	config/tc-mn10300.c, config/tc-mn10300.h, config/tc-openrisc.c,
	config/tc-openrisc.h, config/tc-ppc.c, config/tc-s390.c,
	config/tc-sh.c, config/tc-sh.h, config/tc-sh64.c, config/tc-tic54x.c,
	config/tc-v850.c, config/tc-v850.h, config/tc-xstormy16.c,
	config/tc-xstormy16.h: Replace boolean with bfd_boolean, true with
	TRUE, false with FALSE.  Simplify comparisons of bfd_boolean vars with
	TRUE/FALSE.  Formatting.

gprof/ChangeLog
	* basic_blocks.c, basic_blocks.h, cg_arcs.c, cg_dfn.c, cg_print.c,
	corefile.c, gmon_io.c, gprof.c, gprof.h, hist.c, mips.c, source.c,
	source.h, sym_ids.c, sym_ids.h, symtab.h, tahoe.c, vax.c: Replace
	boolean with bfd_boolean, true with TRUE, false with FALSE.
	Formatting.

ld/ChangeLog
	* ld.h, ldcref.c, ldctor.c, ldctor.h, ldemul.c, ldemul.h, ldexp.c,
	ldexp.h, ldfile.c, ldfile.h, ldgram.y, ldlang.c, ldlang.h, ldmain.c,
	ldmain.h, ldmisc.c, ldwrite.c, lexsup.c, mri.c, pe-dll.c, pe-dll.h,
	emulparams/elf32b4300.sh, emultempl/aix.em, emultempl/armcoff.em,
	emultempl/armelf.em, emultempl/armelf_oabi.em, emultempl/beos.em,
	emultempl/elf32.em, emultempl/generic.em, emultempl/gld960.em,
	emultempl/gld960c.em, emultempl/hppaelf.em, emultempl/linux.em,
	emultempl/lnk960.em, emultempl/m68kcoff.em, emultempl/mipsecoff.em,
	emultempl/mmix-elfnmmo.em, emultempl/mmixelf.em, emultempl/mmo.em,
	emultempl/needrelax.em, emultempl/pe.em, emultempl/ppc64elf.em,
	emultempl/sh64elf.em, emultempl/sunos.em, emultempl/ticoff.em: Replace
	boolean with bfd_boolean, true with TRUE, false with FALSE.  Simplify
	comparisons of bfd_boolean vars with TRUE/FALSE.  Formatting.

Index: bfd/bfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in.h,v
retrieving revision 1.53
diff -u -p -r1.53 bfd-in.h
--- bfd/bfd-in.h	25 Oct 2002 02:45:53 -0000	1.53
+++ bfd/bfd-in.h	30 Nov 2002 05:56:46 -0000
@@ -70,43 +70,28 @@ extern "C" {
 /* Forward declaration.  */
 typedef struct _bfd bfd;
 
-/* To squelch erroneous compiler warnings ("illegal pointer
-   combination") from the SVR3 compiler, we would like to typedef
-   boolean to int (it doesn't like functions which return boolean.
-   Making sure they are never implicitly declared to return int
-   doesn't seem to help).  But this file is not configured based on
-   the host.  */
-/* General rules: functions which are boolean return true on success
-   and false on failure (unless they're a predicate).   -- bfd.doc */
-/* I'm sure this is going to break something and someone is going to
-   force me to change it.  */
-/* typedef enum boolean {false, true} boolean; */
-/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h>  -fnf */
-/* It gets worse if the host also defines a true/false enum... -sts */
-/* And even worse if your compiler has built-in boolean types... -law */
-/* And even worse if your compiler provides a stdbool.h that conflicts
-   with these definitions... gcc 2.95 and later do.  If so, it must
-   be included first.  -drow */
-#if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
-#define TRUE_FALSE_ALREADY_DEFINED
-#else
-#if defined (__bool_true_false_are_defined)
-/* We have <stdbool.h>.  */
-#define TRUE_FALSE_ALREADY_DEFINED
-#endif
-#endif
-#ifdef MPW
-/* Pre-emptive strike - get the file with the enum.  */
-#include <Types.h>
-#define TRUE_FALSE_ALREADY_DEFINED
-#endif /* MPW */
-#ifndef TRUE_FALSE_ALREADY_DEFINED
-typedef enum bfd_boolean {false, true} boolean;
-#define BFD_TRUE_FALSE
-#else
-/* Use enum names that will appear nowhere else.  */
-typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
-#endif
+/* Boolean type used in bfd.  Too many systems define their own
+   versions of "boolean" for us to safely typedef a "boolean" of
+   our own.  Using an enum for "bfd_boolean" has it's own set of
+   problems, with strange looking casts required to avoid warnings
+   on some older compilers.  Thus we just use an int.
+
+   General rule: functions which are bfd_boolean return TRUE on
+   success and FALSE on failure (unless they're a predicate).  */
+
+typedef int bfd_boolean;
+#undef FALSE
+#undef TRUE
+#define FALSE 0
+#define TRUE 1
+
+#if 0
+/* Poison.  */
+#undef false
+#undef true
+#define false dont_use_false_in_bfd
+#define true dont_use_true_in_bfd
+#endif
 
 /* Support for different sizes of target format ints and addresses.
    If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be

[snip rest of patch.  It's over 5M!]

And if lack of "boolean" breaks anything, please complain to ac131313
at redhat dot com.  :)

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]