chore: tweak compiler builtins and attibutes
continuous-integration/drone Build is failing
Details
continuous-integration/drone Build is failing
Details
* 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 --
|
||||
|
||||
ARIF_TRY_APPLY([AX_GCC_FUNC_ATTRIBUTE],
|
||||
[constructor], [destructor], [noreturn])
|
||||
ARIF_TRY_APPLY([AX_GCC_VAR_ATTRIBUTE],
|
||||
[unused])
|
||||
ARIF_TRY_APPLY([AX_GCC_BUILTIN], [__builtin_unreachable])
|
||||
ARIF_TRY_APPLY([AX_GCC_FUNC_ATTRIBUTE], [constructor], [destructor])
|
||||
ARIF_TRY_APPLY([AX_GCC_VAR_ATTRIBUTE], [unused])
|
||||
|
||||
# -- Checks for header files --
|
||||
|
||||
|
@ -85,7 +84,8 @@ AC_CHECK_HEADER_STDBOOL
|
|||
AC_C_INLINE
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
# -- Checks for library functions.
|
||||
# -- Checks for library functions
|
||||
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_REALLOC
|
||||
AC_CHECK_FUNCS([atexit memchr strcasecmp])
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
* along with ARIF. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_FUNC_ATTRIBUTE_NORETURN
|
||||
# define ARIF_NORETURN __attribute__((noreturn))
|
||||
#ifdef HAVE__BUILTIN_UNREACHABLE
|
||||
# define ARIF_UNREACHABLE() __builtin_unreachable()
|
||||
#else
|
||||
# define ARIF_NORETURN
|
||||
# define ARIF_UNREACHABLE()
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VAR_ATTRIBUTE_UNUSED
|
||||
|
@ -44,5 +44,5 @@
|
|||
#ifdef ARIF_DEBUG
|
||||
# define ARIF_DEBUG_ASSERT(expr) assert(expr)
|
||||
#else
|
||||
# define ARIF_DEBUG_ASSERT(expr)
|
||||
# define ARIF_DEBUG_ASSERT(expr) if (!(expr)) { ARIF_UNREACHABLE(); }
|
||||
#endif
|
||||
|
|
|
@ -54,7 +54,7 @@ struct options {
|
|||
static void append_str (char const *, char **, char);
|
||||
static char * concat_str (char const *, char const *, char);
|
||||
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 *);
|
||||
// Forward declaration end
|
||||
|
||||
|
|
Loading…
Reference in New Issue