[patch] support for -fdump-ada-spec

Mark Mitchell mark@codesourcery.com
Mon Apr 26 15:42:00 GMT 2010


Manuel López-Ibáñez wrote:

>> FWIW, I agree that without the existing "wrong" usage, it would be far cleaner
>> to have each .c file has it's own corresponding .h file (that's mandatory
>> in Ada actually :-).

Without taking any position on general practices for C or C++, and with
apologies for any previous language-specific bits in diagnostic.h, I
think that in this case it would certainly be better to move the
Ada-specific bits out of diagnostic.h.

I think this patch is generally useful.  The C++ bits are mostly OK, but
I find cpp_check very unappealing due to the way in which it uses
predefined constants.  Please (a) make an enum (rather than macros) for
the various things for which you need to check, (b) define that type in
a header, and (c) have the case statement in cpp_check switch on that:

  switch (op)
    {
      case IS_ABSTRACT:
        return DECL_PURE_VIRTUAL (t);
      ...
    }

Also, please make sure that *all* functions have a comment which
documents *all* parameters, using the ALL_CAPS format, e.g.,:

  /* Collect source file references recursively, starting
     from NAMESPC (a NAMESPACE_DECL).  */

With those changes, the C++ front-end changes are OK.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list