diff --git a/CMakeLists.txt b/CMakeLists.txt index 961902e..cc522cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,6 @@ include(GNUInstallDirs) find_package(Threads REQUIRED) option(VERBOSE "Build efsw with verbose mode.") -option(LEGACY "Build efsw with cpp legacy support (before C++11).") option(BUILD_SHARED_LIBS "Build efsw as a shared library" ON) option(BUILD_STATIC_LIBS "Build efsw as a static library" ON) option(BUILD_TEST_APP "Build the test app" ${ESFW_MAIN_PROJECT}) @@ -68,11 +67,7 @@ if(VERBOSE) target_compile_definitions(efsw PRIVATE EFSW_VERBOSE) endif() -if(NOT LEGACY) - target_compile_features(efsw PRIVATE cxx_std_11) -else() - target_compile_definitions(efsw PRIVATE EFSW_LEGACY_CPP) -endif() +target_compile_features(efsw PRIVATE cxx_std_11) if(BUILD_SHARED_LIBS) target_compile_definitions(efsw PRIVATE EFSW_DYNAMIC EFSW_EXPORTS) diff --git a/premake4.lua b/premake4.lua index 785eefc..2918390 100644 --- a/premake4.lua +++ b/premake4.lua @@ -1,6 +1,5 @@ newoption { trigger = "verbose", description = "Build efsw with verbose mode." } newoption { trigger = "strip-symbols", description = "Strip debugging symbols in other file ( only for relwithdbginfo configuration )." } -newoption { trigger = "legacy", description = "Build efsw with cpp legacy support (before C++11)." } newoption { trigger = "thread-sanitizer", description ="Compile with ThreadSanitizer." } efsw_major_version = "1" @@ -133,12 +132,8 @@ solution "efsw" defines { "EFSW_VERBOSE" } end - if not _OPTIONS["legacy"] then - if not is_vs() then - buildoptions { "-std=c++11" } - end - else - defines { "EFSW_LEGACY_CPP" } + if not is_vs() then + buildoptions { "-std=c++11" } end if os.is("macosx") then diff --git a/premake5.lua b/premake5.lua index d97c80b..9f993b1 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1,6 +1,5 @@ newoption { trigger = "verbose", description = "Build efsw with verbose mode." } newoption { trigger = "strip-symbols", description = "Strip debugging symbols in other file ( only for relwithdbginfo configuration )." } -newoption { trigger = "legacy", description = "Build efsw with cpp legacy support (before C++11)." } newoption { trigger = "thread-sanitizer", description ="Compile with ThreadSanitizer" } efsw_major_version = "1" @@ -134,11 +133,7 @@ workspace "efsw" defines { "EFSW_VERBOSE" } end - if not _OPTIONS["legacy"] then - cppdialect "C++11" - else - defines { "EFSW_LEGACY_CPP" } - end + cppdialect "C++11" objdir("obj/" .. os.target() .. "/") diff --git a/src/efsw/Atomic.hpp b/src/efsw/Atomic.hpp index 420207a..9015c60 100644 --- a/src/efsw/Atomic.hpp +++ b/src/efsw/Atomic.hpp @@ -3,9 +3,7 @@ #include -#ifndef EFSW_LEGACY_CPP #include -#endif namespace efsw { @@ -14,36 +12,20 @@ template class Atomic { explicit Atomic( T set = false ) : set_( set ) {} Atomic& operator=( T set ) { -#ifndef EFSW_LEGACY_CPP set_.store( set, std::memory_order_release ); -#else - set_ = set; -#endif return *this; } explicit operator T() const { -#ifndef EFSW_LEGACY_CPP return set_.load( std::memory_order_acquire ); -#else - return set_; -#endif } T load() const { -#ifndef EFSW_LEGACY_CPP return set_.load( std::memory_order_acquire ); -#else - return set_; -#endif } private: -#ifndef EFSW_LEGACY_CPP std::atomic set_; -#else - volatile T set_; -#endif }; } // namespace efsw diff --git a/src/efsw/FileWatcherFSEvents.cpp b/src/efsw/FileWatcherFSEvents.cpp index 03c6f21..0fa7452 100644 --- a/src/efsw/FileWatcherFSEvents.cpp +++ b/src/efsw/FileWatcherFSEvents.cpp @@ -72,9 +72,7 @@ FileWatcherFSEvents::FileWatcherFSEvents( FileWatcher* parent ) : FileWatcherFSEvents::~FileWatcherFSEvents() { mInitOK = false; -#ifndef EFSW_LEGACY_CPP mWatchCond.notify_all(); -#endif WatchMap::iterator iter = mWatches.begin(); @@ -135,9 +133,7 @@ WatchID FileWatcherFSEvents::addWatch( const std::string& directory, FileWatchLi mWatches.insert( std::make_pair( mLastWatchID, pWatch ) ); } -#ifndef EFSW_LEGACY_CPP mWatchCond.notify_all(); -#endif return pWatch->ID; } diff --git a/src/efsw/FileWatcherFSEvents.hpp b/src/efsw/FileWatcherFSEvents.hpp index ca59fa0..6eb87e8 100644 --- a/src/efsw/FileWatcherFSEvents.hpp +++ b/src/efsw/FileWatcherFSEvents.hpp @@ -11,10 +11,8 @@ #include #include #include -#ifndef EFSW_LEGACY_CPP #include #include -#endif namespace efsw { @@ -91,10 +89,8 @@ class FileWatcherFSEvents : public FileWatcherImpl { bool pathInWatches( const std::string& path ); -#ifndef EFSW_LEGACY_CPP std::mutex mWatchesMutex; std::condition_variable mWatchCond; -#endif };