From mboxrd@z Thu Jan 1 00:00:00 1970 From: jtc@redback.com (J.T. Conklin) To: Andrew Cagney Cc: gdb-patches@sourceware.cygnus.com Subject: Re: [RFA]: Remove unused header files. Date: Tue, 06 Mar 2001 13:27:00 -0000 Message-id: <5mvgpm4mgx.fsf@jtc.redback.com> References: <5mitltndwn.fsf@jtc.redback.com> <3AA2C971.D2432CEA@cygnus.com> X-SW-Source: 2001-03/msg00123.html >>>>> "Andrew" == Andrew Cagney 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