Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Stan Shebs <stanshebs@earthlink.net>, gdb-patches@sourceware.org
Subject: Re: FYI: minsyms documentation
Date: Tue, 03 Jan 2012 02:53:00 -0000	[thread overview]
Message-ID: <20120103025256.GD2730@adacore.com> (raw)
In-Reply-To: <m3fwfxhhvp.fsf@fleche.redhat.com>

> Joel> So, perhaps the right approach lies in the middle. Only apply
> Joel> Tom's approach to parts where it should in fact be an API.
> 
> I think one question worth asking is -- what parts of GDB would *not* be
> an API?
> 
> I think the answer is, or should be, "none".

I would be OK with that. It has the nice property of being simple.
It's similar to me wanting every function to have a description
comment, no matter how useless the comment might appear. That way,
we don't have to try to guess whether documentation is needed or
not.

> I don't see much point in attempting anything like this if the general
> opinion of the other maintainers is against it.  I haven't seen enough
> replies to consider that there is a consensus, but I will hew to
> whatever it is.

I don't have a strong opinion. I think there are pluses and minuses
to both approaches, so it's not a clear decision. We just have to
make a decision. For myself, I have a slight preference for your
suggestion, so count me in.

It is worth mentioning the fact that, when I first started hacking
on GDB, I was appalled at the fact that you could not read a .h file
and get both the API and the associated documentation. To me, it was
incomprehensible that someone would chose to document, and bury,
an API in the .c file. But I also quickly found that this approach
allows you to quickly find the documentation, so I got used to it
and kinda grew to like it.

One of the issues this was supposed to solve, I was told, is that
you can have the same function declared in multiple .h files, which
is a big "ugh", but true I guess.  We could follow Ada's example,
where compilation units have specs and bodies.  The filename is
the same both , except that the .ads extension (spec, equivalent
of .h in C/C++) gets replaced by the .adb extension (body, .c/.cc
in C/C++).  No more ada-tasks.c functions documented in ada-lang.h.
One of my regular fustrations is trying to figure out where functions
declared in values.h or symtab.h are implemented...

GNAT's coding style goes a little further, and requires that all
functions have a declaration before a definition. This is another
debate that we had, with some people liking them, while others
found them to be a maintenance liability. The thing about this
style is that it allows us to have a declaration for every function,
and to document the functions there, presumably at the start of
the unit body. Despite the extra maintenance burden, this has some
advantages as well. But I think it only works well in practice
because there is a compiler switch to enforce that policy - no
function definition without a declaration first.

-- 
Joel


  reply	other threads:[~2012-01-03  2:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-22  4:44 Tom Tromey
2011-12-22  5:17 ` Joel Brobecker
2011-12-22 20:13 ` Stan Shebs
2011-12-22 20:21   ` Tom Tromey
2011-12-22 21:06     ` Eli Zaretskii
2011-12-23  4:21       ` Stan Shebs
2011-12-23 16:01         ` Eli Zaretskii
2012-01-02 22:08           ` Tom Tromey
2012-01-03  8:17             ` Eli Zaretskii
2011-12-24  7:45         ` Yao Qi
2011-12-24 13:21           ` Eli Zaretskii
2012-01-02 22:08           ` Tom Tromey
2012-01-03  8:18             ` Eli Zaretskii
2011-12-22 21:18     ` Stan Shebs
2011-12-23 10:38   ` Joel Brobecker
2012-01-02 22:14     ` Tom Tromey
2012-01-03  2:53       ` Joel Brobecker [this message]
2012-01-03 11:05         ` Pedro Alves
2012-01-03 13:21           ` commands.h and cli/cli-decode.h dups (was: Re: FYI: minsyms documentation) Pedro Alves
2012-01-03 14:57             ` commands.h and cli/cli-decode.h dups Tom Tromey
2012-01-03 17:11               ` Joel Brobecker
2012-01-05 11:40                 ` Pedro Alves
2012-01-03 11:18 ` FYI: minsyms documentation Pedro Alves
2012-01-15 18:49 ` Michael Eager

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=20120103025256.GD2730@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=stanshebs@earthlink.net \
    --cc=tromey@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