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

[PATCH] config.mak.dev: add -Wformat

From
Thomas Gummerer <t.gummerer@gmail.com>
Date
Oct 12, 2018, 18:40 UTC
Message-ID
<20181012184037.15076-1-t.gummerer@gmail.com>

801fa63a90 ("config.mak.dev: add -Wformat-security", 2018-09-08) added the -Wformat-security to the flags set in config.mak.dev. In the gcc man page this is documented as:

         If -Wformat is specified, also warn about uses of format
         functions that represent possible security problems.  [...]

That commit did however not add the -Wformat flag, and -Wformat is not specified anywhere else by default, so the added -Wformat-security had no effect. Newer versions of gcc (gcc 8.2.1 in this particular case) warn about this and thus compilation fails with this option set.

Fix that, and make -Wformat-security actually useful by adding the -Wformat flag as well. git compiles cleanly with both these flags applied.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
---
Sorry for not catching this before the patch made it to next.  
 config.mak.dev | 1 +
 1 file changed, 1 insertion(+)
diff --git a/config.mak.dev b/config.mak.dev
index 92d268137f..bf6f943452 100644
--- a/config.mak.dev
+++ b/config.mak.dev
@@ -7,6 +7,7 @@ CFLAGS += -pedantic
 CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
 endif
 CFLAGS += -Wdeclaration-after-statement
+CFLAGS += -Wformat
 CFLAGS += -Wformat-security
 CFLAGS += -Wno-format-zero-length
 CFLAGS += -Wold-style-definition
-- 
2.19.1.937.g12227c8702.dirty
Next: Jeff King
Message 1 of 11 in “config.mak.dev: add -Wformat”
  1. config.mak.dev: add -WformatThomas Gummerer, Oct 12, 2018
  2. Jeff KingOct 12, 2018
  3. Jonathan NiederOct 12, 2018
  4. Jeff KingOct 12, 2018
  5. Thomas GummererOct 12, 2018
  6. Jonathan NiederDec 27, 2018
  7. Junio C HamanoJan 3, 2019
  8. Jonathan NiederJan 3, 2019
  9. Thomas GummererJan 6, 2019
  10. Junio C HamanoJan 7, 2019
  11. Jonathan NiederJan 7, 2019

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.