Skip to content

Commit ac2ca8d

Browse files
authored
Add FLINT_NORETURN to function pointer argument (#2383)
In only source for flint_set_abort and flint_set_throw.
1 parent 8312872 commit ac2ca8d

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

src/generic_files/exception.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
#include <stdio.h>
1313
#include <stdlib.h>
1414
#include <stdarg.h>
15+
#define flint_set_abort gurkmacka1
16+
#define flint_set_throw gurkmacka2
1517
#include "flint.h"
18+
#undef flint_set_abort
19+
#undef flint_set_throw
1620

1721
#undef FLINT_NORETURN
1822
#if defined(__GNUC__)
@@ -21,6 +25,9 @@
2125
# define FLINT_NORETURN
2226
#endif
2327

28+
void flint_set_abort(void (* func)(void) FLINT_NORETURN);
29+
void flint_set_throw(void (* func)(flint_err_t, const char *, va_list) FLINT_NORETURN);
30+
2431
FLINT_NORETURN static void __flint_throw(flint_err_t, const char *, va_list);
2532

2633
#if FLINT_REENTRANT && !FLINT_USES_TLS && FLINT_USES_PTHREAD
@@ -44,37 +51,25 @@ void __flint_set_throw_init(void)
4451
FLINT_NORETURN void (* abort_func)(void) = abort;
4552
FLINT_NORETURN void (* throw_func)(flint_err_t, const char *, va_list) = __flint_throw;
4653

47-
void flint_set_abort(void (* func)(void))
54+
void flint_set_abort(void (* func)(void) FLINT_NORETURN)
4855
{
4956
#if FLINT_REENTRANT && !FLINT_USES_TLS && FLINT_USES_PTHREAD
5057
pthread_once(&abort_func_init, __flint_set_abort_init);
5158
pthread_mutex_lock(&abort_func_lock);
5259
#endif
53-
54-
DIAGNOSTIC_PUSH
55-
DIAGNOSTIC_IGNORE_INCOMPATIBLE_FUNCTION_POINTER_TYPES
56-
DIAGNOSTIC_IGNORE_DISCARDED_QUALIFIERS
5760
abort_func = func;
58-
DIAGNOSTIC_POP
59-
6061
#if FLINT_REENTRANT && !FLINT_USES_TLS && FLINT_USES_PTHREAD
6162
pthread_mutex_unlock(&abort_func_lock);
6263
#endif
6364
}
6465

65-
void flint_set_throw(void (* func)(flint_err_t, const char *, va_list))
66+
void flint_set_throw(void (* func)(flint_err_t, const char *, va_list) FLINT_NORETURN)
6667
{
6768
#if FLINT_REENTRANT && !FLINT_USES_TLS && FLINT_USES_PTHREAD
6869
pthread_once(&throw_func_init, __flint_set_throw_init);
6970
pthread_mutex_lock(&throw_func_lock);
7071
#endif
71-
72-
DIAGNOSTIC_PUSH
73-
DIAGNOSTIC_IGNORE_INCOMPATIBLE_FUNCTION_POINTER_TYPES
74-
DIAGNOSTIC_IGNORE_DISCARDED_QUALIFIERS
7572
throw_func = func;
76-
DIAGNOSTIC_POP
77-
7873
#if FLINT_REENTRANT && !FLINT_USES_TLS && FLINT_USES_PTHREAD
7974
pthread_mutex_unlock(&throw_func_lock);
8075
#endif

0 commit comments

Comments
 (0)