git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Herland <johan@herland.net>
To: git@vger.kernel.org
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Junio C Hamano <junkio@cox.net>,
	Martin Waitz <tali@admingilde.org>,
	"Shawn O. Pearce" <spearce@spearce.org>
Subject: [PATCH] Add -Wdeclaration-after-statement to CFLAGS to help enforce the instructions in SubmittingPatches
Date: Sun, 27 May 2007 16:39:35 +0200	[thread overview]
Message-ID: <200705271639.35267.johan@herland.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0705211347540.6410@racer.site>

Signed-off-by: Johan Herland <johan@herland.net>
---
On Monday 21 May 2007, Johannes Schindelin wrote:
> 
> We do not appreciate C99 initializers, declarations after statements,
> or "0" instead of "NULL".
>
> [...]
> 
> +Also, variables have to be declared at the beginning of the block
> +(you can check this with gcc, using the -Wdeclaration-after-statement
> +option).

Why not automatically enforce it by putting -Wdeclaration-after-statement
in the Makefile?

It should probably be protected by some GCC if-ery, but then again, so should this:

CC = gcc


Have fun!

...Johan


 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 29243c6..4e91516 100644
--- a/Makefile
+++ b/Makefile
@@ -135,7 +135,7 @@ uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
-CFLAGS = -g -O2 -Wall
+CFLAGS = -g -O2 -Wall -Wdeclaration-after-statement
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-- 
1.5.2.101.gee49f

  reply	other threads:[~2007-05-27 14:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-20 15:42 [PATCH v2] Submodule merge support Martin Waitz
2007-05-21  6:20 ` Shawn O. Pearce
2007-05-21  7:32   ` Martin Waitz
2007-05-21  7:37     ` Shawn O. Pearce
2007-05-21  7:55       ` Junio C Hamano
2007-05-21 15:42       ` Alex Riesen
2007-05-21  7:54     ` Junio C Hamano
2007-05-21 12:48       ` [PATCH] SubmittingPatches: mention older C compiler compatibility Johannes Schindelin
2007-05-27 14:39         ` Johan Herland [this message]
2007-05-27 14:58           ` [PATCH] Add -Wdeclaration-after-statement to CFLAGS to help enforce the instructions in SubmittingPatches Morten Welinder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200705271639.35267.johan@herland.net \
    --to=johan@herland.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=spearce@spearce.org \
    --cc=tali@admingilde.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).