Skip to content

Commit

Permalink
Finish Release-0.4, see CHANGELOG.MD and log for details
Browse files Browse the repository at this point in the history
  • Loading branch information
foonathan committed Sep 12, 2015
2 parents 291602b + 36e8cb5 commit ce72099
Show file tree
Hide file tree
Showing 91 changed files with 9,956 additions and 3,024 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/doc/html
/doc/*.tmp
# Created by .ignore support plugin (hsz.mobi)
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "cmake/comp"]
path = cmake/comp
url = https://github.com/foonathan/compatibility.git
branch = git-submodule
13 changes: 13 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
0.4
---
* polished up the interface, many breaking changes in the form of renaming and new header files
* added unified error handling facilities and handler functions in case exceptions are not supported
* improved old allocator adapters by introducing allocator_storage template
* improved allocator_traits making them more powerful and able to handle Allcoator types directly
* added type-erased allocator storage
* added node-size debugger that obtains information about the container node sizes
* most parts now work on a freestanding implementation
* used foonathan/compatibility for CMake compatibility checks
* added miscellaneous tiny features all over the place
* many internal changes and bugfixes

0.3
---
* added debugging options such as memory filling and deallocation and leak check
Expand Down
41 changes: 27 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
# root CMakeLists.txt, specifies option and interface library

cmake_minimum_required(VERSION 3.1)

if (BIICODE)
ADD_BII_TARGETS()
else()
project(FOONATHAN_MEMORY)
endif()
project(FOONATHAN_MEMORY)

# compatibility options
include(cmake/compatibility.cmake)

# debug options
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
set(debug_asserts ON)
set(debug_checks ON)
set(debug_fence 8)
elseif(${CMAKE_BUILD_TYPE} MATCHES "RelWithDebInfo")
set(debug_asserts OFF)
set(debug_checks ON)
set(debug_fence 0)
else()
set(debug_asserts OFF)
set(debug_checks OFF)
set(debug_fence 0)
endif()

option(FOONATHAN_MEMORY_DEBUG_ASSERT
"whether or not internal assertions (like the macro assert) are enabled" ${debug_asserts})
option(FOONATHAN_MEMORY_DEBUG_FILL
"whether or not the (de-)allocated memory will be pre-filled" ${debug_checks})
set(FOONATHAN_MEMORY_DEBUG_FENCE ${debug_fence} CACHE STRING
Expand All @@ -35,23 +35,33 @@ option(FOONATHAN_MEMORY_DEBUG_LEAK_CHECK
"whether or not leak checking is active" ${debug_checks})
option(FOONATHAN_MEMORY_DEBUG_POINTER_CHECK
"whether or not pointer checking on deallocation is active" ${debug_checks})
option(FOONATHAN_MEMORY_DEBUG_DOUBLE_DEALLOC_CHECK
"whether or not the (sometimes expensive) check for double deallocation is active" ${debug_asserts})

# other options
set(FOONATHAN_MEMORY_DEFAULT_ALLOCATOR heap_allocator CACHE STRING
"the default implementation allocator for higher-level ones")
option(FOONATHAN_MEMORY_THREAD_SAFE_REFERENCE
"whether or not allocator_reference is thread safe by default" ON)

# whether or not this is project is build directly or as subdirectory
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(is_toplevel 1)
# calculates default values for build_* options
if(COMP_HAS_HOSTED_IMPLEMENTATION AND (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
# examples/tests if toplevel directory (i.e. direct build, not as subdirectory) and hosted
set(build_examples_tests 1)
else()
set(build_examples_tests 0)
endif()

if(COMP_HAS_HOSTED_IMPLEMENTATION)
set(build_tools 1)
else()
set(is_toplevel 0)
set(build_tools 0)
endif()

# build options
option(FOONATHAN_MEMORY_BUILD_EXAMPLES "whether or not to build the examples" ${is_toplevel})
option(FOONATHAN_MEMORY_BUILD_TESTS "whether or not to build the tests" ${is_toplevel})
option(FOONATHAN_MEMORY_BUILD_EXAMPLES "whether or not to build the examples" ${build_examples_tests})
option(FOONATHAN_MEMORY_BUILD_TESTS "whether or not to build the tests" ${build_examples_tests})
option(FOONATHAN_MEMORY_BUILD_TOOLS "whether or not to build the tools" ${build_tools})

option(FOONATHAN_MEMORY_INCLUDE_PREFIX "whether or not you have to use <foonathan/memory/xxx.hpp>" OFF)
option(FOONATHAN_MEMORY_NAMESPACE_PREFIX "whether or not everything is in namespace foonathan::memory" OFF)

Expand All @@ -65,7 +75,7 @@ else()
endif()

set(FOONATHAN_MEMORY_VERSION_MAJOR 0 CACHE STRING "major version of memory" FORCE)
set(FOONATHAN_MEMORY_VERSION_MINOR 3 CACHE STRING "minor version of memory" FORCE)
set(FOONATHAN_MEMORY_VERSION_MINOR 4 CACHE STRING "minor version of memory" FORCE)

# subdirectories
add_subdirectory(src)
Expand All @@ -75,3 +85,6 @@ endif()
if(FOONATHAN_MEMORY_BUILD_TESTS)
add_subdirectory(test)
endif()
if(FOONATHAN_MEMORY_BUILD_TOOLS)
add_subdirectory(tool)
endif()
191 changes: 85 additions & 106 deletions README.md

Large diffs are not rendered by default.

26 changes: 0 additions & 26 deletions biicode.conf

This file was deleted.

1 change: 1 addition & 0 deletions cmake/comp
Submodule comp added at 84e7bd
51 changes: 18 additions & 33 deletions cmake/compatibility.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,25 @@
# found in the top-level directory of this distribution.

# compatibility.cmake - various necessary compatibility checks
# note: only include it in memory's top-level CMakeLists.txt

include(CheckCXXSourceCompiles)
include(CheckCXXCompilerFlag)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/comp/comp_base.cmake)

check_cxx_compiler_flag(-std=c++11 has_cpp11_flag)
if(has_cpp11_flag)
set(CMAKE_REQUIRED_FLAGS "-std=c++11")
else()
check_cxx_compiler_flag(-std=c++0x has_cpp0x_flag)
if(has_cpp0x_flag)
SET(CMAKE_REQUIRED_FLAGS "-std=c++0x")
endif()
endif()
# download in source for convenience
set(_foonathan_comp_dest_dir ${CMAKE_CURRENT_SOURCE_DIR}/cmake/comp)

# tests if code compiles and provides override option for result
# creates internal variable has_${name} and option FOONATHAN_HAS_${name}
macro(foonathan_check_feature code name)
check_cxx_source_compiles("${code}" has_${name})
if(has_${name})
option(FOONATHAN_HAS_${name} "whether or not ${name} is available" ON)
else()
OPTION(FOONATHAN_HAS_${name} "whether or not ${name} is available" OFF)
endif()
endmacro()
# dummy library running the required tests
add_library(_foonathan_comp_runner INTERFACE)
comp_target_features(_foonathan_comp_runner INTERFACE
cpp11_lang/alignof cpp11_lang/constexpr cpp11_lang/noexcept cpp11_lang/thread_local
cpp11_lib/max_align_t cpp11_lib/get_new_handler
env/exception_support env/hosted_implementation env/threading_support
PREFIX "FOONATHAN_" NAMESPACE "foonathan_memory_comp"
CMAKE_PATH "${_foonathan_comp_dest_dir}"
NOFLAGS)

foonathan_check_feature("int main() {int i = alignof(int);}" ALIGNOF)
foonathan_check_feature("int main() {constexpr auto foo = 1;}" CONSTEXPR)
foonathan_check_feature("void foo() noexcept {} int main(){}" NOEXCEPT)
foonathan_check_feature("int main() {thread_local int i;}" THREAD_LOCAL)

# note: using namespace std; important here, as it might not be in namespace std
foonathan_check_feature("#include <cstddef>
using namespace std;
int main() {max_align_t val;}" MAX_ALIGN_T)

foonathan_check_feature("#include <new>
int main() {auto handler = std::get_new_handler();}" GET_NEW_HANDLER)
function(_foonathan_use_comp target)
# just activate C++11
comp_target_features(${target} PRIVATE CPP11)
target_link_libraries(${target} PUBLIC _foonathan_comp_runner)
endfunction()
Loading

0 comments on commit ce72099

Please sign in to comment.