[C++] Coding rule enforcement

Jason Merrill jason@redhat.com
Tue Sep 15 18:33:00 GMT 2015


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 <nathan@acm.org> wrote:
>>> Jason,
>>> 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,
>>> intended
>>> 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!)
>
> http://gcc-python-plugin.readthedocs.org/en/latest/basics.html#generating-custom-errors-and-warnings
>
>
> Compiler plugins that implement specific coding rules are quite common,
> alas, using clang not GCC:
> https://wiki.documentfoundation.org/Development/Clang_plugins
>
> It would be more generally useful to extend GCC to fully support this
> type of plugins.

Good point.

Jason




More information about the Gcc-patches mailing list