git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Beat Bolli <dev+git@drbeat.li>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2] Makefile: add a DEVOPTS flag to get pedantic compilation
Date: Mon, 23 Jul 2018 11:53:39 -0700	[thread overview]
Message-ID: <xmqqva956ax8.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180721203647.2619-1-dev+git@drbeat.li> (Beat Bolli's message of "Sat, 21 Jul 2018 22:36:47 +0200")

Beat Bolli <dev+git@drbeat.li> writes:

> In the interest of code hygiene, make it easier to compile Git with the
> flag -pedantic.
>
> Pure pedantic compilation with GCC 7.3 results in one warning per use of
> the translation macro `N_`:
>
>     warning: array initialized from parenthesized string constant [-Wpedantic]
>
> Therefore also disable the parenthesising of i18n strings with
> -DUSE_PARENS_AROUND_GETTEXT_N=no.
>
> Signed-off-by: Beat Bolli <dev+git@drbeat.li>
> ---
>
> This is the convenience knob for all developers that led to the series
> bb/pedantic[1]. It does not depend on this series, though.

Yup, but "make DEVELOPER=Yes" build won't pass unless this patch is
queued after those clean-up ;-)

Remind me if I forget to tweak =no back to =0 before pushing the
result out.

Thanks.

> [1] https://public-inbox.org/git/20180708144342.11922-1-dev+git@drbeat.li/T/#u
>
>  Makefile       | 6 ++++++
>  config.mak.dev | 5 +++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 0cb6590f24..2bfc051652 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -484,6 +484,12 @@ all::
>  #        The DEVELOPER mode enables -Wextra with a few exceptions. By
>  #        setting this flag the exceptions are removed, and all of
>  #        -Wextra is used.
> +#
> +#    pedantic:
> +#
> +#        Enable -pedantic compilation. This also disables
> +#        USE_PARENS_AROUND_GETTEXT_N to produce only relevant warnings.
>  
>  GIT-VERSION-FILE: FORCE
>  	@$(SHELL_PATH) ./GIT-VERSION-GEN
> diff --git a/config.mak.dev b/config.mak.dev
> index 2d244ca470..e11dd94741 100644
> --- a/config.mak.dev
> +++ b/config.mak.dev
> @@ -1,6 +1,11 @@
>  ifeq ($(filter no-error,$(DEVOPTS)),)
>  CFLAGS += -Werror
>  endif
> +ifneq ($(filter pedantic,$(DEVOPTS)),)
> +CFLAGS += -pedantic
> +# don't warn for each N_ use
> +CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=no
> +endif
>  CFLAGS += -Wdeclaration-after-statement
>  CFLAGS += -Wno-format-zero-length
>  CFLAGS += -Wold-style-definition

  reply	other threads:[~2018-07-23 18:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-21 20:36 [PATCH v2] Makefile: add a DEVOPTS flag to get pedantic compilation Beat Bolli
2018-07-23 18:53 ` Junio C Hamano [this message]
2018-07-24  6:04   ` Beat Bolli
2018-07-24 13:21     ` Junio C Hamano
2018-07-24 17:13       ` [PATCH v3] " Beat Bolli
2018-07-24 19:26         ` [PATCH v4] " Beat Bolli
2018-07-25 16:57           ` Junio C Hamano
2018-07-25 17:38             ` Beat Bolli

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqva956ax8.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=dev+git@drbeat.li \
    --cc=git@vger.kernel.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).