Fix usage of is_trivially_copyable on older GCC (for real this time)

This commit is contained in:
Vojtech Kral 2019-01-22 11:12:50 +01:00
parent cada2a313f
commit a85db038be
3 changed files with 14 additions and 6 deletions

View File

@ -11,6 +11,7 @@
#include "../libslic3r.h" #include "../libslic3r.h"
#include "../BoundingBox.hpp" #include "../BoundingBox.hpp"
#include "../PrintConfig.hpp" #include "../PrintConfig.hpp"
#include "../Utils.hpp"
namespace Slic3r { namespace Slic3r {
@ -40,11 +41,7 @@ struct FillParams
// in this case we don't try to make more continuous paths // in this case we don't try to make more continuous paths
bool complete; bool complete;
}; };
#if (!defined __GNUC__) || __GNUC__ > 4 static_assert(IsTriviallyCopyable<FillParams>::value, "FillParams class is not POD (and it should be - see constructor).");
// Older GCCs don't have std::is_trivially_copyable
// cf. https://gcc.gnu.org/onlinedocs/gcc-4.9.4/libstdc++/manual/manual/status.html#status.iso.2011
static_assert(std::is_trivially_copyable<FillParams>::value, "FillParams class is not POD (and it should be - see constructor).");
#endif
class Fill class Fill
{ {

View File

@ -10,6 +10,7 @@
#include <vector> #include <vector>
#include "libslic3r.h" #include "libslic3r.h"
#include "Utils.hpp"
namespace Slic3r namespace Slic3r
{ {
@ -93,7 +94,7 @@ struct SlicingParameters
coordf_t object_print_z_min; coordf_t object_print_z_min;
coordf_t object_print_z_max; coordf_t object_print_z_max;
}; };
static_assert(std::is_trivially_copyable<SlicingParameters>::value, "SlicingParameters class is not POD (and it should be - see constructor)."); static_assert(IsTriviallyCopyable<SlicingParameters>::value, "SlicingParameters class is not POD (and it should be - see constructor).");
// The two slicing parameters lead to the same layering as long as the variable layer thickness is not in action. // The two slicing parameters lead to the same layering as long as the variable layer thickness is not in action.

View File

@ -159,6 +159,16 @@ template<class T> size_t next_highest_power_of_2(T v,
extern std::string xml_escape(std::string text); extern std::string xml_escape(std::string text);
#if defined __GNUC__ & __GNUC__ < 5
// Older GCCs don't have std::is_trivially_copyable
// cf. https://gcc.gnu.org/onlinedocs/gcc-4.9.4/libstdc++/manual/manual/status.html#status.iso.2011
#warning "GCC version < 5, faking std::is_trivially_copyable"
template<typename T> struct IsTriviallyCopyable { static constexpr bool value = true; };
#else
template<typename T> struct IsTriviallyCopyable : public std::is_trivially_copyable<T> {};
#endif
class ScopeGuard class ScopeGuard
{ {
public: public: