Skip to content

Commit

Permalink
Address issue foonathan#138 - workaround command line quoting issue f…
Browse files Browse the repository at this point in the history
…or types with spaces, and also address std lib implementations that wrap value types in some containers in a conatiner type of the same size.
  • Loading branch information
mec-irobot committed Sep 8, 2022
1 parent 4440c94 commit 21ca3bf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions cmake/get_align_of.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ struct align_of
template<typename T>
using get_align_of = align_of<T, alignof(T)>;

// Workaround for environments that have issues passing in type names with spaces
using LONG_LONG = long long;
using LONG_DOUBLE = long double;

get_align_of<TEST_TYPE> dummy;
6 changes: 4 additions & 2 deletions cmake/get_container_node_sizes.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
# is being processed.
set(_THIS_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR})

set(_DEBUG_GET_CONTAINER_NODE_SIZES OFF)
if(NOT DEFINED _DEBUG_GET_CONTAINER_NODE_SIZES)
set(_DEBUG_GET_CONTAINER_NODE_SIZES OFF)
endif()

function(_gcns_debug_message)
if(_DEBUG_GET_CONTAINER_NODE_SIZES)
Expand Down Expand Up @@ -50,7 +52,7 @@ function(unique_aligned_types result_types result_alignments)
set(alignments )
set(types )

set(all_types char bool short int long "long long" float double "long double")
set(all_types char bool short int long LONG_LONG float double LONG_DOUBLE)
foreach(type IN LISTS all_types )
get_alignof_type("${type}" alignment)
_gcns_debug_message("Alignment of '${type}' is '${alignment}'")
Expand Down
6 changes: 5 additions & 1 deletion cmake/get_node_size.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ template<typename T, typename State = empty_state, bool SubtractTSize = true, ty
struct debug_allocator :
public node_size_of<alignof(InitialType),
sizeof(T) - (SubtractTSize ? sizeof(InitialType) : 0),
!is_same<InitialType,T>::value>,
!is_same<InitialType,T>::value && (sizeof(InitialType) != sizeof(T))>,
private State
{
template<typename U>
Expand Down Expand Up @@ -201,6 +201,10 @@ int test_container()
}
#endif // SHARED_PTR_STATEFUL_CONTAINER

// Workaround for environments that have issues passing in type names with spaces
using LONG_LONG = long long;
using LONG_DOUBLE = long double;

#ifdef TEST_TYPES
template<typename... Types>
int test_all(std::tuple<Types...>)
Expand Down

0 comments on commit 21ca3bf

Please sign in to comment.