From: Andrew Cagney <ac131313@redhat.com>
To: binutils@sources.redhat.com
Subject: `true' and `false'; Was: K&R patch for binutils bfd directory
Date: Fri, 25 Oct 2002 07:32:00 -0000 [thread overview]
Message-ID: <3DB955FA.2010401@redhat.com> (raw)
In-Reply-To: <3DB88055.2030807@redhat.com>
> Wasn't a BFD things-to-do-today thwack ``true'' and ``false''? Someone is definitly ment to be removing them from bfd.h.
Just in case anyone needs a reminder as to why:
From bfd/bfd-in2.h:
/* 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
gdb/utils.h:
/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
"defs.h" should be included first. Unfortunatly some systems
(currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
and they clash with "bfd.h"'s definiton of true/false. The correct
fix is to remove true/false from "bfd.h", however, until that
happens, hack around it by including "config.h" and <curses.h>
first. */
If you look through the archives you'll see the consensus was to pull
this bogosity. Just waiting for someone with the cycles ....
Andrew
next prev parent reply other threads:[~2002-10-25 14:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-24 16:00 John David Anglin
2002-10-24 16:20 ` Andrew Cagney
2002-10-25 7:32 ` Andrew Cagney [this message]
2002-10-24 19:12 ` Alan Modra
2002-10-24 19:35 ` John David Anglin
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=3DB955FA.2010401@redhat.com \
--to=ac131313@redhat.com \
--cc=binutils@sources.redhat.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).