From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19298 invoked by alias); 21 Sep 2015 13:46:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 19282 invoked by uid 89); 21 Sep 2015 13:46:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-io0-f170.google.com Received: from mail-io0-f170.google.com (HELO mail-io0-f170.google.com) (209.85.223.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 21 Sep 2015 13:46:08 +0000 Received: by ioiz6 with SMTP id z6so119317216ioi.2 for ; Mon, 21 Sep 2015 06:46:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=exYeGf/eJXus9IYexpYmPjjsCGSmvJIjiGcRzj5O/QQ=; b=jbyyCdiCz5GBBn8BvqF+eLLfz4+gRKgVARNRSXbp1cE5Cq0dLp8eH87AW/GgLo7alp A+3mkTDJH/sf1IeWll1P7/Vvqt3NFBADWvZs9n+kdpnSpf0nEJy7w7ggbdcJnIG35Lf2 wspmkxunMaiHjn1tNVzqfsCPlP+2nk94If5T1Z7JetG2brmvPJ+T4JC7J3uClDctJAq6 3P180edo2nsJKQvJxz1M2aEcci8tdt0p8S8m+x/iWgOAOR5CmZxEgCs5voOJFSDxtHra v6MJuiNOEjowMTIM9jNtGguLe3X7L14mPR3tzFojjmhbZ2qE1BI1/at/suT9uF4GLyRT IcUg== X-Gm-Message-State: ALoCoQndpe5CwjQF1dNVVEHlCU4cI+yHQNsT4RDaesGDsWXIuQYmiwTjeAKxBzRTq+umRvld0bp8 MIME-Version: 1.0 X-Received: by 10.107.46.101 with SMTP id i98mr26769422ioo.17.1442843165848; Mon, 21 Sep 2015 06:46:05 -0700 (PDT) Received: by 10.107.9.225 with HTTP; Mon, 21 Sep 2015 06:46:05 -0700 (PDT) In-Reply-To: <55F8640B.4060804@redhat.com> References: <55F816F2.5010209@acm.org> <55F85357.5000101@gmail.com> <55F8640B.4060804@redhat.com> Date: Mon, 21 Sep 2015 13:52:00 -0000 Message-ID: Subject: Re: [C++] Coding rule enforcement From: Daniel Gutson To: Jason Merrill Cc: =?UTF-8?B?TWFudWVsIEzDs3Blei1JYsOhw7Fleg==?= , Richard Biener , Nathan Sidwell , GCC Patches , David Malcolm Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg01564.txt.bz2 On Tue, Sep 15, 2015 at 3:31 PM, Jason Merrill wrote: > On 09/15/2015 01:20 PM, Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez wrote: >> >> On 15/09/15 15:26, Richard Biener wrote: >>> >>> On Tue, Sep 15, 2015 at 3:02 PM, Nathan Sidwell 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#generatin= g-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 > > --=20 Daniel F. Gutson Chief Engineering Officer, SPD San Lorenzo 47, 3rd Floor, Office 5 C=C3=B3rdoba, Argentina Phone: +54 351 4217888 / +54 351 4218211 Skype: dgutson LinkedIn: http://ar.linkedin.com/in/danielgutson