This is the mail archive of the gdb-prs@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]

gdb/354: Remove true/false from GDB ....



>Number:         354
>Category:       gdb
>Synopsis:       Remove true/false from GDB ....
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 12 22:28:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     ac131313@redhat.com
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
Hello,

This is fallout from the recent <stdbool.h> problem.

"bfd.h" was providing ``true'' and ``false'' as convenience enums/macros/...  They unfortunatly clash with systems that provide <stdbool.h> (a header in c99?) and even some systems that don't.  The relevant code block is:

/* 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 ...
  ... many valiant attemts to define true and false ...
#else
/* Use enum names that will appear nowhere else.  */
typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
#endif

In short, bfd.h should never have been polluting the name space with ``true'' and ``false''.

So the proposal is for "bfd.h" to remove all the above code and instead just define:

  typedef int bfd_boolean;

i.e. 0 is false, non-zero is true, just like C intended :-)

Problem is, some blocks of GDB make use of ``true'' and ``false'' and they will need to be changed.  Two possabilities come to mind:

    #include "gdb_stdbool.h"
        which would wrap <stdbool.h>

    zap ``true'' and ``false''

I've strong preferences for the latter.  I think BFD serves as a very compelling example of what not to do :-)

thoughts?

I should also note that there is some urgency to this - BFD needs to be fixed quickly - preferably before 5.2 of GDB branches.

enjoy,
Andrew

--

Also remove TRUE/FALSE?
Update ARI?
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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