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

2 messages from 2014-08-05 to 2014-08-05. Participants: Ramsay Jones, Tanay Abhra.
Thread: https://gitlist.dev/t/37290

## Ramsay Jones, 2014-08-05 13:57

Subject: [PATCH] cache.h: add missing NORETURN on git_die_config*()
Message-ID: <53E0E2E0.2070709@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/53E0E2E0.2070709%40ramsay1.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

```

## Tanay Abhra, 2014-08-05 14:09

Subject: Re: [PATCH] cache.h: add missing NORETURN on git_die_config*()
Message-ID: <53E0E5AB.9050404@gmail.com>
URL: https://gitlist.dev/e/53E0E5AB.9050404%40gmail.com
In-Reply-To: <53E0E2E0.2070709@ramsay1.demon.co.uk>

```


On 8/5/2014 7:27 PM, Ramsay Jones wrote:
> 
> 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!
>

Sorry, my bad. I will squash it in the relevant patch for my next re roll.

Thanks,
Tanay Abhra.

```
