This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++] Coding rule enforcement
- From: Daniel Gutson <daniel dot gutson at tallertechnologies dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Manuel LÃpez-IbÃÃez <lopezibanez at gmail dot com>, Richard Biener <richard dot guenther at gmail dot com>, Nathan Sidwell <nathan at acm dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>, David Malcolm <dmalcolm at redhat dot com>
- Date: Mon, 21 Sep 2015 10:46:05 -0300
- Subject: Re: [C++] Coding rule enforcement
- Authentication-results: sourceware.org; auth=none
- References: <55F816F2 dot 5010209 at acm dot org> <CAFiYyc1yZnWf35p+w_eKXnKZOaAj9pgXufk8Ba53wH8dttJSjg at mail dot gmail dot com> <55F85357 dot 5000101 at gmail dot com> <55F8640B dot 4060804 at redhat dot com>
On Tue, Sep 15, 2015 at 3:31 PM, Jason Merrill <jason@redhat.com> 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 <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.
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.
>
> Jason
>
>
--
Daniel F. Gutson
Chief Engineering Officer, SPD
San Lorenzo 47, 3rd Floor, Office 5
CÃrdoba, Argentina
Phone: +54 351 4217888 / +54 351 4218211
Skype: dgutson
LinkedIn: http://ar.linkedin.com/in/danielgutson