On 2012/5/18 01:51 AM, Gabriel Dos Reis wrote: > On Thu, May 17, 2012 at 12:41 PM, Gabriel Dos Reis > <g...@integrable-solutions.net> wrote: >> On Thu, May 17, 2012 at 12:28 PM, Manuel López-Ibáñez >> <lopeziba...@gmail.com> wrote: >>> On 17 May 2012 19:25, Gabriel Dos Reis <g...@integrable-solutions.net> >>> wrote: >>>> On Thu, May 17, 2012 at 12:19 PM, Chung-Lin Tang >>>> <clt...@codesourcery.com> wrote: >>>>> On 2012/5/17 01:55 AM, Manuel López-Ibáñez wrote: >>>>>>> I'm guessing these changes are the cause of a full C bootstrap >>>>>>>> (--disable-build-poststage1-with-cxx) failure I'm seeing on trunk. The >>>>>>>> *_handle_option_auto function prototypes are not seen in options.c, and >>>>>>>> -Werror -Wmissing-prototypes are in effect (oddly, such strict checking >>>>>>>> is not enforced in the default post-stage1 C++ bootstrap) >>>>>> Yep, We should add -Wmissing-declarations to the post-stage1 flags, >>>>>> which also exists in C. Could you also add that to your patch? >>>>>> >>>>> >>>>> I'm a little unsure of how -Wmissing-declarations vs >>>>> -Wmissing-prototypes behave for C? Anyways here's a patch to add >>>>> -Wmissing-declarations for C++, keeping C as is. >>>> >>>> What is the purpose of -Wmissing-declarations for C++? >>> >>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50134 >> >> The point is: it is mostly useless for C++. The rationale for its >> existence in C are largely irrelevant in the context of C++. > > Let me add that the notion of "global function defined in header" is > largely meaningless in C++. I fear this is one of those cases where > we are trying too hard to push a C style to C++. We should not. > > The notion of "global function in C++" can only be interpreted as > meaning a function with external linkage -- because C++ has namespace > and C does not, and a there is no reason to treat the global scope > differently. > Furthermore, C++98 and C++03 requires that functions > used in certain contexts have external linkage. For GCC's own source code, > we would refrain from anonymous namespaces because they might interfer with > bootstrap compare and reproducibility. That means we are left with > having to declare > those functions right before their definitions, not but in headers; > that is just plain silly.
The point here is that, a group of changes that broke C bootstrap went in undetected for several days, because of the partially C++ default. To prevent that in the future, we should enforce similar checking in both C and C++. Chung-Lin