mirror of
https://github.com/matrix-construct/construct
synced 2024-09-27 11:18:51 +02:00
configure: Disable all __assert_fail() overrides unless explicit --with-assert option.
This commit is contained in:
parent
8050d6d66b
commit
21d9f4792b
5 changed files with 21 additions and 22 deletions
22
configure.ac
22
configure.ac
|
@ -61,6 +61,11 @@ AC_CONFIG_FILES(\
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([subdir-objects])
|
AM_INIT_AUTOMAKE([subdir-objects])
|
||||||
|
|
||||||
|
dnl If this is not (un)set, paths are added such as -I../include/ircd to every
|
||||||
|
dnl build command and that isn't nice because it makes our headers conflict
|
||||||
|
dnl with standard library/path headers which we don't want or need.
|
||||||
|
AC_SUBST(DEFAULT_INCLUDES, [])
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Recursive local targets (clean-local is implied)
|
dnl Recursive local targets (clean-local is implied)
|
||||||
dnl
|
dnl
|
||||||
|
@ -181,33 +186,28 @@ dnl Switch to control the action of assert()
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether to change the behavior of assertions)
|
AC_MSG_CHECKING(whether to change the behavior of assertions)
|
||||||
AC_ARG_WITH(assert, AC_HELP_STRING([--with-assert[[[=trap]]]], [Soften assertion behavior]),
|
AC_ARG_WITH(assert, AC_HELP_STRING([--with-assert[[[=abort]]]], [Soften assertion behavior]),
|
||||||
[
|
[
|
||||||
assert_type=$withval
|
assert_type=$withval
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes, "$assert_type"])
|
||||||
AC_SUBST(ASSERT_TYPE, $assert_type)
|
AC_SUBST(ASSERT_TYPE, $assert_type)
|
||||||
], [
|
], [
|
||||||
AM_COND_IF(DEBUG,
|
|
||||||
[
|
|
||||||
assert_type="trap"
|
|
||||||
AC_MSG_RESULT([no, defaulting to "$assert_type"])
|
|
||||||
AC_SUBST(ASSERT_TYPE, $assert_type)
|
|
||||||
], [
|
|
||||||
assert_type="abort"
|
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
AC_SUBST(ASSERT_TYPE, $assert_type)
|
|
||||||
])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
AM_COND_IF(ASSERT,
|
AM_COND_IF(ASSERT,
|
||||||
[
|
[
|
||||||
if [[ ! -z "$assert_type" ]]; then
|
if [[ ! -z "$assert_type" ]]; then
|
||||||
|
|
||||||
|
if [[ "$assert_type" != "abort" ]]; then
|
||||||
RB_DEFINE_UNQUOTED([ASSERT], ["$assert_type"], [Assertion behavior])
|
RB_DEFINE_UNQUOTED([ASSERT], ["$assert_type"], [Assertion behavior])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$assert_type" == "trap" ]]; then
|
if [[ "$assert_type" == "trap" ]]; then
|
||||||
RB_DEFINE([ASSERT_INTRINSIC], [1], [Intrinsic assertion behavior])
|
RB_DEFINE([ASSERT_INTRINSIC], [1], [Intrinsic assertion behavior])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
/// Define an indicator for whether we override standard assert() behavior in
|
/// Define an indicator for whether we override standard assert() behavior in
|
||||||
/// this build if the conditions are appropriate.
|
/// this build if the conditions are appropriate.
|
||||||
#if defined(RB_ASSERT) && !defined(NDEBUG)
|
#if defined(RB_ASSERT) && !defined(NDEBUG)
|
||||||
#define IRCD_ASSERT_OVERRIDE
|
|
||||||
#define _ASSERT_H_DECLS
|
#define _ASSERT_H_DECLS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -43,7 +42,7 @@ namespace ircd
|
||||||
/// actions as defined in our internal assert.cc unit. When trapping assert
|
/// actions as defined in our internal assert.cc unit. When trapping assert
|
||||||
/// is disabled this path will be used instead.
|
/// is disabled this path will be used instead.
|
||||||
///
|
///
|
||||||
#if defined(IRCD_ASSERT_OVERRIDE) && !defined(RB_ASSERT_INTRINSIC)
|
#if defined(RB_ASSERT) && !defined(RB_ASSERT_INTRINSIC)
|
||||||
extern "C" void
|
extern "C" void
|
||||||
__attribute__((visibility("default")))
|
__attribute__((visibility("default")))
|
||||||
__assert_fail(const char *__assertion,
|
__assert_fail(const char *__assertion,
|
||||||
|
@ -55,7 +54,7 @@ __assert_fail(const char *__assertion,
|
||||||
/// Override the standard assert behavior, if enabled, to trap into the
|
/// Override the standard assert behavior, if enabled, to trap into the
|
||||||
/// debugger as close as possible to the offending site.
|
/// debugger as close as possible to the offending site.
|
||||||
///
|
///
|
||||||
#if defined(IRCD_ASSERT_OVERRIDE) && defined(RB_ASSERT_INTRINSIC)
|
#if defined(RB_ASSERT) && defined(RB_ASSERT_INTRINSIC)
|
||||||
extern "C" // for clang
|
extern "C" // for clang
|
||||||
{
|
{
|
||||||
extern inline void
|
extern inline void
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace ircd
|
||||||
// Trouble; clang w/ our custom assert
|
// Trouble; clang w/ our custom assert
|
||||||
//
|
//
|
||||||
|
|
||||||
#if defined(__clang__) && !defined(assert)
|
#if defined(RB_ASSERT) && defined(__clang__) && !defined(assert)
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define assert(expr) \
|
#define assert(expr) \
|
||||||
(static_cast<void>(0))
|
(static_cast<void>(0))
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include <RB_INC_SIGNAL_H
|
#include <RB_INC_SIGNAL_H
|
||||||
|
|
||||||
#if defined(IRCD_ASSERT_OVERRIDE) && !defined(RB_ASSERT_INTRINSIC)
|
#if defined(RB_ASSERT) && !defined(RB_ASSERT_INTRINSIC)
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wunreachable-code"
|
#pragma clang diagnostic ignored "-Wunreachable-code"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// copyright notice and this permission notice is present in all copies. The
|
// copyright notice and this permission notice is present in all copies. The
|
||||||
// full license for this software is available in the LICENSE file.
|
// full license for this software is available in the LICENSE file.
|
||||||
|
|
||||||
#include <util/params.h>
|
#include <ircd/util/params.h>
|
||||||
|
|
||||||
using namespace ircd;
|
using namespace ircd;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue