This is the mail archive of the gdb@sourceware.cygnus.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: Proposal: convert function definitions to prototyped form


Kevin Buettner wrote:
> 
> As many of you know, I'm in the midst of purging the use of ``PARAMS''
> in prototyped function declarations from the gdb sources.  After this
> activity is concluded, I'd like to begin converting function
> definitions whose parameters are declared using the traditional C
> style to the ISO C prototyped form.  I.e, I'd like to convert
> functions of the form
> 
>     int
>     foo (a, b, c)
>          int a;
>          char *b;
>          int *c;
>     {
>       ...
>     }
> 
> to
> 
>     int foo (int a, char *b, int *c)
>     {
>       ...
>     }

(you mean
	int
	foo (int a, char *b, int *c)
:-)

The obvious thing to note is that by moving to pure ISO-C we eliminate
the type promotion problems.  For instance:

	void foo (enum e e);
	void
	foo (e)
		enum e e;
	{
	}

is not well defined and many compilers reject it.  Plenty of similar
examples (involving char, short, and the like exist).

It is one less issue that people need to worry about.

The only concern I have is, given the slightly more complex nature of
the script (compared to PARAMS) there is a possibility that the
conversion re-orders or re-types the argument list.  With that in mind,
should a pre-cursor to this be to least have prototypes for all
(global?) functions (-Wmissing-prototypes?) or only do the conversion
when there is a prototype visible?

	Andrew

PS: You may want to add gdb/*-share to the list of directories to avoid.

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