mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-03 07:05:46 +00:00
Add noreturn declaration compatible with the MSVC compiler.
MSVC provides a compiler declaration to declare that a function never returns. This declaration is required in front of the function definition rather than at the end, but fortunately gcc is compatible with this location as well. Explicit returns are no longer required after calls to test_die. Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
This commit is contained in:
parent
c79dded300
commit
73c4dd9253
@ -105,7 +105,6 @@ static int one_entry(void *state, char *path)
|
||||
}
|
||||
}
|
||||
test_die("unexpected path \"%s\"", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -189,7 +188,6 @@ static walk_data empty = {
|
||||
static int dont_call_me(void *state, char *path)
|
||||
{
|
||||
test_die("dont_call_me: unexpected callback!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
BEGIN_TEST(empty)
|
||||
|
@ -29,6 +29,8 @@
|
||||
/** Declare a function never returns to the caller. */
|
||||
#ifdef __GNUC__
|
||||
# define NORETURN __attribute__((__noreturn__))
|
||||
#elif defined(_MSC_VER)
|
||||
# define NORETURN __declspec(noreturn)
|
||||
#else
|
||||
# define NORETURN /* noreturn */
|
||||
#endif
|
||||
@ -61,8 +63,7 @@ extern void test_end(void);
|
||||
*
|
||||
* @param fmt printf style format string.
|
||||
*/
|
||||
extern void test_die(const char *fmt, ...)
|
||||
NORETURN
|
||||
extern void NORETURN test_die(const char *fmt, ...)
|
||||
GIT_FORMAT_PRINTF(1, 2);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user