# [PATCH] CodingGuidelines: add a note to help contributors catch some errors earlier.

3 messages from 2010-10-23 to 2010-10-23. Participants: Yann Dirson, Thiago Farina.
Thread: https://gitlist.dev/t/25533

## Yann Dirson, 2010-10-23 14:17

Subject: [PATCH] CodingGuidelines: add a note to help contributors catch some errors earlier.
Message-ID: <1287843434-10890-1-git-send-email-ydirson@altern.org>
URL: https://gitlist.dev/e/1287843434-10890-1-git-send-email-ydirson%40altern.org

```
It is a bit of a shame to wait for other's review before noticing
decl-after-stmt situations, whereas a quick check could have found it.
There are probably a number of other autoamted checks which could be
described here, but that's a start.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---
 Documentation/CodingGuidelines |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 09ffc46..7ecd4f3 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -139,3 +139,8 @@ For C programs:
 
  - When we pass <string, length> pair to functions, we should try to
    pass them in that order.
+
+ - C code is expected to compile when the build is launched with the
+   following command:
+
+   make CFLAGS="-Wall -Wdeclaration-after-statement -Werror"
-- 
1.7.2.3

```

## Thiago Farina, 2010-10-23 17:11

Subject: Re: [PATCH] CodingGuidelines: add a note to help contributors catch some errors earlier.
Message-ID: <AANLkTikCr5yRHzetY9-T=_rg+PZM-e8ZnQvL79ucws+6@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTikCr5yRHzetY9-T%3D_rg%2BPZM-e8ZnQvL79ucws%2B6%40mail.gmail.com
In-Reply-To: <1287843434-10890-1-git-send-email-ydirson@altern.org>

```
On Sat, Oct 23, 2010 at 12:17 PM, Yann Dirson <ydirson@altern.org> wrote:
> + - C code is expected to compile when the build is launched with the
> +   following command:
> +
> +   make CFLAGS="-Wall -Wdeclaration-after-statement -Werror"

Why this is not in the Makefile by default? Also -Wall is already in
the Makefile.

```

## Yann Dirson, 2010-10-23 18:48

Subject: Re: [PATCH] CodingGuidelines: add a note to help contributors catch some errors earlier.
Message-ID: <20101023184830.GQ4983@home.lan>
URL: https://gitlist.dev/e/20101023184830.GQ4983%40home.lan
In-Reply-To: <AANLkTikCr5yRHzetY9-T=_rg+PZM-e8ZnQvL79ucws+6@mail.gmail.com>

```
On Sat, Oct 23, 2010 at 03:11:19PM -0200, Thiago Farina wrote:
> On Sat, Oct 23, 2010 at 12:17 PM, Yann Dirson <ydirson@altern.org> wrote:
> > + - C code is expected to compile when the build is launched with the
> > +   following command:
> > +
> > +   make CFLAGS="-Wall -Wdeclaration-after-statement -Werror"
> 
> Why this is not in the Makefile by default? Also -Wall is already in
> the Makefile.

CFLAGS seems to be used for more than gcc, and -Wall seems to be
portable enough to be overriden only in a couple of cases.  It would
not be the same for those flags.

Also note that -Wdeclaration-after-statement is also mentionned in
SubmittingPatches, but I still think it is a better place in
CodingGuidelines, which contributers are most likely to use as a
checklist before publishing.

```
