Skip to content

Commit

Permalink
master: check_simple_vector.hpp: make sure this is implemented when C…
Browse files Browse the repository at this point in the history
…PPAD_DEBUG_AND_RELEASE is true.
  • Loading branch information
bradbell committed Mar 15, 2024
1 parent 1ed0b52 commit 0e45736
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion appendix/whats_new/2024.xrst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Release Notes for 2024
mm-dd
*****

03-14
03-15
=====
#. The user's choice of :ref:`ta_parallel_setup@in_parallel` routine
was not being called properly in some cases. This has been fixed.
Expand Down
23 changes: 14 additions & 9 deletions bin/check_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ then
fi
if [ "$1" != 'mixed' ] && [ "$1" != 'debug' ] && [ "$1" != 'release' ]
then
echo 'bin/check_all.sh: (mixed|debug|release) [verbose]'
echo 'bin/check_all.sh: (mixed|debug|release) [verbose_make]'
exit 1
fi
if [ "$2" != '' ] && [ "$2" != 'verbose' ]
if [ "$2" != '' ] && [ "$2" != 'verbose_make' ]
then
echo 'bin/check_all.sh: (mixed|debug|release) [verbose]'
echo 'bin/check_all.sh: (mixed|debug|release) [verbose_make]'
exit 1
fi
build_type="$1"
if [ "$2" == 'verbose' ]
if [ "$2" == 'verbose_make' ]
then
verbose='--verbose'
verbose_make='--verbose_make'
else
verbose=''
verbose_make=''
fi
# -----------------------------------------------------------------------------
# bash function that echos and executes a command
Expand Down Expand Up @@ -135,7 +135,7 @@ then
else
if [ "$build_type" != 'mixed' ]
then
echo 'bin/run_cmake.sh: build_type program error'
echo 'bin/check_all.sh: build_type not debug release or mixed'
exit 1
fi
random_01 debug_which
Expand Down Expand Up @@ -251,9 +251,14 @@ then
echo_log_eval bin/run_configure.sh $standard
fi
else
builder='ninja'
if [ "$verbose_name" != '' ]
then
builder='make'
else
builder='ninja'
fi
echo_log_eval bin/run_cmake.sh \
$verbose \
$verbose_make \
--profile_speed \
$compiler \
$standard \
Expand Down
18 changes: 14 additions & 4 deletions include/cppad/utility/check_simple_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,18 @@ so *S* is not the same as *T* .
# include <cppad/local/define.hpp>
# include <cppad/utility/thread_alloc.hpp>

// CPPAD_CHECK_SIMPLE_VECTOR
# ifndef NDEBUG
# define CPPAD_CHECK_SIMPLE_VECTOR 1
# elif CPPAD_DEBUG_AND_RELEASE
# define CPPAD_CHECK_SIMPLE_VECTOR 1
# else
# define CPPAD_CHECK_SIMPLE_VECTOR 0
# endif

namespace CppAD {

# ifdef NDEBUG
# if ! CPPAD_CHECK_SIMPLE_VECTOR
template <class Scalar, class Vector>
inline void CheckSimpleVector(const Scalar& x, const Scalar& y)
{ }
Expand All @@ -119,7 +128,7 @@ namespace CppAD {
struct ok_if_S_same_as_T<T,T> { T value; };

template <class Scalar, class Vector>
void CheckSimpleVector(const Scalar& x, const Scalar& y)
inline void CheckSimpleVector(const Scalar& x, const Scalar& y)
{ //
// count
static size_t count = 0;
Expand Down Expand Up @@ -194,8 +203,8 @@ namespace CppAD {
Scalar y;

// use assignment and not constructor
x = 0;
y = 1;
x = Scalar(0);
y = Scalar(1);

CheckSimpleVector<Scalar, Vector>(x, y);
}
Expand All @@ -204,4 +213,5 @@ namespace CppAD {

} // end namespace CppAD

# undef CPPAD_CHECK_SIMPLE_VECTOR
# endif

0 comments on commit 0e45736

Please sign in to comment.