Skip to content

Commit a5c6c16

Browse files
committed
Fix build for MSVC and clang
1 parent f3f0812 commit a5c6c16

File tree

3 files changed

+23
-121
lines changed

3 files changed

+23
-121
lines changed

CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ endif()
6464
if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
6565
if (NOT UNIX)
6666
if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
67-
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wa,-mbig-obj -O1 -ftemplate-backtrace-limit=0")
67+
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wa,-mbig-obj -O1")
6868
else ()
6969
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
7070
endif ()
@@ -175,7 +175,6 @@ if (JINJA2CPP_STRICT_WARNINGS)
175175
endif ()
176176
endif ()
177177

178-
# target_compile_definitions(${LIB_TARGET_NAME} PUBLIC variant_CONFIG_SELECT_VARIANT=variant_VARIANT_NONSTD nssv_CONFIG_SELECT_STRING_VIEW=nssv_STRING_VIEW_NONSTD optional_CONFIG_SELECT_OPTIONAL=optional_OPTIONAL_NONSTD BOOST_SYSTEM_NO_DEPRECATED BOOST_ERROR_CODE_HEADER_ONLY)
179178
target_compile_definitions(${LIB_TARGET_NAME} PUBLIC BOOST_SYSTEM_NO_DEPRECATED BOOST_ERROR_CODE_HEADER_ONLY)
180179

181180
set_target_properties(${LIB_TARGET_NAME} PROPERTIES

include/jinja2cpp/value.h

+22-20
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ class GenericMap
141141
};
142142

