Skip to content

Commit

Permalink
Merge 40e1208 into 3d5cb97
Browse files Browse the repository at this point in the history
  • Loading branch information
basvodde committed May 19, 2020
2 parents 3d5cb97 + 40e1208 commit 2512360
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Makefile.am
Expand Up @@ -162,6 +162,7 @@ CppUTestTests_SOURCES = \
tests/CppUTest/AllocLetTestFreeTest.cpp \
tests/CppUTest/AllTests.cpp \
tests/CppUTest/CheatSheetTest.cpp \
tests/CppUTest/CompatabilityTests.cpp \
tests/CppUTest/CommandLineArgumentsTest.cpp \
tests/CppUTest/CommandLineTestRunnerTest.cpp \
tests/CppUTest/DummyMemoryLeakDetector.cpp \
Expand Down Expand Up @@ -339,6 +340,12 @@ check_basic:
@echo "Building with the Std C++ 14 turned on. Compiler acts differently then."
make distclean; $(srcdir)/configure --enable-std-cpp14; make

@echo "Building with the Std C++ 17 turned on. Compiler acts differently then."
make distclean; $(srcdir)/configure --enable-std-cpp17; make

@echo "Building with the Std C++ 20 turned on. Compiler acts differently then."
make distclean; $(srcdir)/configure --enable-std-cpp20; make

@echo "Building without the Standard C library"
make distclean; $(srcdir)/configure --disable-std-c; make

Expand Down
38 changes: 37 additions & 1 deletion configure.ac
Expand Up @@ -85,7 +85,7 @@ fi

AC_LANG_PUSH([C++])
#####################################################################################
##### C++ 14 checks
##### C++ checks

# FLag -std=c++1y
CXXFLAGS="-Werror -std=c++1y"
Expand All @@ -99,6 +99,24 @@ AC_MSG_CHECKING([whether CXX supports -std=c++14])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP14FLAG="-std=c++14" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"

# FLag std=c++17
CXXFLAGS="-Werror -std=c++17"
AC_MSG_CHECKING([whether CXX supports -std=c++17])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP17FLAG="-std=c++17" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"

# FLag std=c++20
CXXFLAGS="-Werror -std=c++2a"
AC_MSG_CHECKING([whether CXX supports -std=c++2a])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP20FLAG="-std=c++2a" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"

# FLag std=c++20
CXXFLAGS="-Werror -std=c++20"
AC_MSG_CHECKING([whether CXX supports -std=c++20])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP20FLAG="-std=c++20" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"

#####################################################################################
##### C++ version checks

