[C++] Coding rule enforcement
Mon Sep 21 13:52:00 GMT 2015
On Tue, Sep 15, 2015 at 3:31 PM, Jason Merrill <firstname.lastname@example.org> wrote:
> On 09/15/2015 01:20 PM, Manuel López-Ibáñez wrote:
>> On 15/09/15 15:26, Richard Biener wrote:
>>> On Tue, Sep 15, 2015 at 3:02 PM, Nathan Sidwell <email@example.com> wrote:
>>>> somme of our customers have 'interesting' C++ coding rules, they'd
>>>> like to
>>>> have the compiler enforced. They want to disable:
>>>> 1) namespace definitions
>>>> 2) template declarations
>>>> 3) multiple inheritance
>>>> 4) virtual inheritance
>>>> But they want to use the STL. This patch implements 4 new flags,
>>>> to be use in the -fno-FOO form. They're only active outside of system
>>>> header files.
>> If these are quite specific coding rules, wouldn't this be something
>> ideal for a plugin rather than implemented in the compiler proper?
>> One can implement warnings with plugins (in python if desired!)
>> Compiler plugins that implement specific coding rules are quite common,
>> alas, using clang not GCC:
>> It would be more generally useful to extend GCC to fully support this
>> type of plugins.
> Good point.
FWIW, we could make this plugin in 2 weeks (w already have static
checkers as plugins for our customers). I understand Nathan that you
may have some deadlines, but if we could have the opportunity to
implement it, we could accomplish a clean isolation of a particular
business needs (despite I acknowledge that a warning about virtual
inheritance may be useful for a broader audience). OTOH, a plugin can
receive arguments, such as a configuration file which could point to
specific sources or hints about where to apply the warning, or a
suppression file, both things useful for large legacy code. IMVHO I
think this is a superior solution.
Please let me know if we could collaborate to get both a better gcc
and a better static checker.
Daniel F. Gutson
Chief Engineering Officer, SPD
San Lorenzo 47, 3rd Floor, Office 5
Phone: +54 351 4217888 / +54 351 4218211
More information about the Gcc-patches