From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27814 invoked by alias); 30 Nov 2002 08:33:19 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 27799 invoked from network); 30 Nov 2002 08:33:17 -0000 Received: from unknown (HELO mta03ps.bigpond.com) (144.135.25.135) by sources.redhat.com with SMTP; 30 Nov 2002 08:33:17 -0000 Received: from bubble.local ([144.135.25.81]) by mta03ps.bigpond.com (Netscape Messaging Server 4.15 mta03ps Jul 16 2002 22:47:55) with SMTP id H6DRRE00.BHN for ; Sat, 30 Nov 2002 18:33:14 +1000 Received: from CPE-144-136-184-243.sa.bigpond.net.au ([144.136.184.243]) by psmam05.mailsvc.email.bigpond.com(MailRouter V3.0n 107/16093619); 30 Nov 2002 18:33:14 Received: (qmail 25803 invoked by uid 179); 30 Nov 2002 08:33:13 -0000 Date: Sat, 30 Nov 2002 00:33:00 -0000 From: Alan Modra To: binutils@sources.redhat.com, gdb@sources.redhat.com Subject: bye-bye boolean Message-ID: <20021130083313.GO949@bubble.sa.bigpond.net.au> Mail-Followup-To: binutils@sources.redhat.com, gdb@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2002-11/txt/msg00437.txt.bz2 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 -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 . */ -#define TRUE_FALSE_ALREADY_DEFINED -#endif -#endif -#ifdef MPW -/* Pre-emptive strike - get the file with the enum. */ -#include -#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