Some fixes for clang

This commit is contained in:
Thomas Krijnen
2018-09-19 14:05:19 +02:00
parent 9a3039765f
commit e8b28a099f
8 changed files with 30 additions and 16 deletions
+1
View File
@@ -1791,6 +1791,7 @@ class IFC2X3_instance_factory : public IfcParse::instance_factory {
#if defined(__clang__)
__attribute__((optnone))
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC push_options
#pragma GCC optimize ("O0")
+1
View File
@@ -2105,6 +2105,7 @@ class IFC4_instance_factory : public IfcParse::instance_factory {
#if defined(__clang__)
__attribute__((optnone))
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC push_options
#pragma GCC optimize ("O0")
+7 -2
View File
@@ -38,6 +38,10 @@ namespace IfcUtil {
class IFC_PARSE_API IfcBaseClass {
protected:
IfcEntityInstanceData* data_;
static bool is_null(const IfcBaseClass* not_this) {
return !not_this;
}
public:
IfcBaseClass() : data_(0) {}
@@ -52,7 +56,8 @@ namespace IfcUtil {
template <class T>
T* as() {
if (this == 0) {
// @todo: do not allow this to be null in the first place
if (is_null(this)) {
return static_cast<T*>(0);
}
return declaration().is(T::Class())
@@ -62,7 +67,7 @@ namespace IfcUtil {
template <class T>
const T* as() const {
if (this == 0) {
if (is_null(this)) {
return static_cast<const T*>(0);
}
return declaration().is(T::Class())
+1 -1
View File
@@ -527,7 +527,7 @@ static void start_element(void* user, const xmlChar* tag, const xmlChar** attrs)
instance_to_attribute(inst_or_reference, attr, newinst);
state->stack.back().inst()->data().setArgument(idx, attr);
state->stack.push_back(stack_node::instance(id_in_file, newinst));
} else if (auto select = attribute_type->as_named_type()->declared_type()->as_select_type()) {
} else if (attribute_type->as_named_type()->declared_type()->as_select_type()) {
// Select types cause an additional indirection, so the current stack node is simply repeated
state->stack.push_back(stack_node::select(state->stack.back().inst(), idx));
}