143143
using ValuesList = std::vector<Value>;
144-
// using ValuesMap = std::unordered_map<std::string, Value>;
145144
struct ValuesMap;
146145
struct UserCallableArgs;
147146
struct ParamInfo;
@@ -278,19 +277,13 @@ class Value
278277
*
279278
* @param list List of values which should be used to initialize \ref Value instance
280279
*/
281-
Value(const ValuesList& list)
282-
: m_data(RecWrapper<ValuesList>(list))
283-
{
284-
}
280+
Value(const ValuesList& list);
285281
/*!
286282
* \brief Initializing constructor from the \ref ValuesMap
287283
*
288284
* @param map Map of values which should be used to initialize \ref Value instance
289285
*/
290-
Value(const ValuesMap& map)
291-
: m_data(RecWrapper<ValuesMap>(map))
292-
{
293-
}
286+
Value(const ValuesMap& map);
294287
/*!
295288
* \brief Initializing constructor from the \ref UserCallable
296289
*
@@ -302,19 +295,13 @@ class Value
302295
*
303296
* @param list List of values which should be used to initialize \ref Value instance
304297
*/
305-
Value(ValuesList&& list) noexcept
306-
: m_data(RecWrapper<ValuesList>(std::move(list)))
307-
{
308-
}
298+
Value(ValuesList&& list) noexcept;
309299
/*!
310300
* \brief Initializing move constructor from the \ref ValuesMap
311301
*
312302
* @param map Map of values which should be used to initialize \ref Value instance
313303
*/
314-
Value(ValuesMap&& map) noexcept
315-
: m_data(RecWrapper<ValuesMap>(std::move(map)))
316-
{
317-
}
304+
Value(ValuesMap&& map) noexcept;
318305
/*!
319306
* \brief Initializing move constructor from the \ref UserCallable
320307
*
@@ -639,16 +626,31 @@ inline Value::Value(Value&& val) noexcept
639626
{
640627
}
641628
inline Value::~Value() = default;
642-
inline Value& Value::operator =(const Value&) = default;
643-
inline Value& Value::operator =(Value&& val) noexcept
629+
inline Value& Value::operator=(const Value&) = default;
630+
inline Value& Value::operator=(Value&& val) noexcept
644631
{
645632
if (this == &val)
646633
return *this;
647634

648635
m_data.swap(val.m_data);
649636
return *this;
650637
}
651-
638+
inline Value::Value(const ValuesMap& map)
639+
: m_data(RecWrapper<ValuesMap>(map))
640+
{
641+
}
642+
inline Value::Value(const ValuesList& list)
643+
: m_data(RecWrapper<ValuesList>(list))
644+
{
645+
}
646+
inline Value::Value(ValuesList&& list) noexcept
647+
: m_data(RecWrapper<ValuesList>(std::move(list)))
648+
{
649+
}
650+
inline Value::Value(ValuesMap&& map) noexcept
651+
: m_data(RecWrapper<ValuesMap>(std::move(map)))
652+
{
653+
}
652654

653655
} // jinja2
654656

include/jinja2cpp/value_ptr.hpp

-99
Original file line numberDiff line numberDiff line change
@@ -596,105 +596,6 @@ struct nsvp_DECLSPEC_EMPTY_BASES compressed_ptr : Cloner, Deleter
596596
pointer ptr;
597597
};
598598

599-
template<class T, class Cloner, class Deleter>
600-
struct nsvp_DECLSPEC_EMPTY_BASES new_compressed_ptr // : Cloner, Deleter
601-
{
602-
// typedef T element_type;
603-
typedef T* pointer;
604-
605-
typedef Cloner cloner_type;
606-
typedef Deleter deleter_type;
607-
608-
// Lifetime:
609-
610-
~new_compressed_ptr() {}
611-
612-
new_compressed_ptr() nsvp_noexcept {}
613-
614-
explicit new_compressed_ptr(pointer p) nsvp_noexcept {}
615-
616-
new_compressed_ptr(new_compressed_ptr const& other) {}
617-
618-
#if nsvp_CPP11_OR_GREATER
619-
new_compressed_ptr(new_compressed_ptr&& other) nsvp_noexcept {}
620-
#endif
621-
622-
explicit new_compressed_ptr(T const& value) {}
623-
624-
#if nsvp_CPP11_OR_GREATER
625-
626-
explicit new_compressed_ptr(T&& value) nsvp_noexcept {}
627-
628-
template<class... Args>
629-
explicit new_compressed_ptr(nonstd_lite_in_place_t(T), Args&&... args)
630-
{
631-
}
632-
633-
template<class U, class... Args>
634-
explicit new_compressed_ptr(nonstd_lite_in_place_t(T), std::initializer_list<U> il, Args&&... args)
635-
{
636-
}
637-
638-
#endif
639-
640-
new_compressed_ptr(T const& value, cloner_type const& cloner) {}
641-
642-
#if nsvp_CPP11_OR_GREATER
643-
new_compressed_ptr(T&& value, cloner_type&& cloner) nsvp_noexcept {}
644-
#endif
645-
646-
new_compressed_ptr(T const& value, cloner_type const& cloner, deleter_type const& deleter) {}
647-
648-
#if nsvp_CPP11_OR_GREATER
649-
new_compressed_ptr(T&& value, cloner_type&& cloner, deleter_type&& deleter) nsvp_noexcept {}
650-
#endif
651-
652-
explicit new_compressed_ptr(cloner_type const& cloner) {}
653-
654-
#if nsvp_CPP11_OR_GREATER
655-
explicit new_compressed_ptr(cloner_type&& cloner) nsvp_noexcept {}
656-
#endif
657-
658-
explicit new_compressed_ptr(deleter_type const& deleter) {}
659-
660-
#if nsvp_CPP11_OR_GREATER
661-
explicit new_compressed_ptr(deleter_type&& deleter) nsvp_noexcept {}
662-
#endif
663-
664-
new_compressed_ptr(cloner_type const& cloner, deleter_type const& deleter) {}
665-
666-
#if nsvp_CPP11_OR_GREATER
667-
new_compressed_ptr(cloner_type&& cloner, deleter_type&& deleter) nsvp_noexcept {}
668-
#endif
669-
670-
// Observers:
671-
672-
pointer get() const nsvp_noexcept { return nullptr; }
673-
674-
cloner_type& get_cloner() nsvp_noexcept { return *this; }
675-
676-
deleter_type& get_deleter() nsvp_noexcept { return *this; }
677-
678-
// Modifiers:
679-
680-
pointer release() nsvp_noexcept { return nullptr; }
681-
682-
void reset(pointer p) nsvp_noexcept {}
683-
684-
void reset(T const& v) {}
685-
686-
#if nsvp_CPP11_OR_GREATER
687-
void reset(T&& v) {}
688-
#endif
689-
690-
void swap(new_compressed_ptr& other) nsvp_noexcept {}
691-
692-
union {
693-
void* dummy;
694-
pointer ptr;
695-
};
696-
};
697-
698599
} // namespace detail
699600

700601
#if ! nsvp_CONFIG_NO_EXCEPTIONS

0 commit comments

Comments
 (0)