From: Jeff King <peff@peff.net>
To: Alexander Kuleshov <kuleshovmail@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] init-db: remove unused #includes
Date: Thu, 15 Jan 2015 05:55:59 -0500 [thread overview]
Message-ID: <20150115105558.GA13536@peff.net> (raw)
In-Reply-To: <CANCZXo5UY80327pvjzYkJXroH_WZdW36LhSANK0O7GGVQLF=AA@mail.gmail.com>
On Thu, Jan 15, 2015 at 04:13:00PM +0600, Alexander Kuleshov wrote:
> yes right, missed system_path usage. But it's strange, code still
> compiles successfully without exec_cmd.h.
Sort of. With your patch I get:
builtin/init-db.c: In function ‘copy_templates’:
builtin/init-db.c:127:3: warning: implicit declaration of function ‘system_path’ [-Wimplicit-function-declaration]
template_dir = to_free = system_path(DEFAULT_GIT_TEMPLATE_DIR);
^
builtin/init-db.c:127:26: warning: assignment makes pointer from integer without a cast
template_dir = to_free = system_path(DEFAULT_GIT_TEMPLATE_DIR);
Those are just warnings, and on some platforms the resulting code will
be fine, but it does violate the C standard to not have a valid
declaration in this case (it defaults to an int return type, which is
wrong; but simply as a matter of style we do not like implicit
declarations even when they are technically correct).
If you are going to be doing refactoring, I'd recommend building with
"-Werror" in your CFLAGS to catch such problems.
FWIW, the full set of CFLAGS I use (which I specify in config.mak) is:
CFLAGS += -Wall -Werror
CFLAGS += -Wno-format-zero-length
CFLAGS += -Wdeclaration-after-statement
CFLAGS += -Wpointer-arith
CFLAGS += -Wstrict-prototypes
CFLAGS += -Wold-style-declaration
-Peff
next prev parent reply other threads:[~2015-01-15 10:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-14 17:59 [PATCH] init-db: remove unused #includes Alexander Kuleshov
2015-01-14 19:09 ` Junio C Hamano
2015-01-14 20:14 ` Junio C Hamano
2015-01-15 10:13 ` Alexander Kuleshov
2015-01-15 10:55 ` Jeff King [this message]
2015-01-15 20:36 ` Junio C Hamano
2015-01-15 22:31 ` Jeff King
2015-01-15 23:40 ` Junio C Hamano
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=20150115105558.GA13536@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kuleshovmail@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.