Commit 127508ee authored by Sang Ik Lee's avatar Sang Ik Lee Committed by Scott Cyphers

Workaround for #pragma GCC diagnostic error. (Another version) (#2945)

* Don't use
pragma GCC diagnostic error "-Wswitch"
pragma GCC diagnostic error "-Wswitch-enum"
for GCC 4.8.X

* Fix typo.

* Style.
parent 94f4dfec
......@@ -53,9 +53,11 @@ vector<string> op::Constant::get_value_strings() const
{
vector<string> rc;
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
#endif
switch (get_element_type().get_type_enum())
{
case element::Type_t::boolean:
......@@ -139,7 +141,9 @@ vector<string> op::Constant::get_value_strings() const
case element::Type_t::undefined: throw runtime_error("unsupported type");
case element::Type_t::dynamic: throw runtime_error("unsupported type");
}
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#pragma GCC diagnostic pop
#endif
return rc;
}
......
......@@ -259,9 +259,11 @@ namespace ngraph
{
throw std::runtime_error("Constant initializer does not match shape");
}
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
#endif
switch (target_type.get_type_enum())
{
case element::Type_t::boolean:
......@@ -306,7 +308,9 @@ namespace ngraph
case element::Type_t::undefined: throw std::runtime_error("unsupported type");
case element::Type_t::dynamic: throw std::runtime_error("unsupported type");
}
#if !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic pop
#endif
}
static constexpr size_t host_alignment() { return 64; }
......
......@@ -194,10 +194,12 @@ private:
// We want to check that every OP_TYPEID enumeration is included in the list.
// These GCC flags enable compile-time checking so that if an enumeration
// is not in the list an error is generated.
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
// #pragma GCC diagnostic error "-Wcovered-switch-default"
// #pragma GCC diagnostic error "-Wcovered-switch-default"
#endif
switch (node_wrapper.get_typeid())
{
case OP_TYPEID::Abs:
......@@ -1374,7 +1376,9 @@ private:
break;
}
default: throw unsupported_op("Unsupported op '" + node.description() + "'");
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#pragma GCC diagnostic pop
#endif
}
}
};
......@@ -455,9 +455,11 @@ shared_ptr<runtime::Executable>
// We want to check that every OP_TYPEID enumeration is included in the list.
// These GCC flags enable compile-time checking so that if an enumeration
// is not in the list an error is generated.
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
#endif
switch (op_type_id)
{
case OP_TYPEID::Parameter:
......@@ -2087,7 +2089,9 @@ shared_ptr<runtime::Executable>
throw unsupported_op("Unsupported op '" + op->description() +
"' in IntelGPU back end.");
}
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#pragma GCC diagnostic pop
#endif
}
}
......
......@@ -199,10 +199,12 @@ private:
// We want to check that every OP_TYPEID enumeration is included in the list.
// These GCC flags enable compile-time checking so that if an enumeration
// is not in the list an error is generated.
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
// #pragma GCC diagnostic error "-Wcovered-switch-default"
// #pragma GCC diagnostic error "-Wcovered-switch-default"
#endif
switch (node_wrapper.get_typeid())
{
case OP_TYPEID::Abs:
......@@ -1425,7 +1427,9 @@ private:
case OP_TYPEID::DynPad:
case OP_TYPEID::Tile:
default: throw unsupported_op("Unsupported op '" + node.description() + "'");
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#pragma GCC diagnostic pop
#endif
}
}
};
......@@ -501,10 +501,12 @@ static shared_ptr<ngraph::Function>
{
args.push_back(node_map.at(name));
}
#if !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
// #pragma GCC diagnostic error "-Wimplicit-fallthrough"
// #pragma GCC diagnostic error "-Wimplicit-fallthrough"
#endif
switch (get_typeid(node_op))
{
case OP_TYPEID::Abs:
......@@ -1520,7 +1522,9 @@ static shared_ptr<ngraph::Function>
throw runtime_error(ss.str());
}
}
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#pragma GCC diagnostic pop
#endif
for (const string& name : control_deps_inputs)
{
......@@ -1637,10 +1641,12 @@ static json write(const Node& n, bool binary_constant_data)
}
string node_op = n.description();
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#pragma GCC diagnostic error "-Wswitch-enum"
// #pragma GCC diagnostic error "-Wimplicit-fallthrough"
// #pragma GCC diagnostic error "-Wimplicit-fallthrough"
#endif
switch (get_typeid(node_op))
{
case OP_TYPEID::Abs: { break;
......@@ -2246,7 +2252,9 @@ static json write(const Node& n, bool binary_constant_data)
case OP_TYPEID::UnknownOp: { break;
}
}
#if !(defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 8))
#pragma GCC diagnostic pop
#endif
return node;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment