This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

Re: RFC: Named warnings


Hi Stan,

> That's certainly my #1 implementation consideration - how to get there
> incrementally.  One of the things I'd want to set up would be some
> kind of auditing script that anybody could run to see how far along
> things are.  New warning controls should be made so they're an easy
> bit for newbies to add too.

I would like you to consider my toy for implementation.
Bundled with autogen is a comment extractor much akin to Java Doc
that should facilitate newbie use.  It could work something like this,
in the GCC source code:

  /*=warn mumble
   * fmt: "some sort of format string:  %d"
   * group: pedantic all
   * disabled:
   * doc:  why you got this warning
   *       and what you might do about it.
  =*/
  WARN_MUMBLE( arg );

>From that, the following things could be made to happen:

1.  The "mumble" warning is normally disabled.  This would be accomplished
    inside the #define-d code for the WARN_MUMBLE macro.  Note that the
    WARN_MUMBLE takes one argument and that information can be derived by
    scanning the "fmt" string for formatting commands ("%d").

2.  It would be enabled if any of -Wmumble -Wall -Wpedantic were set
    on the command line

3.  An enumeration of all warnings would be emitted
    An array of warning states can be maintained via this enumeration,
    including push/pop/initial state/current state/whatever.

4.  A table to map warning names to the enumeration value would be emitted.

5.  If the "mumble" warning were needed elsewhere, it can be used there,
    just omit the special comment.

6.  For debugging purposes, the emitted WARN_MUMBLE macro could include
    the file and line number where it occurrs, and not for released code. :-)

7.  A "how-to-deal-with-this-warning" document.

8.  Additional attributes can be added, as the need arises.

Basically, you can take those several strings and arrange them into anything
you like.  Very conveniently.  I'll help, if you're interested.  I can't drive
it 'cuz I have a day job....


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