Expand Down Expand Up @@ -373,6 +391,12 @@ AC_ARG_ENABLE([std-cpp11], [AC_HELP_STRING([--enable-std-cpp11], [enable the use
AC_ARG_ENABLE([std-cpp14], [AC_HELP_STRING([--enable-std-cpp14], [enable the use of Standard C++ 14 (if the compiler supports that)])],
[use_std_cpp14=${enableval}], [use_std_cpp14=no])

AC_ARG_ENABLE([std-cpp17], [AC_HELP_STRING([--enable-std-cpp17], [enable the use of Standard C++ 17 (if the compiler supports that)])],
[use_std_cpp17=${enableval}], [use_std_cpp17=no])

AC_ARG_ENABLE([std-cpp20], [AC_HELP_STRING([--enable-std-cpp20], [enable the use of Standard C++ 20 (if the compiler supports that)])],
[use_std_cpp20=${enableval}], [use_std_cpp20=no])

AC_ARG_ENABLE([cpputest-flags], [AC_HELP_STRING([--disable-cpputest-flags], [disable CFLAGS/CPPFLAGS/CXXFLAGS set by CppUTest])],
[cpputest_flags=${enableval}], [cpputest_flags=yes])

Expand Down Expand Up @@ -441,6 +465,18 @@ if test "x${use_std_cpp14}" = xyes; then
cpp_standard_used="C++14"
fi

# Using the C++17 standard?
if test "x${use_std_cpp17}" = xyes; then
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP17FLAG}"
cpp_standard_used="C++17"
fi

# Using the C++20 standard?
if test "x${use_std_cpp20}" = xyes; then
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP20FLAG}"
cpp_standard_used="C++20"
fi

# Dealing with memory leak detection
if test "x${memory_leak_detection}" = xno; then
AC_DEFINE([MEM_LEAK_DETECTION_DISABLED], 1, [memory leak detection disabled])
Expand Down
1 change: 1 addition & 0 deletions platforms/CCStudio/CppUTestRunAllTests1.pjt
Expand Up @@ -36,6 +36,7 @@ Source="..\..\tests\AllocationInCppFile.cpp"
Source="..\..\tests\AllocLetTestFree.c"
Source="..\..\tests\AllocLetTestFreeTest.cpp"
Source="..\..\tests\CheatSheetTest.cpp"
Source="..\..\tests\CompatabilityTests.cpp"
Source="..\..\tests\CommandLineArgumentsTest.cpp"
Source="..\..\tests\CommandLineTestRunnerTest.cpp"
Source="..\..\tests\JUnitOutputTest.cpp"
Expand Down
1 change: 1 addition & 0 deletions platforms/Dos/sources.mk
Expand Up @@ -41,6 +41,7 @@ CPPU1_OBJECTS := \
$(CPPUTEST_HOME)/tests/CppUTest/AllocLetTestFree.o \
$(CPPUTEST_HOME)/tests/CppUTest/AllocLetTestFreeTest.o \
$(CPPUTEST_HOME)/tests/CppUTest/CheatSheetTest.o \
$(CPPUTEST_HOME)/tests/CppUTest/CompatabilityTests.o \
$(CPPUTEST_HOME)/tests/CppUTest/CommandLineArgumentsTest.o \
$(CPPUTEST_HOME)/tests/CppUTest/CommandLineTestRunnerTest.o \
$(CPPUTEST_HOME)/tests/CppUTest/JUnitOutputTest.o
Expand Down
15 changes: 15 additions & 0 deletions platforms/Eclipse-Cygwin/.project
Expand Up @@ -724,6 +724,11 @@
<type>1</type>
<locationURI>PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/CheatSheetTest.cpp</locationURI>
</link>
<link>
<name>tests/CompatabilityTests.cpp</name>
<type>1</type>
<locationURI>PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/CompatabilityTests.cpp</locationURI>
</link>
<link>
<name>tests/CommandLineArgumentsTest.cpp</name>
<type>1</type>
Expand Down Expand Up @@ -1884,6 +1889,16 @@
<type>1</type>
<locationURI>PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/Debug/CodeMemoryReportFormatterTest.sbr</locationURI>
</link>
<link>
<name>tests/Debug/CompatabilityTests.obj</name>
<type>1</type>
<locationURI>PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/Debug/CompatabilityTests.obj</locationURI>
</link>
<link>
<name>tests/Debug/CompatabilityTests.sbr</name>
<type>1</type>
<locationURI>PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/Debug/CompatabilityTests.sbr</locationURI>
</link>
<link>
<name>tests/Debug/CommandLineArgumentsTest.obj</name>
<type>1</type>
Expand Down
3 changes: 3 additions & 0 deletions platforms/iar/CppUTestTest.ewp
Expand Up @@ -1942,6 +1942,9 @@
<file>
<name>$PROJ_DIR$\..\..\tests\CppUTest\CheatSheetTest.cpp</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\tests\CppUTest\CompatabilityTests.cpp</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\tests\CppUTest\CommandLineArgumentsTest.cpp</name>
</file>
Expand Down
23 changes: 23 additions & 0 deletions tests/AllTests.vcproj
Expand Up @@ -354,6 +354,29 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="CppUTest\CompatabilityTests.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
ForcedIncludeFiles=""
/>
</FileConfiguration>
</File>
<File
RelativePath="CppUTest\CommandLineArgumentsTest.cpp"
>
Expand Down
1 change: 1 addition & 0 deletions tests/AllTests.vcxproj
Expand Up @@ -247,6 +247,7 @@
<ClCompile Include="CppUTest\AllocLetTestFree.c" />
<ClCompile Include="CppUTest\AllocLetTestFreeTest.cpp" />
<ClCompile Include="CppUTest\CheatSheetTest.cpp" />
<ClCompile Include="CppUTest\CompatabilityTests.cpp" />
<ClCompile Include="CppUTest\CommandLineArgumentsTest.cpp" />
<ClCompile Include="CppUTest\CommandLineTestRunnerTest.cpp" />
<ClCompile Include="CppUTestExt\AllTests.cpp" />
Expand Down
1 change: 1 addition & 0 deletions tests/CppUTest/CMakeLists.txt
Expand Up @@ -4,6 +4,7 @@ set(CppUTestTests_src
CheatSheetTest.cpp
SimpleStringTest.cpp
SimpleStringCacheTest.cpp
CompatabilityTests.cpp
CommandLineArgumentsTest.cpp
TestFailureTest.cpp
TestFailureNaNTest.cpp
Expand Down
26 changes: 26 additions & 0 deletions tests/CppUTest/CompatabilityTests.cpp
@@ -0,0 +1,26 @@

#include "CppUTest/TestHarness.h"

#if CPPUTEST_USE_STD_CPP_LIB

#include <memory>

TEST_GROUP(StandardCppLibrary)
{
};

#if defined(__cplusplus) && __cplusplus >= 201103L && 0

TEST(StandardCppLibrary, UniquePtrConversationToBool)
{
auto const aNull = std::unique_ptr<int>(nullptr);
CHECK_FALSE(aNull);

auto const notNull = std::make_unique<int>(1);
CHECK_TRUE(notNull);
};

#endif

#endif

0 comments on commit 2512360

Please sign in to comment.