mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
gcc compatibility
This commit is contained in:
@@ -31,6 +31,8 @@ import re
|
||||
import os
|
||||
import csv
|
||||
|
||||
from builtins import open
|
||||
|
||||
try: from html.entities import entitydefs
|
||||
except: from htmlentitydefs import entitydefs
|
||||
|
||||
@@ -45,17 +47,17 @@ regices = list(zip([re.compile(s,re.M) for s in [r'<[\w\n=" \-/\.;_\t:%#,\?\(\)]
|
||||
definition_files = ['DocEntity.csv', 'DocEnumeration.csv', 'DocDefined.csv', 'DocSelect.csv']
|
||||
definition_files = map(make_absolute, definition_files)
|
||||
for fn in definition_files:
|
||||
with open(fn) as f:
|
||||
with open(fn, encoding='utf-8', errors='ignore') as f:
|
||||
for oid, name, desc in csv.reader(f, delimiter=';', quotechar='"'):
|
||||
name_to_oid[name] = oid
|
||||
oid_to_name[oid] = name
|
||||
oid_to_desc[oid] = desc
|
||||
|
||||
with open(make_absolute('DocEntityAttributes.csv')) as f:
|
||||
with open(make_absolute('DocEntityAttributes.csv'), encoding='utf-8', errors='ignore') as f:
|
||||
for pid, x, oid in csv.reader(f, delimiter=';', quotechar='"'):
|
||||
oid_to_pid[oid] = pid
|
||||
|
||||
with open(make_absolute('DocAttribute.csv')) as f:
|
||||
with open(make_absolute('DocAttribute.csv'), encoding='utf-8', errors='ignore') as f:
|
||||
for oid, name, desc in csv.reader(f, delimiter=';', quotechar='"'):
|
||||
pid = oid_to_pid[oid]
|
||||
pname = oid_to_name[pid]
|
||||
|
||||
@@ -80,10 +80,16 @@ class SchemaClass(codegen.Base):
|
||||
for name in collection.keys():
|
||||
statements.append('%(cpp_type)s* %(name)s_type = 0;' % locals())
|
||||
|
||||
statements.append('#ifdef _MSC_VER' )
|
||||
statements.append('#pragma optimize("", off)')
|
||||
statements.append('#endif' )
|
||||
|
||||
statements.append("""
|
||||
#if defined(__clang__)
|
||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("O0")
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma optimize("", off)
|
||||
#endif
|
||||
""")
|
||||
|
||||
statements.append('schema_definition* populate_schema() {')
|
||||
|
||||
emitted_types = set()
|
||||
@@ -181,9 +187,14 @@ class SchemaClass(codegen.Base):
|
||||
|
||||
statements.extend(('}',''))
|
||||
|
||||
statements.append('#ifdef _MSC_VER' )
|
||||
statements.append('#pragma optimize("", on)')
|
||||
statements.append('#endif' )
|
||||
statements.append("""
|
||||
#if defined(__clang__)
|
||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
||||
#pragma GCC pop_options
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma optimize("", on)
|
||||
#endif
|
||||
""")
|
||||
|
||||
statements.extend(('const schema_definition& get_schema() {',
|
||||
'',
|
||||
|
||||
@@ -196,9 +196,12 @@ enumeration_descriptor_map_t enumeration_descriptor_map;
|
||||
inverse_map_t inverse_map;
|
||||
derived_map_t derived_map;
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma optimize( "", off )
|
||||
#if defined(__clang__)
|
||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("O0")
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma optimize("", off)
|
||||
#endif
|
||||
|
||||
void InitDescriptorMap() {
|
||||
@@ -210,10 +213,6 @@ void InitDescriptorMap() {
|
||||
%(enumeration_descriptors)s
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma optimize( "", on )
|
||||
#endif
|
||||
|
||||
void InitInverseMap() {
|
||||
%(inverse_implementations)s
|
||||
}
|
||||
@@ -222,6 +221,13 @@ void InitDerivedMap() {
|
||||
%(derived_field_statements)s
|
||||
}
|
||||
|
||||
#if defined(__clang__)
|
||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
||||
#pragma GCC pop_options
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma optimize("", on)
|
||||
#endif
|
||||
|
||||
int Type::GetAttributeIndex(Enum t, const std::string& a) {
|
||||
if (entity_descriptor_map.empty()) ::InitDescriptorMap();
|
||||
std::map<Type::Enum,IfcEntityDescriptor*>::const_iterator i = entity_descriptor_map.find(t);
|
||||
|
||||
Reference in New Issue
Block a user