mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
Merge branch 'ef/msvc-noreturn'
* ef/msvc-noreturn: add NORETURN_PTR for function pointers increase portability of NORETURN declarations
This commit is contained in:
commit
c2c865684b
|
@ -176,8 +176,10 @@ extern char *gitbasename(char *);
|
|||
|
||||
#ifdef __GNUC__
|
||||
#define NORETURN __attribute__((__noreturn__))
|
||||
#define NORETURN_PTR __attribute__((__noreturn__))
|
||||
#else
|
||||
#define NORETURN
|
||||
#define NORETURN_PTR
|
||||
#ifndef __attribute__
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
@ -186,13 +188,13 @@ extern char *gitbasename(char *);
|
|||
#include "compat/bswap.h"
|
||||
|
||||
/* General helper functions */
|
||||
extern void usage(const char *err) NORETURN;
|
||||
extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2)));
|
||||
extern void die_errno(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2)));
|
||||
extern NORETURN void usage(const char *err);
|
||||
extern NORETURN void die(const char *err, ...) __attribute__((format (printf, 1, 2)));
|
||||
extern NORETURN void die_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));
|
||||
extern int error(const char *err, ...) __attribute__((format (printf, 1, 2)));
|
||||
extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)));
|
||||
|
||||
extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN);
|
||||
extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params));
|
||||
|
||||
extern int prefixcmp(const char *str, const char *prefix);
|
||||
extern time_t tm_to_time_t(const struct tm *tm);
|
||||
|
|
|
@ -206,8 +206,8 @@ static void parse_pack_header(void)
|
|||
use(sizeof(struct pack_header));
|
||||
}
|
||||
|
||||
static void bad_object(unsigned long offset, const char *format,
|
||||
...) NORETURN __attribute__((format (printf, 2, 3)));
|
||||
static NORETURN void bad_object(unsigned long offset, const char *format,
|
||||
...) __attribute__((format (printf, 2, 3)));
|
||||
|
||||
static void bad_object(unsigned long offset, const char *format, ...)
|
||||
{
|
||||
|
|
6
usage.c
6
usage.c
|
@ -36,12 +36,12 @@ static void warn_builtin(const char *warn, va_list params)
|
|||
|
||||
/* If we are in a dlopen()ed .so write to a global variable would segfault
|
||||
* (ugh), so keep things static. */
|
||||
static void (*usage_routine)(const char *err) NORETURN = usage_builtin;
|
||||
static void (*die_routine)(const char *err, va_list params) NORETURN = die_builtin;
|
||||
static NORETURN_PTR void (*usage_routine)(const char *err) = usage_builtin;
|
||||
static NORETURN_PTR void (*die_routine)(const char *err, va_list params) = die_builtin;
|
||||
static void (*error_routine)(const char *err, va_list params) = error_builtin;
|
||||
static void (*warn_routine)(const char *err, va_list params) = warn_builtin;
|
||||
|
||||
void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN)
|
||||
void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params))
|
||||
{
|
||||
die_routine = routine;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue