diff --git a/build/Makefile.gcc4 b/build/Makefile.gcc4 index 0b5f63c..ba4992c 100644 --- a/build/Makefile.gcc4 +++ b/build/Makefile.gcc4 @@ -10,7 +10,7 @@ #-------------------------------------------------------------------------------- include $(SCX_BRD)/build/Makefile.gcc3 -CXX_WARN_FLAGS+=-Wstrict-null-sentinel -Wmissing-include-dirs -Winit-self -Wextra +CXX_WARN_FLAGS+=-Wstrict-null-sentinel -Wmissing-include-dirs -Winit-self -Wextra ifeq ($(PF_DISTRO)$(PF_MAJOR),SUSE11) CXX_WARN_FLAGS+=-Wno-ignored-qualifiers diff --git a/build/Makefile.pf.Linux b/build/Makefile.pf.Linux index 78a9edc..e2c8b7d 100644 --- a/build/Makefile.pf.Linux +++ b/build/Makefile.pf.Linux @@ -18,6 +18,9 @@ else include Makefile.gcc4 endif +# Needed for compat with Gcc 6 and beyond +CXXFLAGS += -std=gnu++98 + # C++ 11 for IBM atomic support ifeq ($(ARCH),ppc) CXXFLAGS += -std=c++11 -D=linux diff --git a/source/code/scxcorelib/pal/scxcondition.cpp b/source/code/scxcorelib/pal/scxcondition.cpp index 8e87e57..f7311d6 100644 --- a/source/code/scxcorelib/pal/scxcondition.cpp +++ b/source/code/scxcorelib/pal/scxcondition.cpp @@ -84,6 +84,17 @@ namespace SCXCoreLib SCXCondition::~SCXCondition() { #if defined(SCX_UNIX) +#if __GNUC__ >= 6 +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wc++11-compat" +#endif + + // BUG ALERT!!!! + // Destructors are noexcept by default in C++11. Throwing an exception from a destructor or constructor + // is always poor practice because it leaves the object in an undefrined state, neither constructed or destructed. + // In this case, the best case would be a memory leak. The gcc 6 and after will treat this as an error and it will + // always abort the program. + int err; if (0 != (err = pthread_cond_destroy(&m_cond))) { @@ -94,6 +105,9 @@ namespace SCXCoreLib { throw SCXErrnoException(L"pthread_mutex_destroy() function call failed", err, SCXSRCLOCATION); } +#if __GNUC__ >= 6 +#pragma GCC diagnostic pop +#endif #elif defined(WIN32) DeleteCriticalSection(&m_lock); diff --git a/source/code/scxcorelib/pal/scxdirectoryinfo.cpp b/source/code/scxcorelib/pal/scxdirectoryinfo.cpp index f9ae686..0957644 100644 --- a/source/code/scxcorelib/pal/scxdirectoryinfo.cpp +++ b/source/code/scxcorelib/pal/scxdirectoryinfo.cpp @@ -481,7 +481,15 @@ namespace #if defined(sun) while (NULL != (dentp = readdir_r(dirp, currentDir))) { #else +#if (__GNUC__ >= 6 ) +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wdeprecated-declarations" +#endif + // readdir_c is deprecated as of POSIX 1.2008 but is still supported and not simple to implement the recommended usage. Make a warning for now while ((0 == readdir_r(dirp, currentDir, &dentp)) && NULL != dentp) { +#if (__GNUC__ >= 6) +#pragma GCC diagnostic pop +#endif #endif bool isdir = false; // Is this a directory entry SCXCoreLib::SCXFileSystem::SCXStatStruct* pStat = 0; diff --git a/source/code/scxcorelib/util/scxmath.cpp b/source/code/scxcorelib/util/scxmath.cpp index 0a742c9..4c3b5e6 100644 --- a/source/code/scxcorelib/util/scxmath.cpp +++ b/source/code/scxcorelib/util/scxmath.cpp @@ -144,7 +144,7 @@ namespace SCXCoreLib scxlong RoundToScxLong(double value) { double roundedValue = Round(value); - if (cMinScxLong <= roundedValue && roundedValue <= cMaxScxLong) { + if ((double)cMinScxLong <= roundedValue && roundedValue <= (double)cMaxScxLong) { return static_cast (roundedValue); } else { throw SCXInvalidArgumentException(L"value", L"Value of double outside the range of long",