mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-20 20:22:09 +00:00
Some fixes for clang
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user