Patrick Palka <patr...@parcs.ath.cx> writes:
>> Maybe others will disagree and will think enabling
>> -Wmissing-declarations would be a useful change, but I don't see the
>> point.
>
> In my novice opinion, I think the flag helps keep source files tidy
> and modular, and their interfaces well-defined.  Its biggest benefit
> is having the compiler inform you when a function should have been
> marked static: marking a function static facilitates better
> optimization and static analysis, and it helps convey the intent of
> the function to the reader.

+1 FWIW, though only for the compiler proper, since I wouldn't know
either way about libstdc++.  If GCC does become used as JIT in future
then we might need to start worrying about ABI stability and so check
the public symbols against a whitelist, like libstdc++ does.
That's a stronger test, but probably too strong for GCC ATM.

I think the other case you mentioned -- .c(c)s not including their own
.hs -- is important too, especially since there's ongoing work to refactor
the header files.

In both cases, the option forces you to think about whether
the routine really is public and so should be declared in a .h,
or whether it's internal to the TU.

Thanks,
Richard

Reply via email to