Skip to contentSkip to conversation

Makefile: add a DEVOPTS flag to get pedantic compilation

PATCH Superseded Beat Bolli 2 participants 8 messages Jul 21, 2018 – Jul 25, 2018 1 message not in the archive Kbuild

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): https://public-inbox.org/git/[email protected]/

Beat Bolli

author
#1 lore raw

PATCH v2 1/1 Makefile: add a DEVOPTS flag to get pedantic compilation

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.

---

This is the convenience knob for all developers that led to the series bb/pedantic[1]. It does not depend on this series, though.

[1] https://public-inbox.org/git/[email protected]/T/#u

 Makefile       | 6 ++++++
 config.mak.dev | 5 +++++
 2 files changed, 11 insertions(+)
Makefile +5 -0
index 0cb6590f24..2bfc051652 100644
@@ -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
config.mak.dev +5 -0
index 2d244ca470..e11dd94741 100644
@@ -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
Signature · 1 line
2.18.0.203.gfac676dfb9
#2 lore raw
Quoted 8 lines · Beat Bolli

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]

Quoted 8 lines

Therefore also disable the parenthesising of i18n strings with -DUSE_PARENS_AROUND_GETTEXT_N=no.

---

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.

Quoted 38 lines

[1] https://public-inbox.org/git/[email protected]/T/#u

 Makefile       | 6 ++++++
 config.mak.dev | 5 +++++
 2 files changed, 11 insertions(+)
Makefile +5 -0
index 0cb6590f24..2bfc051652 100644
@@ -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
config.mak.dev +5 -0
index 2d244ca470..e11dd94741 100644
@@ -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
author
#3 lore raw
Quoted 13 lines · Junio C Hamano
Quoted 11 lines · Beat Bolli

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.

Quoted 8 lines
Quoted 5 lines

---

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 ;-)

Then there's a bug in this patch. It should only have an effect if we "make DEVELOPER=Yes DEVOPTS=pedantic". Did you try this?

Quoted 2 lines

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

No problem, I can send a v3 with this change reverted.

Beat

Quoted 41 lines

Thanks.

Quoted 38 lines

[1] https://public-inbox.org/git/[email protected]/T/#u

 Makefile       | 6 ++++++
 config.mak.dev | 5 +++++
 2 files changed, 11 insertions(+)
Makefile +5 -0
index 0cb6590f24..2bfc051652 100644
@@ -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
config.mak.dev +5 -0
index 2d244ca470..e11dd94741 100644
@@ -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
#4 lore raw
Quoted 10 lines · Beat Bolli
Quoted 6 lines · Junio C Hamano
Quoted 3 lines

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 ;-)

Then there's a bug in this patch. It should only have an effect if we "make DEVELOPER=Yes DEVOPTS=pedantic". Did you try this?

Sorry, "exercising the feature" is what I meant to say with that "make" invocation, so I should have also spelled DEVOPTS bit, too.

author
#5 lore raw

PATCH v3 1/1 Makefile: add a DEVOPTS flag to get pedantic compilation

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.

---

Now with -DUSE_PARENS_AROUND_GETTEXT_N=0 instead of =No.

This is the convenience knob for all developers that led to the series bb/pedantic[1]. It does not depend on this series, though.

[1] https://public-inbox.org/git/[email protected]/T/#u

 Makefile       | 6 ++++++
 config.mak.dev | 5 +++++
 2 files changed, 11 insertions(+)
Makefile +5 -0
index 0cb6590f24..2bfc051652 100644
@@ -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
config.mak.dev +5 -0
index 2d244ca470..e11dd94741 100644
@@ -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=0
+endif
 CFLAGS += -Wdeclaration-after-statement
 CFLAGS += -Wno-format-zero-length
 CFLAGS += -Wold-style-definition
Signature · 1 line
2.18.0.203.gfac676dfb9
author
#6 lore raw

PATCH v4 1/1 Makefile: add a DEVOPTS flag to get pedantic compilation

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=0.

---

Now with -DUSE_PARENS_AROUND_GETTEXT_N=0 instead of =No.

This is the convenience knob for all developers that led to the series bb/pedantic[1]. It does not depend on this series, though.

[1] https://public-inbox.org/git/[email protected]/T/#u

 Makefile       | 6 ++++++
 config.mak.dev | 5 +++++
 2 files changed, 11 insertions(+)
Makefile +5 -0
index 0cb6590f24..2bfc051652 100644
@@ -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
config.mak.dev +5 -0
index 2d244ca470..e11dd94741 100644
@@ -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=0
+endif
 CFLAGS += -Wdeclaration-after-statement
 CFLAGS += -Wno-format-zero-length
 CFLAGS += -Wold-style-definition
Signature · 1 line
2.18.0.203.gfac676dfb9
#7 lore raw
Quoted 6 lines · Beat Bolli

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_:

Quoted 7 lines

warning: array initialized from parenthesized string constant [-Wpedantic]

Therefore also disable the parenthesising of i18n strings with -DUSE_PARENS_AROUND_GETTEXT_N=0.

---

Hmph, what did you change between v3 and v4?

Makefile all::

Quoted 5 lines
Makefile +0 -0
index 0cb6590f24..2bfc051652 100644
@@ -484,6 +484,12 @@ all::

The postimage of this hunk is supposed to be 11 lines long, as you have five additional line in the middle of 6 original context lines. Where did this 12 come from? I am only interested in finding out if our patch generation tool(s) have some bugs with this question.

If this is only because you hand-edit your patch, then we have no tool breakage to worry about, but please refrain from doing so in the future (instead always go back to the commit, amend it, and re-run format-patch).

Thanks.

Quoted 11 lines
Makefile +5 -0
 #        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
author
#8 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 8 lines · Beat Bolli

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]

Quoted 7 lines
Quoted 5 lines

Therefore also disable the parenthesising of i18n strings with -DUSE_PARENS_AROUND_GETTEXT_N=0.

---

Hmph, what did you change between v3 and v4?

Just the commit text. In v3, it still said =No instead of =0.

Quoted 11 lines

Makefile all::

Quoted 5 lines
Makefile +0 -0
index 0cb6590f24..2bfc051652 100644
@@ -484,6 +484,12 @@ all::

The postimage of this hunk is supposed to be 11 lines long, as you have five additional line in the middle of 6 original context lines. Where did this 12 come from? I am only interested in finding out if our patch generation tool(s) have some bugs with this question.

Quoted 6 lines

If this is only because you hand-edit your patch, then we have no tool breakage to worry about, but please refrain from doing so in the future (instead always go back to the commit, amend it, and re-run format-patch).

Thanks.

You got me there :-/

Won't happen again, sorry.

Quoted 12 lines
Quoted 11 lines
Makefile +5 -0
 #        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