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

[PATCH] BUG_exit_code: fix sparse "symbol not declared" warning

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
May 9, 2018, 17:04 UTC
Message-ID
<dd1db230-9d5a-f78b-f2ec-38754135495d@ramsayjones.plus.com>
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Johannes,

If you need to re-roll your 'js/use-bug-macro' branch, could you please squash this into the relevant patch (commit a86303cb5d, "test-tool: help verifying BUG() code paths", 2018-05-02).

This will, obviously, not be required if you were to implement Jeff's suggestion (in [1]) of using an environment variable instead. (which, FWIW, I prefer).

Thanks!

ATB, Ramsay Jones

[1] https://public-inbox.org/git/20180507090109.GA367@sigill.intra.peff.net/
 git-compat-util.h    | 3 +++
 t/helper/test-tool.c | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index 5a5a99af7..b7883b257 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1116,6 +1116,9 @@ static inline int regexec_buf(const regex_t *preg, const char *buf, size_t size,
 #define HAVE_VARIADIC_MACROS 1
 #endif
 
+/* usage.c: only to be used for testing BUG() implementation (see test-tool) */
+extern int BUG_exit_code;
+
 #ifdef HAVE_VARIADIC_MACROS
 __attribute__((format (printf, 3, 4))) NORETURN
 void BUG_fl(const char *file, int line, const char *fmt, ...);
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 5176f9f20..805a45de9 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -47,7 +47,6 @@ static struct test_cmd cmds[] = {
 int cmd_main(int argc, const char **argv)
 {
 	int i;
-	extern int BUG_exit_code;
 
 	BUG_exit_code = 99;
 	if (argc < 2)
-- 
2.17.0
Message 1 of 1 in “BUG_exit_code: fix sparse "symbol not declared" warning”
  1. BUG_exit_code: fix sparse "symbol not declared" warningRamsay Jones, May 9, 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.