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

[PATCH] cache.h: add missing NORETURN on git_die_config*()

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Aug 5, 2014, 13:57 UTC
Message-ID
<53E0E2E0.2070709@ramsay1.demon.co.uk>

Commit 3a2a9527 ("config: add `git_die_config()` to the config-set API", 01-08-2014) added git_die_config() and git_die_config_linenr() functions, but forgot to include the NORETURN attribute in their declarations. Sparse complains like so:

        SP config.c
    config.c:1567:6: error: symbol 'git_die_config_linenr' redeclared \
        with different type (originally declared at cache.h:1419) \
        - different modifiers
    config.c:1579:6: error: symbol 'git_die_config' redeclared with \
        different type (originally declared at cache.h:1418) \
        - different modifiers

Suppress the sparse errors by adding NORETURN to the function declarations in the cache.h header file.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
Hi Tanay,

If you need to re-roll the patches in the 'ta/config-set-1' branch, could you please squash this into the relevant patch. Thanks!

At present there are no callers outside of config.c (but that will change right!;-), but since three of the four call sights for these functions appear _before_ the definitions, only a single call could possibly benefit from the NORETURN (line 1585).

HTH

ATB, Ramsay Jones

 cache.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cache.h b/cache.h
index 9faea51..d82a5c3 100644
--- a/cache.h
+++ b/cache.h
@@ -1415,8 +1415,8 @@ extern int git_config_get_bool(const char *key, int *dest);
 extern int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest);
 extern int git_config_get_maybe_bool(const char *key, int *dest);
 extern int git_config_get_pathname(const char *key, const char **dest);
-extern void git_die_config(const char *key);
-extern void git_die_config_linenr(const char *key, const char *filename, int linenr);
+extern NORETURN void git_die_config(const char *key);
+extern NORETURN void git_die_config_linenr(const char *key, const char *filename, int linenr);
 
 extern int committer_ident_sufficiently_given(void);
 extern int author_ident_sufficiently_given(void);
-- 
2.0.0
Next: Tanay Abhra
Message 1 of 2 in “cache.h: add missing NORETURN on git_die_config*()”
  1. cache.h: add missing NORETURN on git_die_config*()Ramsay Jones, Aug 5, 2014
  2. Tanay AbhraAug 5, 2014

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.