git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Makefile: add a DEVOPTS flag to get pedantic compilation

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 21, 2018, 19:41 UTC
Message-ID
<87wotobclv.fsf@evledraar.gmail.com>
In-Reply-To
<20180721185933.32377-1-dev+git@drbeat.li>
On Sat, Jul 21 2018, Beat Bolli wrote:
Show 7 quoted lines
> In the interest of code hygiene, make it easier to compile Git with the
> flag -pedantic.
>
> Pure pedantic compilation results in one warning per use of the
> translation macro `N_`, therefore also disable the parenthesising of
> i18n strings with -DUSE_PARENS_AROUND_GETTEXT_N=0 to show only real
> warnings.
I like this...
Show 12 quoted lines
> diff --git a/Makefile b/Makefile
> index 0cb6590f24..f800054379 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -484,6 +484,10 @@ 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.

But let's mention that we toggle USE_PARENS_AROUND_GETTEXT_N implicitly when this is set here.

> +CFLAGS += -pedantic
> +# don't warn for each N_ use
> +CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
> +endif

...and set this to "no" not "0" since we document that that's the way to toggle it off in the Makefile, i.e. let's be consistent.

Also, it would be helpful for future digging if the commit message mentioned which -W flag included in -Wpedantic is triggering this USE_PARENS_AROUND_GETTEXT_N condition that previously wasn't triggered, and on which compiler & version. 290c8e7a3f ("gettext.h: add parentheses around N_ expansion if supported", 2015-01-11) doesn't mention anything like that.

Previous: Beat BolliNext: Junio C Hamano
Message 2 of 3 in “Makefile: add a DEVOPTS flag to get pedantic compilation”
  1. Makefile: add a DEVOPTS flag to get pedantic compilationBeat Bolli, Jul 21, 2018
  2. Ævar Arnfjörð BjarmasonJul 21, 2018
  3. Junio C HamanoJul 23, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.