diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b4c626730840da26c10482c3b0c969119fc5b47e..3da47c45e3a9b08f5d230f16b446bc02f571b3e4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -169,7 +169,8 @@ default: - ./00boot # we use xargs here in case CONFIGURE_FLAGS contains # variables with spaces, etc etc - - xargs ./configure ${ENABLE_NIGHTLY} <<< ${CONFIGURE_FLAGS} + - DEFAULT_CONFIGURE_FLAGS="--enable-strict-defs ${ENABLE_NIGHTLY}" + - xargs ./configure ${DEFAULT_CONFIGURE_FLAGS} <<< ${CONFIGURE_FLAGS} - make -j${CPU_COUNT} VERBOSE=1 ${MAKE_TARGET:-distcheck} artifacts: # upload some files to debug failures @@ -1698,9 +1699,6 @@ platform:debian:bullseye: "liblal*" "lal*" "python-lal*" - # don't use NDEBUG - - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - - export CONFIGURE_FLAGS="${CONFIGURE_FLAGS} CPPFLAGS='${CPPFLAGS}'" platform:conda:linux: image: igwn/base:conda diff --git a/gnuscripts/lalsuite_build.m4 b/gnuscripts/lalsuite_build.m4 index ae17aaa27d6cb3145009ee058729cca0b92c22ca..be00f2b68161a5070f4abf2d9a872780ffc04ef3 100644 --- a/gnuscripts/lalsuite_build.m4 +++ b/gnuscripts/lalsuite_build.m4 @@ -1,7 +1,7 @@ # -*- mode: autoconf; -*- # lalsuite_build.m4 - top level build macros # -# serial 168 +# serial 169 # restrict which LALSUITE_... patterns can appearing in output (./configure); # useful for debugging problems with unexpanded LALSUITE_... Autoconf macros @@ -360,6 +360,25 @@ AC_DEFUN([LALSUITE_ADD_TESTS_ENV_CONFIG_VAR],[ ]) ]) +AC_DEFUN([LALSUITE_ENABLE_STRICT_DEFS],[ + # $0: forbid certain definitions in LAL code + AC_ARG_ENABLE( + [strict-defs], + AS_HELP_STRING( + [--enable-strict-defs], + [forbid certain definitions in LAL code [default=no]] + ),[ + AS_CASE(["${enableval}"], + [yes],[LALSUITE_ADD_FLAGS([C],[-DLAL_STRICT_DEFS_ENABLED])], + [no],[:], + [AC_MSG_ERROR([bad value for ${enableval} for --enable-strict-defs])] + ) + ],[ + ] + ) + # end $0 +]) + AC_DEFUN([LALSUITE_REQUIRE_CXX],[ # $0: require a C++ compiler lalsuite_require_cxx=true diff --git a/gnuscripts/lalsuite_swig.m4 b/gnuscripts/lalsuite_swig.m4 index 08d65338842710e5ac261bcc155a29ebe3749855..83d91deeb9d33632a6a535d3e23a515e4c679ec7 100644 --- a/gnuscripts/lalsuite_swig.m4 +++ b/gnuscripts/lalsuite_swig.m4 @@ -2,7 +2,7 @@ # lalsuite_swig.m4 - SWIG configuration # Author: Karl Wette, 2011--2017 # -# serial 113 +# serial 115 AC_DEFUN([_LALSUITE_MIN_SWIG_VERSION],[ # $0: minimum version of SWIG and other dependencies @@ -464,7 +464,7 @@ EOF AC_MSG_NOTICE([Octave modules will be compiled with ${abiflag:-no _GLIBCXX_USE_CXX11_ABI flag}]) # determine Octave preprocessor flags - AC_SUBST([SWIG_OCTAVE_CPPFLAGS],["${abiflag}"]) + AC_SUBST([SWIG_OCTAVE_CPPFLAGS],["-ULAL_STRICT_DEFS_ENABLED ${abiflag}"]) AC_SUBST([SWIG_OCTAVE_CPPFLAGS_IOCTAVE],[]) for arg in CPPFLAGS INCFLAGS; do for flag in `${mkoctfile} -p ${arg} 2>/dev/null`; do @@ -584,7 +584,7 @@ EOD`] ]) # determine Python preprocessor flags - AC_SUBST([SWIG_PYTHON_CPPFLAGS],[]) + AC_SUBST([SWIG_PYTHON_CPPFLAGS],["-ULAL_STRICT_DEFS_ENABLED"]) python_out=[`cat </dev/null import sys import distutils.sysconfig as cfg @@ -606,7 +606,7 @@ EOD`] import sys import distutils.sysconfig as cfg cflags = cfg.get_config_var('CFLAGS').split() -cflags = [f for f in cflags if f != '-DNDEBUG'] +cflags = [f for f in cflags] sys.stdout.write(" ".join(cflags)) EOD`] AS_IF([test $? -ne 0],[ diff --git a/lal/conda/build.sh b/lal/conda/build.sh index 738017c6f349ce4781d85586819ec135d680c721..6db88f8a9b4d05692702418a4d727808afffa953 100644 --- a/lal/conda/build.sh +++ b/lal/conda/build.sh @@ -8,9 +8,6 @@ cd _build # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lal/conda/install-python.sh b/lal/conda/install-python.sh index dd205e884cdaaa13aa1048b61f07e247bf5a781f..6f44c1e6b10f20ab6e84b2acc9cdc238122e33cd 100644 --- a/lal/conda/install-python.sh +++ b/lal/conda/install-python.sh @@ -13,9 +13,6 @@ cd ${_builddir} # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lal/configure.ac b/lal/configure.ac index c7ed9d6d80a561912eec4d9ad686f585c9455dba..93f70fae43eec5521ed7bad2e8d8efa698f1ff75 100644 --- a/lal/configure.ac +++ b/lal/configure.ac @@ -133,6 +133,7 @@ LAL_ENABLE_INTELFFT LAL_ENABLE_FFTW3_MEMALIGN LALSUITE_ENABLE_GCC_FLAGS +LALSUITE_ENABLE_STRICT_DEFS LAL_WITH_DEFAULT_DEBUG_LEVEL LAL_WITH_DATA_PATH diff --git a/lal/lib/factories/CreateArraySequence_source.c b/lal/lib/factories/CreateArraySequence_source.c index 3ef0a15fee9d3fe455a2508749e45ef87b77271a..2f487e11f3db6f7ee74612f9d3459fbfa3926f6f 100644 --- a/lal/lib/factories/CreateArraySequence_source.c +++ b/lal/lib/factories/CreateArraySequence_source.c @@ -41,13 +41,11 @@ void FUNC ( LALStatus *status, STYPE **aseq, CreateArraySequenceIn *in ) * Use of unsigned for length means we can't check if negative * length was passed */ -#ifndef NDEBUG for ( i = 0; i < in->dimLength->length; i++ ) { ASSERT (in->dimLength->data[i] > 0, status, SEQFACTORIESH_EALENGTH, SEQFACTORIESH_MSGEALENGTH); } -#endif /* * Check return structure: If return pointer does not point to a diff --git a/lal/lib/std/LALStatusMacros.dox b/lal/lib/std/LALStatusMacros.dox index 8fe52639706086e69db257779bd5da2c12486483..9b10f3959bda918b5e81631664fe3a0d3c7d5c28 100644 --- a/lal/lib/std/LALStatusMacros.dox +++ b/lal/lib/std/LALStatusMacros.dox @@ -493,19 +493,25 @@ code at compile time. Although these flags are typically \#defined or \#undefined globally and can affect many modules, their primary effect is on the debugging and status-reporting tools defined in this header. The two flags are named -\c NDEBUG and \c LAL_STATUS_MACROS_DISABLED. +\c LAL_ASSERT_MACRO_DISABLED and \c LAL_STATUS_MACROS_DISABLED. -\subsection ss_ndebug_flag The NDEBUG flag +\subsection ss_ndebug_flag The LAL_ASSERT_MACRO_DISABLED flag -Compiling with the \c NDEBUG flag set removes all ASSERT() macros from -the object code, in keeping with the philosophy that ASSERT() -statements should only be used to catch coding bugs, not runtime errors. +Compiling with the \c LAL_ASSERT_MACRO_DISABLED flag set removes all +ASSERT() macros from the object code, in keeping with the philosophy +that ASSERT() statements should only be used to catch coding bugs, not +runtime errors. -This is the only purpose for which the \c NDEBUG flag should be used. Code that -checks function input arguments for correctness, reports error messages, -etc. should not be disabled even in production code. The performance impact of -such checks is likely minimal, particularly compared to the human cost of -diagnosing obscure failures in production code because checks/error messages +Compiling with \c LAL_ASSERT_MACRO_DISABLED set is not +recommended. Notwithstanding the philosophy behind ASSERT(), it is +quite likely in places that this macro has been (mis)used for critical checks +without which code will not operate as expected. Correct function with \c +LAL_ASSERT_MACRO_DISABLED set is therefore not guaranteed. + +Code that checks function input arguments for correctness, reports error +messages, etc. should not be disabled even in production code. The performance +impact of such checks is likely minimal, particularly compared to the human cost +of diagnosing obscure failures in production code because checks/error messages were disabled. (Error messages and other diagnostics should use the error-printing functions in \ref LALError_h to selective print messages according to \c lalDebugLevel.) @@ -534,7 +540,7 @@ libraries. When compiling your own modules, the flags can be set using one or more \#define statements within the module or its header file: \code -#define NDEBUG +#define LAL_ASSERT_MACRO_DISABLED #define LAL_STATUS_MACROS_DISABLED \endcode To restrict the scope of these flags, they should later be unset using @@ -544,22 +550,22 @@ Alternatively, these can be set in the \c Makefile or when compiling. The syntax for most UNIX C compilers is something like the following: \code -> gcc ... -DNDEBUG -DLAL_STATUS_MACROS_DISABLED ... +> gcc ... -DLAL_ASSERT_MACRO_DISABLED -DLAL_STATUS_MACROS_DISABLED ... \endcode -If you want to compile a large number of modules, or the entire -library, under the effects of one or more of these flags, you will not -want to go through and modify every header or \c Makefile. -Instead, you may add either -DNDEBUG or -DLAL_STATUS_MACROS_DISABLED -(or both) to the environment variable \c CPPFLAGS. They will then -automatically be set for all compilations done in that environment. -The command for doing this in \c sh or \c bash shells is: +If you want to compile a large number of modules, or the entire library, under +the effects of one or more of these flags, you will not want to go through and +modify every header or \c Makefile. Instead, you may add either +-DLAL_ASSERT_MACRO_DISABLED or -DLAL_STATUS_MACROS_DISABLED +(or both) to the environment variable \c CPPFLAGS. They will then automatically +be set for all compilations done in that environment. The command for doing +this in \c sh or \c bash shells is: \code -> CPPFLAGS="\f$CPPFLAGS -DNDEBUG -DLAL_STATUS_MACROS_DISABLED" +> CPPFLAGS="\f$CPPFLAGS -DLAL_ASSERT_MACRO_DISABLED -DLAL_STATUS_MACROS_DISABLED" \endcode while in \c csh or \c tcsh shells it is: \code -> setenv CPPFLAGS "\f$CPPFLAGS -DNDEBUG -DLAL_STATUS_MACROS_DISABLED" +> setenv CPPFLAGS "\f$CPPFLAGS -DLAL_ASSERT_MACRO_DISABLED -DLAL_STATUS_MACROS_DISABLED" \endcode Note that if you plan to do further LAL code development on the same system, you may want to keep two versions of the library around: one diff --git a/lal/lib/std/LALStatusMacros.h b/lal/lib/std/LALStatusMacros.h index cae109a9bfad189a545126069b82bc182bc60449..117f31b5a4a44395141fa826747329a90dc4adff 100644 --- a/lal/lib/std/LALStatusMacros.h +++ b/lal/lib/std/LALStatusMacros.h @@ -113,7 +113,7 @@ extern "C" { return; \ } while ( 0 ) -#ifdef NDEBUG +#ifdef LAL_ASSERT_MACRO_DISABLED #define ASSERT( assertion, statusptr, code, mesg ) #else #define ASSERT( assertion, statusptr, code, mesg ) \ @@ -192,7 +192,7 @@ extern "C" { #define ABORT( statusptr, code, mesg ) \ do { if ( LALPrepareAbort( statusptr, code, mesg, __FILE__, __LINE__ ), 1 ) return; } while ( 0 ) -#ifdef NDEBUG +#ifdef LAL_ASSERT_MACRO_DISABLED #define ASSERT( assertion, statusptr, code, mesg ) #else #define ASSERT( assertion, statusptr, code, mesg ) \ diff --git a/lal/lib/std/LALStddef.h b/lal/lib/std/LALStddef.h index fe7483ce1fc60d1bbb1784c9e1388a0473dcb47a..5fd27ae5781f4e7ee933964f86307aae09e7ef9b 100644 --- a/lal/lib/std/LALStddef.h +++ b/lal/lib/std/LALStddef.h @@ -1,5 +1,5 @@ /* -* Copyright (C) 2014 Karl Wette +* Copyright (C) 2014, 2020 Karl Wette * Copyright (C) 2013 Jolien Creighton * * This program is free software; you can redistribute it and/or modify @@ -21,6 +21,15 @@ #ifndef _LALSTDDEF_H #define _LALSTDDEF_H +/* forbid certain definitions in LAL code */ +#if defined(LAL_STRICT_DEFS_ENABLED) +# if defined(__GNUC__) +/* assert() is often misused for error-checking code + which should never be disabled in production usage */ +# pragma GCC poison assert +# endif +#endif + /* macros for certain keywords */ #if __STDC_VERSION__ >= 199901L # define _LAL_RESTRICT_ restrict diff --git a/lal/lib/std/XLALError.h b/lal/lib/std/XLALError.h index 522eceae3876e3fae0717543313431fd9da4b9fd..5b0c0f03cf549f2f53d8adaf5ec7c4eabc6090d5 100644 --- a/lal/lib/std/XLALError.h +++ b/lal/lib/std/XLALError.h @@ -74,8 +74,7 @@ extern "C" { * * Assert-like error checking can be performed with #XLAL_CHECK-style * macros. Unlike assert() statements, #XLAL_CHECK macros - * do not get removed when the code is not compiled with - * NDEBUG defined. + * do not get removed when the code is compiled with -DNDEBUG. * * Additional error, warning, and informational messages can be generated using * the routines XLALPrintError(), XLALPrintWarning() and @@ -900,6 +899,42 @@ void XLALError(const char *func, */ #define XLAL_CHECK_FAIL(assertion, ...) _XLAL_CHECK_IMPL_(goto XLAL_FAIL, assertion, __VA_ARGS__) +/** + * \brief Macro to test an assertion and invoke a failure if it is not true + * by calling lalAbortHook(). + * + * Prototype: XLAL_CHECK_ABORT(assertion) + * + * \b Parameters: + */ +#define XLAL_CHECK_ABORT(assertion) \ + do { \ + if (!(assertion)) { \ + XLAL_PRINT_ERROR("Check failed: %s", #assertion); \ + lalAbortHook("XLAL_CHECK_ABORT() failed"); \ + } \ + } while (0) + +/** + * \brief Macro to test an assertion and invoke a failure if it is not true + * by calling exit(1). + * + * Prototype: XLAL_CHECK_EXIT(assertion) + * + * \b Parameters: + */ +#define XLAL_CHECK_EXIT(assertion) \ + do { \ + if (!(assertion)) { \ + XLAL_PRINT_ERROR("Check failed: %s", #assertion); \ + exit(1); \ + } \ + } while (0) + #endif /* SWIG */ diff --git a/lal/lib/utilities/FindRoot.c b/lal/lib/utilities/FindRoot.c index 4eaea85b045c355d2ed806a955653219ccad6892..f70ca060299a224f09ac120e4885c40f0d9d8642 100644 --- a/lal/lib/utilities/FindRoot.c +++ b/lal/lib/utilities/FindRoot.c @@ -66,10 +66,8 @@ LALSBracketRoot ( } /* increment iteration count */ -#ifndef NDEBUG - INT4 imax = 64; + const INT4 imax = 64; ASSERT (i < imax, status, FINDROOTH_EMXIT, FINDROOTH_MSGEMXIT); -#endif ++i; if (fabs(y_1) < fabs(y_2)) @@ -186,10 +184,8 @@ LALDBracketRoot ( } /* increment iteration count */ -#ifndef NDEBUG - INT4 imax = 64; + const INT4 imax = 64; ASSERT (i < imax, status, FINDROOTH_EMXIT, FINDROOTH_MSGEMXIT); -#endif ++i; if (fabs(y_1) < fabs(y_2)) @@ -269,10 +265,8 @@ LALSBisectionFindRoot ( REAL4 ymid; /* increment iteration count */ -#ifndef NDEBUG - INT4 imax = 40; + const INT4 imax = 40; ASSERT (i < imax, status, FINDROOTH_EMXIT, FINDROOTH_MSGEMXIT); -#endif ++i; /* locate midpoint of domain */ @@ -437,10 +431,8 @@ LALDBisectionFindRoot ( REAL8 ymid; /* increment iteration count */ -#ifndef NDEBUG - INT4 imax = 80; + const INT4 imax = 80; ASSERT (i < imax, status, FINDROOTH_EMXIT, FINDROOTH_MSGEMXIT); -#endif ++i; /* locate midpoint of domain */ diff --git a/lal/lib/vectorops/VectorMath_sse_mathfun_test.c b/lal/lib/vectorops/VectorMath_sse_mathfun_test.c index 64a37b211301364b02b9015e2a8c8edc5718d5d1..9a94db1eea752a801bf3de2d84688ee6bcbe1a4c 100644 --- a/lal/lib/vectorops/VectorMath_sse_mathfun_test.c +++ b/lal/lib/vectorops/VectorMath_sse_mathfun_test.c @@ -137,7 +137,6 @@ void print4i(__m128i v) { #include #include #include -#include #ifdef HAVE_SYS_TIMES #include diff --git a/lalapps/conda/build.sh b/lalapps/conda/build.sh index 9905eab6e18f7c8ca136883e537abab2545e2164..0c5023f40f5c055b9a0a1a5a852b2fbf4b2213bd 100644 --- a/lalapps/conda/build.sh +++ b/lalapps/conda/build.sh @@ -8,9 +8,6 @@ cd _build # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalapps/configure.ac b/lalapps/configure.ac index 98017f862f04db68df99dcc34d9258a7820ced74..98ca928ecf05ad7fae1f4d47988d84d20122e8ce 100644 --- a/lalapps/configure.ac +++ b/lalapps/configure.ac @@ -73,6 +73,7 @@ LALSUITE_CHECK_GIT_REPO LALSUITE_DISTCHECK_CONFIGURE_FLAGS LALSUITE_ENABLE_GCC_FLAGS +LALSUITE_ENABLE_STRICT_DEFS LALSUITE_ENABLE_NIGHTLY LALAPPS_ENABLE_CONDOR LALAPPS_ENABLE_STATIC_BINARIES diff --git a/lalapps/src/inspiral/blindinj.c b/lalapps/src/inspiral/blindinj.c index 5c576fd567451ca8b3883d17a30651d1b657661e..f049b42e3ada2760b0983475ec7a4dd149a4609c 100644 --- a/lalapps/src/inspiral/blindinj.c +++ b/lalapps/src/inspiral/blindinj.c @@ -33,7 +33,6 @@ #include #include -#include #include #include #include diff --git a/lalapps/src/inspiral/crinj.c b/lalapps/src/inspiral/crinj.c index 670a7ebce4c1bec2a905d90a33dd817db8117874..c8a1464ba9c6b83b2e40f4a078df83fb39b46586 100644 --- a/lalapps/src/inspiral/crinj.c +++ b/lalapps/src/inspiral/crinj.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include diff --git a/lalapps/src/inspiral/inspxmlinj.c b/lalapps/src/inspiral/inspxmlinj.c index 47a87880ee775a3a05bbce06e9386444ea4c859a..cb385baa567cf237c03fd8f9ec74623e8120c11b 100644 --- a/lalapps/src/inspiral/inspxmlinj.c +++ b/lalapps/src/inspiral/inspxmlinj.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/lalapps/src/inspiral/spininj.c b/lalapps/src/inspiral/spininj.c index d64d5a2ab8fe774a638657269559be24239f1fba..0553ba1d5a193870b0fd76e8a54a42d38464a006 100644 --- a/lalapps/src/inspiral/spininj.c +++ b/lalapps/src/inspiral/spininj.c @@ -29,7 +29,6 @@ #include #include -#include #include #include #include diff --git a/lalburst/conda/build.sh b/lalburst/conda/build.sh index 2a6c45d253d2dff401776f5882535c344972ec83..f2aac0f5d35d3515f9538ea1d8cc176b2549c4c6 100644 --- a/lalburst/conda/build.sh +++ b/lalburst/conda/build.sh @@ -8,9 +8,6 @@ cd _build # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalburst/conda/install-python.sh b/lalburst/conda/install-python.sh index 07960c418ebeafaa681715921324a30713242390..9bf2c0c24c3acdae1bb7bf326b0e44ec1ad37e54 100644 --- a/lalburst/conda/install-python.sh +++ b/lalburst/conda/install-python.sh @@ -13,9 +13,6 @@ cd ${_builddir} # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalburst/configure.ac b/lalburst/configure.ac index f73e35d544b53dacbdf457a9b85bf502877558b1..fa4afde5103963802bafa9f0b0b7c1ac53ea64bd 100644 --- a/lalburst/configure.ac +++ b/lalburst/configure.ac @@ -90,6 +90,9 @@ LALSUITE_ENABLE_NIGHTLY # enable strict gcc flags LALSUITE_ENABLE_GCC_FLAGS +# enable strict definitions +LALSUITE_ENABLE_STRICT_DEFS + # enable SWIG wrapping modules LALSUITE_ENABLE_SWIG diff --git a/lalframe/conda/build.sh b/lalframe/conda/build.sh index a19ea235c803ffc8bf27218a25d7e91ff8051e89..76965f28b1f53dc39270cd6070c3c537edf1346b 100644 --- a/lalframe/conda/build.sh +++ b/lalframe/conda/build.sh @@ -8,9 +8,6 @@ cd _build # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalframe/conda/install-python.sh b/lalframe/conda/install-python.sh index daf791b9dcab2d26ffa5eacad7057307898ea427..3361d3de73ed518bcb70e7dcc141f9c1764a2e2d 100644 --- a/lalframe/conda/install-python.sh +++ b/lalframe/conda/install-python.sh @@ -13,9 +13,6 @@ cd ${_builddir} # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalframe/configure.ac b/lalframe/configure.ac index 25584fe9cab83e3a377c97521615cbe411fac8a0..43080464a02ab56bcc6cdf85b1261938c509a51d 100644 --- a/lalframe/configure.ac +++ b/lalframe/configure.ac @@ -95,6 +95,9 @@ LALFRAME_ENABLE_FRAMEL # enable strict gcc flags LALSUITE_ENABLE_GCC_FLAGS +# enable strict definitions +LALSUITE_ENABLE_STRICT_DEFS + # enable SWIG wrapping modules LALSUITE_ENABLE_SWIG diff --git a/lalinference/conda/build.sh b/lalinference/conda/build.sh index a3133a63b30ba2401db6aea4df5e42531b20d221..dc0d62a94cd9c8517331a17023a75320eb24a235 100644 --- a/lalinference/conda/build.sh +++ b/lalinference/conda/build.sh @@ -8,9 +8,6 @@ cd _build # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalinference/conda/install-bin.sh b/lalinference/conda/install-bin.sh index a5cc14256c8374503e4b2597cea87d0998e9b435..162f46e8feefcaca8912f3653873d7f10447b7e3 100644 --- a/lalinference/conda/install-bin.sh +++ b/lalinference/conda/install-bin.sh @@ -9,9 +9,6 @@ cd ${_builddir} # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalinference/conda/install-python.sh b/lalinference/conda/install-python.sh index 07960c418ebeafaa681715921324a30713242390..9bf2c0c24c3acdae1bb7bf326b0e44ec1ad37e54 100755 --- a/lalinference/conda/install-python.sh +++ b/lalinference/conda/install-python.sh @@ -13,9 +13,6 @@ cd ${_builddir} # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalinference/configure.ac b/lalinference/configure.ac index fe763bd420603a7f01f53ebc399dc8f37570a297..02570c933e58ca86a9c60a34177435c5d45e924c 100644 --- a/lalinference/configure.ac +++ b/lalinference/configure.ac @@ -108,6 +108,9 @@ LALSUITE_ENABLE_MPI # enable strict gcc flags LALSUITE_ENABLE_GCC_FLAGS +# enable strict definitions +LALSUITE_ENABLE_STRICT_DEFS + # optional lal libraries LALSUITE_ENABLE_LALFRAME LALSUITE_ENABLE_LALMETAIO diff --git a/lalinference/lib/LALInferenceHDF5.c b/lalinference/lib/LALInferenceHDF5.c index db69b834404c3ac9eef17a18eeda03115b471401..5411c94728500f0a627e89dc0778f371fda01771 100644 --- a/lalinference/lib/LALInferenceHDF5.c +++ b/lalinference/lib/LALInferenceHDF5.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -116,9 +115,9 @@ int LALInferenceH5DatasetToVariablesArray( size_t nbytes = XLALH5DatasetQueryNBytes(dataset); char *data = XLALMalloc(nbytes); - assert(data); + XLAL_CHECK_ABORT(data); ret = XLALH5DatasetQueryData(data, dataset); - assert(ret == 0); + XLAL_CHECK_ABORT(ret == 0); LALInferenceVariables **va = NULL; UINT4 Nsamples = XLALH5DatasetQueryNPoints(dataset); @@ -133,7 +132,7 @@ int LALInferenceH5DatasetToVariablesArray( snprintf(pname, sizeof(pname), "FIELD_%d_VARY", i); INT4 value; ret = XLALH5AttributeQueryScalarValue(&value, gdataset, pname); - assert(ret == 0); + XLAL_CHECK_ABORT(ret == 0); vary[i] = value; } @@ -276,7 +275,7 @@ int LALInferenceH5VariablesArrayToDataset( /* Gather together data in one big array */ char *data = XLALCalloc(N, type_size); - assert(data); + XLAL_CHECK_ABORT(data); for (UINT4 i = 0; i < N; i++) { for (UINT4 j = 0; j < Nvary; j++) @@ -290,11 +289,11 @@ int LALInferenceH5VariablesArrayToDataset( /* Create table */ LALH5Dataset *dataset = XLALH5TableAlloc(h5file, TableName, Nvary, column_names, column_types, column_offsets, type_size); - assert(dataset); + XLAL_CHECK_ABORT(dataset); int ret = XLALH5TableAppend( dataset, column_offsets, column_sizes, N, type_size, data); (void) ret; - assert(ret == 0); + XLAL_CHECK_ABORT(ret == 0); XLALFree(data); LALH5Generic gdataset = {.dset = dataset}; @@ -305,7 +304,7 @@ int LALInferenceH5VariablesArrayToDataset( snprintf(pname, sizeof(pname), "FIELD_%d_VARY", i); ret = XLALH5AttributeAddScalar( gdataset, pname, &value, LAL_I4_TYPE_CODE); - assert(ret == 0); + XLAL_CHECK_ABORT(ret == 0); } /* Write attributes, if any */ diff --git a/lalinference/lib/LALInferenceInitCBC.c b/lalinference/lib/LALInferenceInitCBC.c index afd094bd081fdf42d9bbe299a784d4a1ab889bca..4872c405ec704b350631243cc1d1079abd482f75 100644 --- a/lalinference/lib/LALInferenceInitCBC.c +++ b/lalinference/lib/LALInferenceInitCBC.c @@ -21,7 +21,6 @@ #include -#include #include #include #include @@ -654,7 +653,7 @@ void LALInferenceRegisterGaussianVariableREAL8(LALInferenceRunState *state, LALI } if((ppt=LALInferenceGetProcParamVal(state->commandLine,valopt))) startval=atof(ppt->value); - assert(stdev>0); + XLAL_CHECK_ABORT(stdev>0); LALInferenceAddVariable(var,name,&startval,LALINFERENCE_REAL8_t,varytype); LALInferenceAddGaussianPrior(state->priorArgs, name, &mean, &stdev, LALINFERENCE_REAL8_t); diff --git a/lalinference/lib/LALInferenceLikelihood.c b/lalinference/lib/LALInferenceLikelihood.c index 05037179f758ad6fe8e622850598f024921865e8..5d5e44f943a5e4399c0871763b13a496896e1f56 100644 --- a/lalinference/lib/LALInferenceLikelihood.c +++ b/lalinference/lib/LALInferenceLikelihood.c @@ -22,7 +22,6 @@ */ #include -#include #include #include #include @@ -83,9 +82,9 @@ static int get_calib_spline(LALInferenceVariables *vars, const char *ifoname, RE if(!*logfreqs) *logfreqs = XLALCreateREAL8Vector(npts); if(!*amps) *amps = XLALCreateREAL8Vector(npts); if(!*phases) *phases = XLALCreateREAL8Vector(npts); - assert((*logfreqs)->length==npts); - assert((*amps)->length==npts); - assert((*phases)->length==npts); + XLAL_CHECK_ABORT((*logfreqs)->length==npts); + XLAL_CHECK_ABORT((*amps)->length==npts); + XLAL_CHECK_ABORT((*phases)->length==npts); for(UINT4 i=0;i #include -#include struct fvec { REAL8 f; diff --git a/lalinference/lib/distance_integrator.c b/lalinference/lib/distance_integrator.c index c87e0d9854b1083c3d375b4197e4cbd8fa33ac2c..efaabd38ea57cde8099404c945157d72aaa11e90 100644 --- a/lalinference/lib/distance_integrator.c +++ b/lalinference/lib/distance_integrator.c @@ -20,8 +20,6 @@ #include "bayestar_cosmology.h" #include "omp_interruptible.h" -#include - #include #include @@ -72,13 +70,13 @@ void dVC_dVL_init(void) { const size_t len = sizeof(dVC_dVL_data) / sizeof(*dVC_dVL_data); dVC_dVL_interp = gsl_spline_alloc(gsl_interp_cspline, len); - assert(dVC_dVL_interp); + XLAL_CHECK_ABORT(dVC_dVL_interp); double x[len]; for (size_t i = 0; i < len; i ++) x[i] = dVC_dVL_tmin + i * dVC_dVL_dt; int ret = gsl_spline_init(dVC_dVL_interp, x, dVC_dVL_data, len); (void) ret; - assert(ret == GSL_SUCCESS); + XLAL_CHECK_ABORT(ret == GSL_SUCCESS); } static double radial_integrand(double r, void *params) @@ -286,12 +284,12 @@ log_radial_integrator *log_radial_integrator_init(double r1, double r2, int k, i double *z1=calloc(size,sizeof(*z1)); double *z2=calloc(size,sizeof(*z2)); double *z0=calloc(size*size,sizeof(*z0)); - assert(z0 && z1 && z2); + XLAL_CHECK_ABORT(z0 && z1 && z2); /* for (size_t i=0;ixmax); + XLAL_CHECK_ABORT(x <= integrator->xmax); if (p == 0) { /* note: p2 == 0 implies b == 0 */ - assert(b == 0); + XLAL_CHECK_ABORT(b == 0); int k1 = integrator->k + 1; if (k1 == 0) diff --git a/lalinference/test/LALInferencePriorTest.c b/lalinference/test/LALInferencePriorTest.c index c73fc84b343924564b416aa73c25910a6b723dac..e71fc05191e102783230ef472908d2ff0ac007f4 100644 --- a/lalinference/test/LALInferencePriorTest.c +++ b/lalinference/test/LALInferencePriorTest.c @@ -25,7 +25,6 @@ #include #include #include -#include #include "LALInferenceTest.h" #define EPSILON 1e-13 diff --git a/lalinference/test/test_cubic_interp.c b/lalinference/test/test_cubic_interp.c index 078f31033d00db452630d175e1efcbe9777b4fd2..46550c84ab9e2773c97a8cf7bcf7b19f1286a1e4 100644 --- a/lalinference/test/test_cubic_interp.c +++ b/lalinference/test/test_cubic_interp.c @@ -21,8 +21,8 @@ #include #include #include -#include +#include #ifdef __GNUC__ #define UNUSED __attribute__ ((unused)) @@ -36,7 +36,7 @@ int main(int UNUSED argc, char UNUSED **argv) { static const double data[] = {0, 0, 0, 0}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0; t <= 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -50,7 +50,7 @@ int main(int UNUSED argc, char UNUSED **argv) { static const double data[] = {1, 1, 1, 1}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0; t <= 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -64,7 +64,7 @@ int main(int UNUSED argc, char UNUSED **argv) { static const double data[] = {1, 0, 1, 4}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0; t <= 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -79,7 +79,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { GSL_POSINF, GSL_POSINF, GSL_POSINF, GSL_POSINF}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0; t <= 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -94,7 +94,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { 0, GSL_POSINF, GSL_POSINF, GSL_POSINF}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0; t <= 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -109,7 +109,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { GSL_POSINF, GSL_POSINF, GSL_POSINF, 0}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0; t <= 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -124,7 +124,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { 0, GSL_POSINF, GSL_POSINF, 0}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0; t <= 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -139,7 +139,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { 0, 0, GSL_POSINF, 0}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0.01; t <= 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -154,7 +154,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { 0, GSL_NEGINF, GSL_POSINF, 0}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); const double result = cubic_interp_eval(interp, 1); cubic_interp_free(interp); const double expected = GSL_POSINF; @@ -166,7 +166,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { 0, GSL_POSINF, GSL_NEGINF, 0}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); const double result = cubic_interp_eval(interp, 0); cubic_interp_free(interp); const double expected = GSL_POSINF; @@ -178,7 +178,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { 0, GSL_NEGINF, GSL_NEGINF, GSL_NEGINF}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0; t <= 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -193,7 +193,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { GSL_NEGINF, GSL_NEGINF, GSL_NEGINF, 0}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0; t <= 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -208,7 +208,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { 0, GSL_NEGINF, GSL_NEGINF, 0}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0; t <= 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -223,7 +223,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { 0, 0, GSL_NEGINF, 0}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0.01; t <= 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -238,7 +238,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { 0, GSL_NEGINF, GSL_POSINF, 0}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); const double result = cubic_interp_eval(interp, 0); cubic_interp_free(interp); const double expected = GSL_NEGINF; @@ -250,7 +250,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { 0, GSL_POSINF, GSL_NEGINF, 0}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); const double result = cubic_interp_eval(interp, 1); cubic_interp_free(interp); const double expected = GSL_NEGINF; @@ -262,7 +262,7 @@ int main(int UNUSED argc, char UNUSED **argv) static const double data[] = { 0, GSL_NEGINF, GSL_POSINF, 0}; cubic_interp *interp = cubic_interp_init(data, 4, -1, 1); - assert(interp); + XLAL_CHECK_EXIT(interp); for (double t = 0.01; t < 1; t += 0.01) { const double result = cubic_interp_eval(interp, t); @@ -296,7 +296,7 @@ int main(int UNUSED argc, char UNUSED **argv) constants[k]); } } - assert(interp); + XLAL_CHECK_EXIT(interp); bicubic_interp_free(interp); } } @@ -320,7 +320,7 @@ int main(int UNUSED argc, char UNUSED **argv) "testing bicubic interpolant for s^%d input", k); } } - assert(interp); + XLAL_CHECK_EXIT(interp); bicubic_interp_free(interp); } @@ -341,7 +341,7 @@ int main(int UNUSED argc, char UNUSED **argv) "testing bicubic interpolant for t^%d input", k); } } - assert(interp); + XLAL_CHECK_EXIT(interp); bicubic_interp_free(interp); } @@ -364,7 +364,7 @@ int main(int UNUSED argc, char UNUSED **argv) k, k); } } - assert(interp); + XLAL_CHECK_EXIT(interp); bicubic_interp_free(interp); } } diff --git a/lalinspiral/conda/build.sh b/lalinspiral/conda/build.sh index 2a6c45d253d2dff401776f5882535c344972ec83..f2aac0f5d35d3515f9538ea1d8cc176b2549c4c6 100644 --- a/lalinspiral/conda/build.sh +++ b/lalinspiral/conda/build.sh @@ -8,9 +8,6 @@ cd _build # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalinspiral/conda/install-python.sh b/lalinspiral/conda/install-python.sh index 07960c418ebeafaa681715921324a30713242390..9bf2c0c24c3acdae1bb7bf326b0e44ec1ad37e54 100644 --- a/lalinspiral/conda/install-python.sh +++ b/lalinspiral/conda/install-python.sh @@ -13,9 +13,6 @@ cd ${_builddir} # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalinspiral/configure.ac b/lalinspiral/configure.ac index 91dd8c3abe0dc21c7642942864d4b8ba2d7b8000..648ac0f7013175ec32e6f4c3294a12c508b0a54a 100644 --- a/lalinspiral/configure.ac +++ b/lalinspiral/configure.ac @@ -93,6 +93,9 @@ LALSUITE_ENABLE_NIGHTLY # enable strict gcc flags LALSUITE_ENABLE_GCC_FLAGS +# enable strict definitions +LALSUITE_ENABLE_STRICT_DEFS + # enable SWIG wrapping modules LALSUITE_ENABLE_SWIG diff --git a/lalmetaio/conda/build.sh b/lalmetaio/conda/build.sh index a19ea235c803ffc8bf27218a25d7e91ff8051e89..76965f28b1f53dc39270cd6070c3c537edf1346b 100644 --- a/lalmetaio/conda/build.sh +++ b/lalmetaio/conda/build.sh @@ -8,9 +8,6 @@ cd _build # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalmetaio/conda/install-python.sh b/lalmetaio/conda/install-python.sh index daf791b9dcab2d26ffa5eacad7057307898ea427..3361d3de73ed518bcb70e7dcc141f9c1764a2e2d 100644 --- a/lalmetaio/conda/install-python.sh +++ b/lalmetaio/conda/install-python.sh @@ -13,9 +13,6 @@ cd ${_builddir} # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalmetaio/configure.ac b/lalmetaio/configure.ac index efb45d6156f1680cf82128d0822ba1ea5625ee00..dbf14aacf85cb90d2bde5ee31aa54d33eb689e2e 100644 --- a/lalmetaio/configure.ac +++ b/lalmetaio/configure.ac @@ -84,6 +84,9 @@ LALSUITE_ENABLE_NIGHTLY # enable strict gcc flags LALSUITE_ENABLE_GCC_FLAGS +# enable strict definitions +LALSUITE_ENABLE_STRICT_DEFS + # enable SWIG wrapping modules LALSUITE_ENABLE_SWIG diff --git a/lalpulsar/conda/build.sh b/lalpulsar/conda/build.sh index 8b21cb4cd9218fe8271ba3e91f26cf4725eb47cd..35a0890e6ad7247b8ea0c6f4c361bd03ff96589f 100644 --- a/lalpulsar/conda/build.sh +++ b/lalpulsar/conda/build.sh @@ -8,9 +8,6 @@ cd _build # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalpulsar/conda/install-python.sh b/lalpulsar/conda/install-python.sh index dff4015de4dd7fddbb7f2a14ecb5101611321990..e8026a541aa6b62b27b5053da7d3282a1883bda7 100644 --- a/lalpulsar/conda/install-python.sh +++ b/lalpulsar/conda/install-python.sh @@ -13,9 +13,6 @@ cd ${_builddir} # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalpulsar/configure.ac b/lalpulsar/configure.ac index 17d98adcc3cb68b1649785381140466eb553e1c4..9d3d5beff684a943ab431a96b6eccf4b9403adf7 100644 --- a/lalpulsar/configure.ac +++ b/lalpulsar/configure.ac @@ -117,6 +117,9 @@ LALPULSAR_ENABLE_SISTR # enable strict gcc flags LALSUITE_ENABLE_GCC_FLAGS +# enable strict definitions +LALSUITE_ENABLE_STRICT_DEFS + # optional lal libraries LALSUITE_ENABLE_LALFRAME LALSUITE_ENABLE_LALSIMULATION diff --git a/lalsimulation/conda/build.sh b/lalsimulation/conda/build.sh index de10cc3bf23b5c191b43d56e5a49beadbfcadf33..3fd7214160c4e5aa6e22d80a89b05d1fec8ca1b8 100644 --- a/lalsimulation/conda/build.sh +++ b/lalsimulation/conda/build.sh @@ -8,9 +8,6 @@ cd _build # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalsimulation/conda/install-python.sh b/lalsimulation/conda/install-python.sh index 07960c418ebeafaa681715921324a30713242390..9bf2c0c24c3acdae1bb7bf326b0e44ec1ad37e54 100644 --- a/lalsimulation/conda/install-python.sh +++ b/lalsimulation/conda/install-python.sh @@ -13,9 +13,6 @@ cd ${_builddir} # customisation for LALSuite development CI if [[ "${GITLAB_CI}" == "true" ]] && [[ "x${CI_COMMIT_TAG}" == x ]]; then - # allow debugging information - export CPPFLAGS="${CPPFLAGS} -UNDEBUG" - # declare nightly builds if [ "${CI_PIPELINE_SOURCE}" = "schedule" ] || [ "${CI_PIPELINE_SOURCE}" = "web" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-nightly" diff --git a/lalsimulation/configure.ac b/lalsimulation/configure.ac index 26808075ffce53732126cbce6f48a21afbf7d623..bec36f02daf33e6ecf2418b8cd3895a4cb5af5f5 100644 --- a/lalsimulation/configure.ac +++ b/lalsimulation/configure.ac @@ -88,6 +88,9 @@ LALSUITE_ENABLE_NIGHTLY # enable strict gcc flags LALSUITE_ENABLE_GCC_FLAGS +# enable strict definitions +LALSUITE_ENABLE_STRICT_DEFS + # enable SWIG wrapping modules LALSUITE_ENABLE_SWIG diff --git a/lalsimulation/lib/LALSimFindAttachTime.c b/lalsimulation/lib/LALSimFindAttachTime.c index a676029d2178df34cfd29dcf5af29dc7cba7cfb1..740267cc072e8f15d594e1769cb5b7de2079bc2a 100644 --- a/lalsimulation/lib/LALSimFindAttachTime.c +++ b/lalsimulation/lib/LALSimFindAttachTime.c @@ -1,4 +1,3 @@ -#include #include #include #include @@ -42,7 +41,7 @@ double XLALSimLocateOmegaTime( ) { /* check that retLenHi is at least 2 */ - assert( retLenHi > 2 && "retLenHi must be greater than 2" ); + XLAL_CHECK_ABORT( retLenHi > 2 && "retLenHi must be greater than 2" ); *tMaxOmega = 0; //Zach E: Fixes Heisenbug with ICC 16 and 17 compilers (5181); removing this line will result in segfaults with both compilers. /* @@ -83,7 +82,7 @@ double XLALSimLocateOmegaTime( timeHi.data = dynamicsHi->data; double dt = timeHi.data[1] - timeHi.data[0]; - double ddradiusVec[timeHi.length - 1]; + double XLAL_INIT_DECL(ddradiusVec, [timeHi.length - 1]); unsigned int k; for (k = 1; k < timeHi.length-1; k++) { ddradiusVec[k] = (radiusVec->data[k+1] - 2.*radiusVec->data[k] + radiusVec->data[k-1])/dt/dt; @@ -441,11 +440,11 @@ double XLALSimLocateAmplTime( if (debugPK) {debugRD = 0;} double dt = timeHi->data[1] - timeHi->data[0]; - double ddradiusVec[timeHi->length - 1]; + double XLAL_INIT_DECL(ddradiusVec, [timeHi->length - 1]); unsigned int k; /* check that timeHi->length is at least 2 */ - assert( timeHi->length > 2 && "timeHi->length must be greater than 2" ); + XLAL_CHECK_ABORT( timeHi->length > 2 && "timeHi->length must be greater than 2" ); for (k = 1; k < timeHi->length-1; k++) { ddradiusVec[k] = (radiusVec->data[k+1] - 2.*radiusVec->data[k] + radiusVec->data[k-1])/dt/dt; diff --git a/lalsimulation/lib/LALSimIMRPrecessingNRSur.c b/lalsimulation/lib/LALSimIMRPrecessingNRSur.c index cb074828189a7646165cd79d7bf7220f0825d568..fe2ce6d762e47ef00e7dffd9fd7cbc2032dc694d 100644 --- a/lalsimulation/lib/LALSimIMRPrecessingNRSur.c +++ b/lalsimulation/lib/LALSimIMRPrecessingNRSur.c @@ -27,7 +27,6 @@ #define UNUSED #endif -#include #include #include #include @@ -295,12 +294,12 @@ static void PrecessingNRSur_LoadFitData( UNUSED size_t nwritten; nwritten = snprintf(tmp_name, str_size, "%s_coefs", name); - assert(nwritten < str_size); + XLAL_CHECK_ABORT(nwritten < str_size); (*fit_data)->coefs = NULL; ReadHDF5RealVectorDataset(sub, tmp_name, &((*fit_data)->coefs)); nwritten = snprintf(tmp_name, str_size, "%s_bfOrders", name); - assert(nwritten < str_size); + XLAL_CHECK_ABORT(nwritten < str_size); (*fit_data)->basisFunctionOrders = NULL; ReadHDF5LongMatrixDataset(sub, tmp_name, &((*fit_data)->basisFunctionOrders)); @@ -329,7 +328,7 @@ static void NRSur7dq4_LoadVectorFitData( for (size_t i=0; ifit_data[i] = fit_data; diff --git a/lalsimulation/lib/LALSimIMRSEOBNRv4TSurrogate.c b/lalsimulation/lib/LALSimIMRSEOBNRv4TSurrogate.c index 93881afaed7e8a8e745b8d1df673ff438eb5e9f3..7366e543af7db4a01f4d11fe120fc22a4806326b 100644 --- a/lalsimulation/lib/LALSimIMRSEOBNRv4TSurrogate.c +++ b/lalsimulation/lib/LALSimIMRSEOBNRv4TSurrogate.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include @@ -235,7 +234,7 @@ static int TaylorF2Amplitude1PN( UNUSED static void save_gsl_frequency_series(const char filename[], gsl_vector *x, gsl_vector *y) { FILE *fp = fopen(filename, "w"); fprintf(stderr, "save_gsl_frequency_series: %s: %zu %zu\n", filename, x->size, y->size); - assert(x->size == y->size); + XLAL_CHECK_ABORT(x->size == y->size); for (size_t i=0; isize; i++) { fprintf(fp, "%g\t%g\n", gsl_vector_get(x, i), gsl_vector_get(y, i)); } diff --git a/lalsimulation/lib/LALSimNRHybSurUtilities.c b/lalsimulation/lib/LALSimNRHybSurUtilities.c index 5d78af6de1c7d9967980145216b3a9e10cc38e23..fd7a5b8b7de012613ccec1418cfed3769f1c4718 100644 --- a/lalsimulation/lib/LALSimNRHybSurUtilities.c +++ b/lalsimulation/lib/LALSimNRHybSurUtilities.c @@ -37,7 +37,6 @@ #include "LALSimNRHybSurUtilities.h" -#include #include #include #include @@ -164,7 +163,7 @@ static int NRHybSur_LoadDataPiece( for (int i=0; iampl_data_piece, file, sub_grp_name); if(ret != XLAL_SUCCESS) { @@ -300,7 +299,7 @@ static int NRHybSur_LoadSingleModeData( // phase of 22 mode nwritten = snprintf(sub_grp_name, str_size, "l%u_m%u/phase", ell, m); - assert(nwritten < str_size); + XLAL_CHECK_ABORT(nwritten < str_size); ret = NRHybSur_LoadDataPiece(&(data_pieces)->phase_res_data_piece, file, sub_grp_name); if(ret != XLAL_SUCCESS) { @@ -316,7 +315,7 @@ static int NRHybSur_LoadSingleModeData( if (m != 0 || ell % 2 == 0) { // Real part of coorbital frame mode nwritten = snprintf(sub_grp_name, str_size, "l%u_m%u/re", ell, m); - assert(nwritten < str_size); + XLAL_CHECK_ABORT(nwritten < str_size); ret = NRHybSur_LoadDataPiece(&(data_pieces)->coorb_re_data_piece, file, sub_grp_name); if(ret != XLAL_SUCCESS) { @@ -332,7 +331,7 @@ static int NRHybSur_LoadSingleModeData( if (m != 0 || ell % 2 == 1) { // Imaginary part of coorbital frame mode nwritten = snprintf(sub_grp_name, str_size, "l%u_m%u/im", ell, m); - assert(nwritten < str_size); + XLAL_CHECK_ABORT(nwritten < str_size); ret = NRHybSur_LoadDataPiece(&(data_pieces)->coorb_im_data_piece, file, sub_grp_name); if(ret != XLAL_SUCCESS) { diff --git a/lalsimulation/lib/LALSimNRSur3dq8Remnant.c b/lalsimulation/lib/LALSimNRSur3dq8Remnant.c index 25de454c5bce475a9369adb42606faba37266f57..ddcf08a6ee85335faea86165bc103695ef7502d1 100644 --- a/lalsimulation/lib/LALSimNRSur3dq8Remnant.c +++ b/lalsimulation/lib/LALSimNRSur3dq8Remnant.c @@ -64,7 +64,6 @@ #include -#include #include #include #include diff --git a/lalsimulation/lib/LALSimNRSur7dq4Remnant.c b/lalsimulation/lib/LALSimNRSur7dq4Remnant.c index 4213783b33f776d630b8f38adc11a53c5a88c074..bd3c531ec9159adeaa62ded8cfbde742b17cbabb 100644 --- a/lalsimulation/lib/LALSimNRSur7dq4Remnant.c +++ b/lalsimulation/lib/LALSimNRSur7dq4Remnant.c @@ -60,7 +60,6 @@ #include -#include #include #include #include diff --git a/lalsimulation/lib/LALSimNRSurRemnantUtils.c b/lalsimulation/lib/LALSimNRSurRemnantUtils.c index 979181f279e97e40a90a7185a83da4d7485028bc..35d9a3a502c86909ad8e649c7a6c715b3b50e4e6 100644 --- a/lalsimulation/lib/LALSimNRSurRemnantUtils.c +++ b/lalsimulation/lib/LALSimNRSurRemnantUtils.c @@ -36,7 +36,6 @@ #include -#include #include #include #include @@ -220,7 +219,7 @@ int NRSurRemnant_LoadVectorFit( for (UINT4 i=0; i #include #include -#include #include #include #include @@ -99,7 +98,7 @@ static void Test_BHNS_spin_aligned(void) { input_BHNS_spin_aligned[i][2], input_BHNS_spin_aligned[i][3]); print_difference("XLALBHNS_spin_aligned", output, expected_BHNS_spin_aligned[i]); - assert(approximatelyEqual(output, expected_BHNS_spin_aligned[i], TOLERANCE_BHNS_SPIN_ALIGNED)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_BHNS_spin_aligned[i], TOLERANCE_BHNS_SPIN_ALIGNED)); } } @@ -140,7 +139,7 @@ static void Test_BHNS_mass_aligned(void) { input_BHNS_mass_aligned[i][2], input_BHNS_mass_aligned[i][3]); print_difference("XLALBHNS_mass_aligned", output, expected_BHNS_mass_aligned[i]); - assert(approximatelyEqual(output, expected_BHNS_mass_aligned[i], TOLERANCE_BHNS_MASS_ALIGNED)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_BHNS_mass_aligned[i], TOLERANCE_BHNS_MASS_ALIGNED)); } } @@ -195,7 +194,7 @@ static void Test_bbh_final_spin_non_precessing_UIB2016(void) { input_bbh_final_spin_non_precessing_UIB2016[i][2], input_bbh_final_spin_non_precessing_UIB2016[i][3]); print_difference("XLALbbh_final_spin_non_precessing_UIB2016", output, expected_bbh_final_spin_non_precessing_UIB2016[i]); - assert(approximatelyEqual(output, expected_bbh_final_spin_non_precessing_UIB2016[i], TOLERANCE_BBH_FINAL_SPIN_NON_PRECESSING_UIB2016)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_bbh_final_spin_non_precessing_UIB2016[i], TOLERANCE_BBH_FINAL_SPIN_NON_PRECESSING_UIB2016)); } } @@ -250,7 +249,7 @@ static void Test_bbh_final_mass_non_precessing_UIB2016(void) { input_bbh_final_mass_non_precessing_UIB2016[i][2], input_bbh_final_mass_non_precessing_UIB2016[i][3]); print_difference("XLALbbh_final_mass_non_precessing_UIB2016", output, expected_bbh_final_mass_non_precessing_UIB2016[i]); - assert(approximatelyEqual(output, expected_bbh_final_mass_non_precessing_UIB2016[i], TOLERANCE_BBH_FINAL_MASS_NON_PRECESSING_UIB2016)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_bbh_final_mass_non_precessing_UIB2016[i], TOLERANCE_BBH_FINAL_MASS_NON_PRECESSING_UIB2016)); } } diff --git a/lalsimulation/test/NSBHPropertiesTest.c b/lalsimulation/test/NSBHPropertiesTest.c index 141e1048265b6fdd2fd2b4ebdfdc4db756dbb8b1..2f6a91f5e65951d79258747e04c2c2bb93815788 100644 --- a/lalsimulation/test/NSBHPropertiesTest.c +++ b/lalsimulation/test/NSBHPropertiesTest.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -78,7 +77,7 @@ static void Test_fGWinKerr(void) { input_fGWinKerr[i][1], input_fGWinKerr[i][2]); print_difference("XLALSimNSBH_fGWinKerr", output, expected_fGWinKerr[i]); - assert(approximatelyEqual(output, expected_fGWinKerr[i], TOLERANCE_FGWINKERR)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_fGWinKerr[i], TOLERANCE_FGWINKERR)); } } @@ -96,7 +95,7 @@ static void Test_rKerrISCO(void) { double output = XLALSimNSBH_rKerrISCO( input_rKerrISCO[i][0]); print_difference("XLALSimNSBH_rKerrISCO", output, expected_rKerrISCO[i]); - assert(approximatelyEqual(output, expected_rKerrISCO[i], TOLERANCE_RKERRISCO)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_rKerrISCO[i], TOLERANCE_RKERRISCO)); } } @@ -130,7 +129,7 @@ static void Test_xi_tide(void) { input_xi_tide[i][1], input_xi_tide[i][2]); print_difference("XLALSimNSBH_xi_tide", output, expected_xi_tide[i]); - assert(approximatelyEqual(output, expected_xi_tide[i], TOLERANCE_XI_TIDE)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_xi_tide[i], TOLERANCE_XI_TIDE)); } } @@ -155,7 +154,7 @@ static void Test_compactness_from_lambda(void) { double output = XLALSimNSBH_compactness_from_lambda( input_compactness_from_lambda[i][0]); print_difference("XLALSimNSBH_compactness_from_lambda", output, expected_compactness_from_lambda[i]); - assert(approximatelyEqual(output, expected_compactness_from_lambda[i], TOLERANCE_COMPACTNESS_FROM_LAMBDA)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_compactness_from_lambda[i], TOLERANCE_COMPACTNESS_FROM_LAMBDA)); } } @@ -186,7 +185,7 @@ static void Test_torus_mass_fit(void) { input_torus_mass_fit[i][1], input_torus_mass_fit[i][2]); print_difference("XLALSimNSBH_torus_mass_fit", output, expected_torus_mass_fit[i]); - assert(approximatelyEqual(output, expected_torus_mass_fit[i], TOLERANCE_TORUS_MASS_FIT)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_torus_mass_fit[i], TOLERANCE_TORUS_MASS_FIT)); } } diff --git a/lalsimulation/test/PhenomNSBHTest.c b/lalsimulation/test/PhenomNSBHTest.c index 4a0d2245a26aecda61bedd9c56b45772b81cb553..8149812baa6ac81cf518b288103cb09b4d1dd663 100644 --- a/lalsimulation/test/PhenomNSBHTest.c +++ b/lalsimulation/test/PhenomNSBHTest.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -103,7 +102,7 @@ static void Test_x_D(void) { input_x_D[i][2], input_x_D[i][3]); print_difference("XLALSimIMRPhenomNSBH_x_D", output, expected_x_D[i]); - assert(approximatelyEqual(output, expected_x_D[i], TOLERANCE_X_D)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_x_D[i], TOLERANCE_X_D)); } } @@ -151,7 +150,7 @@ static void Test_epsilon_ins_with_torus_mass(void) { input_epsilon_ins_with_torus_mass[i][2], input_epsilon_ins_with_torus_mass[i][3]); print_difference("XLALSimIMRPhenomNSBH_epsilon_ins_with_torus_mass", output, expected_epsilon_ins_with_torus_mass[i]); - assert(approximatelyEqual(output, expected_epsilon_ins_with_torus_mass[i], TOLERANCE_EPSILON_INS_WITH_TORUS_MASS)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_epsilon_ins_with_torus_mass[i], TOLERANCE_EPSILON_INS_WITH_TORUS_MASS)); } } @@ -199,7 +198,7 @@ static void Test_x_D_prime(void) { input_x_D_prime[i][2], input_x_D_prime[i][3]); print_difference("XLALSimIMRPhenomNSBH_x_D_prime", output, expected_x_D_prime[i]); - assert(approximatelyEqual(output, expected_x_D_prime[i], TOLERANCE_X_D_PRIME)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_x_D_prime[i], TOLERANCE_X_D_PRIME)); } } @@ -247,7 +246,7 @@ static void Test_sigma_tide_with_torus_mass(void) { input_sigma_tide_with_torus_mass[i][2], input_sigma_tide_with_torus_mass[i][3]); print_difference("XLALSimIMRPhenomNSBH_sigma_tide_with_torus_mass", output, expected_sigma_tide_with_torus_mass[i]); - assert(approximatelyEqual(output, expected_sigma_tide_with_torus_mass[i], TOLERANCE_SIGMA_TIDE_WITH_TORUS_MASS)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_sigma_tide_with_torus_mass[i], TOLERANCE_SIGMA_TIDE_WITH_TORUS_MASS)); } } @@ -325,7 +324,7 @@ static void Test_epsilon_tide_ND(void) { double output = XLALSimIMRPhenomNSBH_epsilon_tide_ND( input_epsilon_tide_ND[i][0]); print_difference("XLALSimIMRPhenomNSBH_epsilon_tide_ND", output, expected_epsilon_tide_ND[i]); - assert(approximatelyEqual(output, expected_epsilon_tide_ND[i], TOLERANCE_EPSILON_TIDE_ND)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_epsilon_tide_ND[i], TOLERANCE_EPSILON_TIDE_ND)); } } @@ -389,7 +388,7 @@ static void Test_sigma_tide_ND(void) { double output = XLALSimIMRPhenomNSBH_sigma_tide_ND( input_sigma_tide_ND[i][0]); print_difference("XLALSimIMRPhenomNSBH_sigma_tide_ND", output, expected_sigma_tide_ND[i]); - assert(approximatelyEqual(output, expected_sigma_tide_ND[i], TOLERANCE_SIGMA_TIDE_ND)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_sigma_tide_ND[i], TOLERANCE_SIGMA_TIDE_ND)); } } @@ -479,7 +478,7 @@ static void Test_x_ND(void) { input_x_ND[i][2], input_x_ND[i][3]); print_difference("XLALSimIMRPhenomNSBH_x_ND", output, expected_x_ND[i]); - assert(approximatelyEqual(output, expected_x_ND[i], TOLERANCE_X_ND)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_x_ND[i], TOLERANCE_X_ND)); } } @@ -569,7 +568,7 @@ static void Test_x_ND_prime(void) { input_x_ND_prime[i][2], input_x_ND_prime[i][3]); print_difference("XLALSimIMRPhenomNSBH_x_ND_prime", output, expected_x_ND_prime[i]); - assert(approximatelyEqual(output, expected_x_ND_prime[i], TOLERANCE_X_ND_PRIME)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_x_ND_prime[i], TOLERANCE_X_ND_PRIME)); } } @@ -589,7 +588,7 @@ static void Test_delta2_prime(void) { input_delta2_prime[i][0], input_delta2_prime[i][1]); print_difference("XLALSimIMRPhenomNSBH_delta2_prime", output, expected_delta2_prime[i]); - assert(approximatelyEqual(output, expected_delta2_prime[i], TOLERANCE_DELTA2_PRIME)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_delta2_prime[i], TOLERANCE_DELTA2_PRIME)); } } @@ -610,7 +609,7 @@ static void Test_baryonic_mass_from_C(void) { input_baryonic_mass_from_C[i][0], input_baryonic_mass_from_C[i][1]); print_difference("XLALSimIMRPhenomNSBH_baryonic_mass_from_C", output, expected_baryonic_mass_from_C[i]); - assert(approximatelyEqual(output, expected_baryonic_mass_from_C[i], TOLERANCE_BARYONIC_MASS_FROM_C)); + XLAL_CHECK_EXIT(approximatelyEqual(output, expected_baryonic_mass_from_C[i], TOLERANCE_BARYONIC_MASS_FROM_C)); } } @@ -634,11 +633,11 @@ static void Test_omega_tilde(void) { // Assert real part is approximately equal print_difference("XLALSimIMRPhenomNSBH_omega_tilde (real)", creal(output), creal(expected_omega_tilde[i])); - assert(approximatelyEqual(creal(output), creal(expected_omega_tilde[i]), TOLERANCE_OMEGA_TILDE)); + XLAL_CHECK_EXIT(approximatelyEqual(creal(output), creal(expected_omega_tilde[i]), TOLERANCE_OMEGA_TILDE)); // Assert imaginary part is approximately equal print_difference("XLALSimIMRPhenomNSBH_omega_tilde (imag)", cimag(output), cimag(expected_omega_tilde[i])); - assert(approximatelyEqual(cimag(output), cimag(expected_omega_tilde[i]), TOLERANCE_OMEGA_TILDE)); + XLAL_CHECK_EXIT(approximatelyEqual(cimag(output), cimag(expected_omega_tilde[i]), TOLERANCE_OMEGA_TILDE)); } } diff --git a/lalsimulation/test/PhenomPTest.c b/lalsimulation/test/PhenomPTest.c index 3e265b431a6a723e4f2a566117eaac725ea8b84e..9ce8600f809237770e95dcc8399db5d4df0a64fa 100644 --- a/lalsimulation/test/PhenomPTest.c +++ b/lalsimulation/test/PhenomPTest.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -194,7 +193,7 @@ static void Test_alpha_epsilon(void) { const REAL8 eps = 1e-5; - assert( + XLAL_CHECK_EXIT( approximatelyEqual(alpha, alpha_expected, eps) && approximatelyEqual(epsilon, epsilon_expected, eps) && "Test_alpha_epsilon()" @@ -257,7 +256,7 @@ static void Test_XLALSimIMRPhenomPCalculateModelParameters(void) { //const REAL8 eps = DBL_EPSILON; const REAL8 eps = 1e-5; - assert(approximatelyEqual(chi_eff, chi_eff_expected, eps) + XLAL_CHECK_EXIT(approximatelyEqual(chi_eff, chi_eff_expected, eps) && approximatelyEqual(chip, chip_expected, eps) && approximatelyEqual(thetaJ, thetaJ_expected, eps) && approximatelyEqual(alpha0, alpha0_expected, eps) @@ -305,7 +304,7 @@ static void Test_PhenomC(void) { const REAL8 eps = 1e-5; - assert( + XLAL_CHECK_EXIT( approximatelyEqualC(hPC, hPC_expected, eps) && "Test_PhenomC()" ); @@ -388,7 +387,7 @@ static void Test_PhenomPCore(void) { COMPLEX16 hc_expected = -9.29441e-23 - I * 2.06616e-23; const REAL8 eps = 1e-5; - assert( + XLAL_CHECK_EXIT( approximatelyEqualC(hp, hp_expected, eps) && approximatelyEqualC(hc, hc_expected, eps) && "Test_PhenomPCore()" @@ -478,7 +477,7 @@ static void Test_XLALSimIMRPhenomP(void) { COMPLEX16 hc_expected = 2.6046e-23 + I * 5.17592e-23; const REAL8 eps = 1e-5; - assert( + XLAL_CHECK_EXIT( approximatelyEqualC(hp, hp_expected, eps) && approximatelyEqualC(hc, hc_expected, eps) && "XLALSimIMRPhenomP()" @@ -610,7 +609,7 @@ static void Test_PhenomC_PhenomP(void) { const REAL8 eps = 1e-5; - assert( + XLAL_CHECK_EXIT( approximatelyEqualC(match, match_expected, eps) && "Test_PhenomC_PhenomP()" ); @@ -757,7 +756,7 @@ static void Test_XLALSimIMRPhenomP_f_ref(void) { const REAL8 eps = 1e-5; - assert( + XLAL_CHECK_EXIT( approximatelyEqualC(hp, hp2, eps) && approximatelyEqualC(hc, hc2, eps) && "XLALSimIMRPhenomP_f_ref()" diff --git a/lalsimulation/test/SEOBNRv4_ROM_NRTidalv2_NSBH_Test.c b/lalsimulation/test/SEOBNRv4_ROM_NRTidalv2_NSBH_Test.c index ced512971dd79fb0bdf424d46895e0360de71fb9..83bee1d5436c2eaac9f42b331be13e331a729b1c 100644 --- a/lalsimulation/test/SEOBNRv4_ROM_NRTidalv2_NSBH_Test.c +++ b/lalsimulation/test/SEOBNRv4_ROM_NRTidalv2_NSBH_Test.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -118,7 +117,7 @@ static void Test_amplitude_correction_disruptive(void){ expected_amp_tidal->data[9]=0.8841072573277694; print_difference_FrequencySequence("Amplitude Correction",amp_tidal,expected_amp_tidal,freqs); - assert(approximatelyEqualREAL8Sequence(amp_tidal,expected_amp_tidal,1e-9)); + XLAL_CHECK_EXIT(approximatelyEqualREAL8Sequence(amp_tidal,expected_amp_tidal,1e-9)); } int main(int argc, char *argv[]) { diff --git a/lalsimulation/test/SphHarmTSTest.c b/lalsimulation/test/SphHarmTSTest.c index 1cac191e052ebe6e04d8ed2cb2e1a34118f4eac6..385fb28209443ff7a7e7bfd9ac82e7de6cf8c8db 100644 --- a/lalsimulation/test/SphHarmTSTest.c +++ b/lalsimulation/test/SphHarmTSTest.c @@ -26,8 +26,6 @@ */ -#include - #include #include #include @@ -92,7 +90,7 @@ int main(void){ } XLALSphHarmTimeSeriesSetTData( ts, tdata ); REAL8Sequence *tdata_hlm = XLALSphHarmTimeSeriesGetTData( ts ); - assert( tdata_hlm == tdata ); + XLAL_CHECK_EXIT( tdata_hlm == tdata ); XLALDestroySphHarmTimeSeries( ts );