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

[PATCH v5 3/3] Makefile: restrict -Wpedantic and -Wno-pedantic-ms-format better

From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
Date
Sep 29, 2021, 03:19 UTC
Message-ID
<20210929031940.97092-4-carenas@gmail.com>
In-Reply-To
<20210929031940.97092-1-carenas@gmail.com>

6a8cbc41ba (developer: enable pedantic by default, 2021-09-03) enables pedantic mode in as many compilers as possible to help gather feedback on future tightening, so lets do so.

-Wpedantic is missing in some really old gcc 4 versions so lets restrict it to gcc5 and clang4 (it does work in clang3 AFAIK, but it will be unlikely that a developer will use such an old compiler anyway).

MinGW gcc is the only one which has -Wno-pedantic-ms-format, and while that is available also in older compilers, the Windows SDK provides gcc10 so lets aim for that.

Note that in order to target the flag to only Windows, additional changes were needed in config.mak.uname to propagate the OS detection which also did some minor refactoring, but which is functionaly equivalent.

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 config.mak.dev   | 7 ++++++-
 config.mak.uname | 6 +++++-
 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/config.mak.dev b/config.mak.dev
index cdf043c52b..7673fed114 100644
--- a/config.mak.dev
+++ b/config.mak.dev
@@ -6,14 +6,19 @@ ifeq ($(filter no-error,$(DEVOPTS)),)
 DEVELOPER_CFLAGS += -Werror
 SPARSE_FLAGS += -Wsparse-error
 endif
+
 DEVELOPER_CFLAGS += -Wall
 ifeq ($(filter no-pedantic,$(DEVOPTS)),)
 DEVELOPER_CFLAGS += -pedantic
+ifneq (($or $(filter gcc5,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),)
 DEVELOPER_CFLAGS += -Wpedantic
-ifneq ($(filter gcc5,$(COMPILER_FEATURES)),)
+ifneq ($(filter gcc10,$(COMPILER_FEATURES)),)
+ifeq ($(uname_S),MINGW)
 DEVELOPER_CFLAGS += -Wno-pedantic-ms-format
 endif
 endif
+endif
+endif
 DEVELOPER_CFLAGS += -Wdeclaration-after-statement
 DEVELOPER_CFLAGS += -Wformat-security
 DEVELOPER_CFLAGS += -Wold-style-definition
diff --git a/config.mak.uname b/config.mak.uname
index 76516aaa9a..2b178bad58 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -11,6 +11,10 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
 uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
 uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
 
+ifneq ($(findstring MINGW,$(uname_S)),)
+	uname_S := MINGW
+endif
+
 ifdef MSVC
 	# avoid the MingW and Cygwin configuration sections
 	uname_S := Windows
@@ -588,7 +592,7 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
 	SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
 	SHELL_PATH = /usr/coreutils/bin/bash
 endif
-ifneq (,$(findstring MINGW,$(uname_S)))
+ifeq ($(uname_S),MINGW)
 	pathsep = ;
 	HAVE_ALLOCA_H = YesPlease
 	NO_PREAD = YesPlease
-- 
2.33.0.955.gee03ddbf0e
Previous: Carlo Marcelo Arenas BelónNext: Carlo Arenas
Message 24 of 25 in “lazyload.h: fix warnings about mismatching function pointer types”
  1. lazyload.h: fix warnings about mismatching function pointer typesJohannes Sixt, Sep 22, 2021
  2. Carlo ArenasSep 22, 2021
  3. Johannes SixtSep 22, 2021
  4. Carlo ArenasSep 23, 2021
  5. lazyload.h: use an even more generic function pointer than FARPROCCarlo Marcelo Arenas Belón, Sep 23, 2021
  6. Johannes SixtSep 23, 2021
  7. Carlo ArenasSep 23, 2021
  8. lazyload.h: use an even more generic function pointer than FARPROCCarlo Marcelo Arenas Belón, Sep 23, 2021
  9. 0/2 js/win-lazyload-buildfixCarlo Marcelo Arenas Belón, Sep 26, 2021
  10. 1/2 lazyload.h: fix warnings about mismatching function pointer typesCarlo Marcelo Arenas Belón, Sep 26, 2021
  11. Eric SunshineSep 27, 2021
  12. 2/2 lazyload.h: use an even more generic function pointer than FARPROCCarlo Marcelo Arenas Belón, Sep 26, 2021
  13. Junio C HamanoSep 27, 2021
  14. Carlo ArenasSep 27, 2021
  15. Junio C HamanoSep 27, 2021
  16. 0/3 js/win-lazyload-buildfixCarlo Marcelo Arenas Belón, Sep 29, 2021
  17. 1/3 lazyload.h: fix warnings about mismatching function pointer typesCarlo Marcelo Arenas Belón, Sep 29, 2021
  18. 2/3 lazyload.h: use an even more generic function pointer than FARPROCCarlo Marcelo Arenas Belón, Sep 29, 2021
  19. 3/3 Makefile: restrict -Wpedantic and -Wno-pedantic-ms-format betterCarlo Marcelo Arenas Belón, Sep 29, 2021
  20. Ramsay JonesSep 29, 2021
  21. 0/3 js/win-lazyload-buildfixCarlo Marcelo Arenas Belón, Sep 29, 2021
  22. 1/3 lazyload.h: fix warnings about mismatching function pointer typesCarlo Marcelo Arenas Belón, Sep 29, 2021
  23. 2/3 lazyload.h: use an even more generic function pointer than FARPROCCarlo Marcelo Arenas Belón, Sep 29, 2021
  24. 3/3 Makefile: restrict -Wpedantic and -Wno-pedantic-ms-format betterCarlo Marcelo Arenas Belón, Sep 29, 2021
  25. Carlo ArenasSep 23, 2021

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.