public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Preprocessor symbol style
@ 2004-08-13 22:02 Mark Kettenis
  2004-08-13 22:13 ` Daniel Jacobowitz
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Mark Kettenis @ 2004-08-13 22:02 UTC (permalink / raw)
  To: gdb

IIRC this has been discussed before, hopefully people forgive me
raising the issue again.

Currently in GDB we use the following style for preprocessor stuff:

#ifdef HAVE_FOO_H
#include <foo.h>
#else
#ifdef HAVE_BAR_H
#include <bar.h>
#ifndef HAVE_FOOBAR
#define FOOBAR FOO(BAR)
#endif
#endif
#endif

I think this style has a serious problem; it's rather difficult to see
how the #if's and #endif's balance.  Personally I've been bitten by
this more than once.

Many GNU projects (GCC, glibc, autoconf, coreutils) use a somewhat
different style:

#ifdef HAVE_FOO_H
# include <foo.h>
#else
# ifdef HAVE_BAR_H
#  include <bar.h>
#  ifndef HAVE_FOOBAR
#   define FOOBAR FOO(BAR)
#  endif
# endif
#endif

This makes it much easier to see how the #if's and #endif's balance.

Can we please adopt the second style for GDB?  We can convert things
incrementally, or if we want to do it all at once, I'll volunteer to
provide the mamoth patch.

Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-08-24 20:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-13 22:02 Preprocessor symbol style Mark Kettenis
2004-08-13 22:13 ` Daniel Jacobowitz
2004-08-14 10:40 ` Eli Zaretskii
2004-08-16 18:58 ` Kevin Buettner
2004-08-16 19:33   ` Michael Chastain
2004-08-24 20:25 ` Andrew Cagney

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).