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

Re: [RFA]: Remove unused header files.


>>>>> "Andrew" == Andrew Cagney <ac131313@cygnus.com> writes:
>> The decode_line_1() declaration (IMO) indicates a unclear separation
>> of interface and implementation.  (Again, IMO) a function declaration
>> should only be in one header.  Please share your thoughts, on this
>> specific case, and in general.  decode_line_1() is the first of many
>> functions that have multiple declarations.

Andrew> Only one? Just don't get me started on the number of extern
Andrew> declarations that appear in .c files! :-) Yes, I agree that
Andrew> function declarations should only appear once.

Is this one of the things your static analysis database is checks for
(And can you send me a pointer to it again)?  

When I was going through the code, I saw one comment describing how a
few functions were being declared locally so the header containing the
declarations would not have to be included.  This seems like a recipe
for disaster.  If the interface is ever changed, the programmer might
miss the local declaration when fixing up the callers.  And the compiler
won't complain because the usage within that function will match the
(local) declarations.  Bleh.

If it was my rule, function declarations should only appear once and 
should *never* occur in *.c files.

Andrew> As for the more general question of confused interfaces.  I
Andrew> think GDB's internal structure is facing major change
Andrew> (multi-arch).  Consequently I'm hopeing that that that that
Andrew> work will address many of those problems.  I suspect that, at
Andrew> this stage, you might want to put blinkers and just
Andrew> concentrate on the basic #include mess.  That, by its self, is
Andrew> pretty daunting.

Note I'm not trying to fix everything I come across, at least not in
the first pass.  For the most part, I am trying to categorize things 
so I know what's the most benefit for the least effort.

The side-effect of this is that I'll likely be raising a lot of issues
wrt inconsistancies.  I won't be offended if you tell me to punt on
any of them.

        --jtc

-- 
J.T. Conklin
RedBack Networks


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