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: Warning for C Parameter Name Mismatch


On Sat, Mar 9, 2019, 11:27 AM Segher Boessenkool <segher@kernel.crashing.org>
wrote:

> On Sat, Mar 09, 2019 at 08:30:19AM +0000, Jonathan Wakely wrote:
> > On Sat, 9 Mar 2019, 02:23 Eric Gallager, <egall@gwmail.gwu.edu> wrote:
> > > How would it handle the case where the parameter name is missing
> > > entirely from the prototype? I see a lot of header files with their
> > > prototypes written like that.
> > >
> > > e.g.
> > >
> > > int f(int);
> > >
> > > int f(int y) {...}
> >
> > I don't think that's valid in C, only C++, and I would expect no warning
> > for such cases. But I don't see much value in the suggested warning at
> all.
>
> This is perfectly fine C.  Parameter names are optional in prototypes.
> It's different if it is the function definition, I think that is what
> you mean?
>

That's how I read it and that would not be a warning IMO.

Back to a point in my original email that seems to have been missed.
Doxygen reports this as a warning. I would just like the option to find it
with gcc as well.

And not checking system headers is reasonable in general. For RTEMS though,
we are implementing those system headers and do follow the names in the
standards for parameter names in the implementation.

--joel

>
>
> Segher
>


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