Skip to content

Commit

Permalink
stable/20240000: cppad_vector.cpp: disable a certain test on Darwin s…
Browse files Browse the repository at this point in the history
…ystems.
  • Loading branch information
bradbell committed Jul 29, 2024
1 parent 03d8b53 commit b6e9fb6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
7 changes: 5 additions & 2 deletions example/utility/cppad_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ bool CppAD_vector(void)
// sort of vec (will reverse order of elements for this case)
# ifndef _MSC_VER
// 2DO: Determine why this test fails with Visual Studio 2019
# if ! CPPAD_SYSTEM_IS_DARWIN
// 2DO: Also why it failes with version 20240000.6, clang, and some MacOS
std::sort(vec.begin(), vec.end());
for(size_t i = 0; i < n ; ++i)
ok &= vec[i] == Scalar(i + 1);
Expand All @@ -154,10 +156,11 @@ bool CppAD_vector(void)
std::sort(other.data(), other.data() + other.size());
for(size_t i = 0; i < n ; ++i)
ok &= other[i] == Scalar(i + 1);
# else
# endif
# endif
// incase this is Darwin system or MSC compiler
for(size_t i = 0; i < n ; ++i)
vec[i] = Scalar(i + 1);
# endif

// test direct use of iterator and const_iterator
typedef vector<Scalar>::iterator iterator;
Expand Down
8 changes: 8 additions & 0 deletions include/cppad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ SET(CMAKE_REQUIRED_FLAGS "")
SET(CMAKE_REQUIRED_INCLUDES "")
SET(CMAKE_REQUIRED_LIBRARIES "")
# -----------------------------------------------------------------------------
# cppad_system_is_darwin
IF( "$CMake_SYSTEM_NAME" STREQUAL "Darwin" )
SET(cppad_system_is_darwin 1)
ELSE( )
SET(cppad_system_is_darwin 0)
ENDIF( )
print_variable(cppad_system_is_darwin)
# -----------------------------------------------------------------------------
#
# cppad_c_compiler_cmd
# is the command used to run the C compiler.
Expand Down
9 changes: 9 additions & 0 deletions include/cppad/configure.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
Preprocessor Symbols Set By CMake Command
#########################################

CPPAD_SYSTEM_IS_DARWIN
**********************
is this a Darwin system; i.e., macOC or OS X, etc.
This seems to only needed for verison 20240000.6.
Use git grep CPPAD_SYSTEM_IS_DARWIN to see what it used for.
{xrst_code hpp} */
# define CPPAD_SYSTEM_IS_DARWIN @cppad_system_is_darwin@
/* {xrst_code}

CPPAD_COMPILER_HAS_CONVERSION_WARN
**********************************
is the compiler a variant of g++ and has conversion warnings
Expand Down
3 changes: 2 additions & 1 deletion include/cppad/core/undef.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ that are used by the CppAD examples and tests.
# undef CPPAD_HAS_COLPACK used by speed/cppad/sparse_*.cpp
# undef CPPAD_C_COMPILER_GNU_FLAGS used by dll examples.
# undef CPPAD_C_COMPILER_MSVC_FLAGS used by dll examples.
# undef CPPAD_C_COMPILER_CMD used by dll examples.
# undef CPPAD_C_COMPILER_CMD used by dll examples.
# undef CPPAD_SYSTEM_IS_DARWIN used by example/utility/cppad_vector.hpp
// for conditional testing when implicit conversion is not present
# undef CPPAD_DEPRECATED
Expand Down

0 comments on commit b6e9fb6

Please sign in to comment.