[Bug c++/43272] -Wmissing-prototypes doesn't work in C++ mode

erh+gcc at nimenees dot com gcc-bugzilla@gcc.gnu.org
Mon Mar 8 04:02:00 GMT 2010



------- Comment #4 from erh+gcc at nimenees dot com  2010-03-08 04:02 -------
(In reply to comment #3)
> (In reply to comment #2)
> > So does this mean bug #13687 is going to be reopened?  Or is there some
> > workaround that hasn't been mentioned?
> 
> No. I think the issue has been discussed at length there.
> W.
> 

I see a few comments that don't at all explain why you would not want to have
this warning available in c++.  The argument there seems to be that is is
unnecesary b/c you can't "call a function without a prior prototype", but to my
mind that fact is an argument FOR having the warning.

You need a prototype when use call a function and, more importantly, due to the
fact that c++ mangles function names based on the exact types of the parameters
that prototype NEEDS to be completely in sync with the function definition,
otherwise it's effectively prototyping a non-existent function.

Yes, you'll get an error at link time if the function actually gets called 
somewhere, but I don't understand why you *wouldn't* want to point out the
discrepancy between the header file and the cpp file early.  i.e. at a point
during a build where a developer will be able to fix it more easily because the
warning is telling him at least one of the files that he has to look at.

Are you really saying that this isn't a useful piece of information to provide
to the developer?
Is there some problem that I'm not seeing that turning on this warning will
cause?
Is enabling it for c++ code difficult due to how gcc is implemented?
I'm confused as to why there is such opposition to this and I feel like there's
some key point here that I'm missing.

(btw, I tried the trivial change in c.opt (gcc 4.1.3) of just allowing the
command line option, but no warning appeared when I compiled with
-Wmissing-prototypes.  I guess there's something else that needs to be done,
but I have no idea what)


-- 

erh+gcc at nimenees dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|DUPLICATE                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43272



More information about the Gcc-bugs mailing list