chore: tweak compiler builtins and attibutes
Some checks failed
continuous-integration/drone Build is failing
Some checks failed
continuous-integration/drone Build is failing
* No need to use __attribute__((noreturn)) * Use __builtin_unreachable for debug asserts in non-debug builds
This commit is contained in:
parent
b3e0bf9566
commit
430e4e981a
10
configure.ac
10
configure.ac
|
@ -70,10 +70,9 @@ AM_CONDITIONAL([BUILD_ARIFY], [test x${enable_arify} != xno])
|
||||||
|
|
||||||
# -- Checks for compiler builtins and attributes --
|
# -- Checks for compiler builtins and attributes --
|
||||||
|
|
||||||
ARIF_TRY_APPLY([AX_GCC_FUNC_ATTRIBUTE],
|
ARIF_TRY_APPLY([AX_GCC_BUILTIN], [__builtin_unreachable])
|
||||||
[constructor], [destructor], [noreturn])
|
ARIF_TRY_APPLY([AX_GCC_FUNC_ATTRIBUTE], [constructor], [destructor])
|
||||||
ARIF_TRY_APPLY([AX_GCC_VAR_ATTRIBUTE],
|
ARIF_TRY_APPLY([AX_GCC_VAR_ATTRIBUTE], [unused])
|
||||||
[unused])
|
|
||||||
|
|
||||||
# -- Checks for header files --
|
# -- Checks for header files --
|
||||||
|
|
||||||
|
@ -85,7 +84,8 @@ AC_CHECK_HEADER_STDBOOL
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
|
|
||||||
# -- Checks for library functions.
|
# -- Checks for library functions
|
||||||
|
|
||||||
AC_FUNC_MALLOC
|
AC_FUNC_MALLOC
|
||||||
AC_FUNC_REALLOC
|
AC_FUNC_REALLOC
|
||||||
AC_CHECK_FUNCS([atexit memchr strcasecmp])
|
AC_CHECK_FUNCS([atexit memchr strcasecmp])
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
* along with ARIF. If not, see <https://www.gnu.org/licenses/>.
|
* along with ARIF. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_FUNC_ATTRIBUTE_NORETURN
|
#ifdef HAVE__BUILTIN_UNREACHABLE
|
||||||
# define ARIF_NORETURN __attribute__((noreturn))
|
# define ARIF_UNREACHABLE() __builtin_unreachable()
|
||||||
#else
|
#else
|
||||||
# define ARIF_NORETURN
|
# define ARIF_UNREACHABLE()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_VAR_ATTRIBUTE_UNUSED
|
#ifdef HAVE_VAR_ATTRIBUTE_UNUSED
|
||||||
|
@ -44,5 +44,5 @@
|
||||||
#ifdef ARIF_DEBUG
|
#ifdef ARIF_DEBUG
|
||||||
# define ARIF_DEBUG_ASSERT(expr) assert(expr)
|
# define ARIF_DEBUG_ASSERT(expr) assert(expr)
|
||||||
#else
|
#else
|
||||||
# define ARIF_DEBUG_ASSERT(expr)
|
# define ARIF_DEBUG_ASSERT(expr) if (!(expr)) { ARIF_UNREACHABLE(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct options {
|
||||||
static void append_str (char const *, char **, char);
|
static void append_str (char const *, char **, char);
|
||||||
static char * concat_str (char const *, char const *, char);
|
static char * concat_str (char const *, char const *, char);
|
||||||
static int parse_options (int, char *const [], struct options *);
|
static int parse_options (int, char *const [], struct options *);
|
||||||
static void print_usage (char const *) ARIF_NORETURN;
|
static void print_usage (char const *);
|
||||||
static void set_envs (struct options *);
|
static void set_envs (struct options *);
|
||||||
// Forward declaration end
|
// Forward declaration end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user