Unverified Commit 07cc9616 authored by Scott Cyphers's avatar Scott Cyphers Committed by GitHub

Fix clang warnings on macos (#801)

* Fix clang warnings on macos

* Conditionalize warning on Apple clang version.
parent d92a5103
...@@ -26,6 +26,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-global-constructors") ...@@ -26,6 +26,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-global-constructors")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-exit-time-destructors") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-exit-time-destructors")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-prototypes") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-prototypes")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-noreturn") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-noreturn")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.1.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-zero-as-null-pointer-constant")
endif()
endif()
# # should remove these # # should remove these
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast") # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast")
...@@ -34,3 +39,4 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-conversion") ...@@ -34,3 +39,4 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-conversion")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-padded") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-padded")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
...@@ -35,7 +35,7 @@ namespace ngraph ...@@ -35,7 +35,7 @@ namespace ngraph
class DenseTensorViewLayout : public TensorViewLayout class DenseTensorViewLayout : public TensorViewLayout
{ {
public: public:
~DenseTensorViewLayout() {} ~DenseTensorViewLayout() override {}
DenseTensorViewLayout(const TensorView& tensor_view); DenseTensorViewLayout(const TensorView& tensor_view);
virtual size_t get_size() override { return m_size; } virtual size_t get_size() override { return m_size; }
......
...@@ -104,7 +104,7 @@ namespace ngraph ...@@ -104,7 +104,7 @@ namespace ngraph
set_value_type_checked(vt); set_value_type_checked(vt);
} }
virtual ~Constant(); virtual ~Constant() override;
/// \brief Wrapper around constructing a shared_ptr of a Constant /// \brief Wrapper around constructing a shared_ptr of a Constant
/// ///
......
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
std::vector<std::shared_ptr<ngraph::op::FunctionCall>> std::vector<std::shared_ptr<ngraph::op::FunctionCall>>
create_inlining_plan(std::shared_ptr<ngraph::Function> f, size_t depth) override; create_inlining_plan(std::shared_ptr<ngraph::Function> f, size_t depth) override;
virtual ~InlineSmallCalls() {} virtual ~InlineSmallCalls() override {}
private: private:
size_t m_call_size_limit; size_t m_call_size_limit;
size_t m_depth; size_t m_depth;
......
...@@ -47,7 +47,7 @@ namespace ngraph ...@@ -47,7 +47,7 @@ namespace ngraph
public: public:
CPU_CallFrame(std::shared_ptr<CPU_ExternalFunction> external_function, CPU_CallFrame(std::shared_ptr<CPU_ExternalFunction> external_function,
EntryPoint compiled_function); EntryPoint compiled_function);
~CPU_CallFrame(); ~CPU_CallFrame() override;
/// @brief Invoke the function with values matching the signature of the function. /// @brief Invoke the function with values matching the signature of the function.
/// ///
......
...@@ -39,7 +39,7 @@ namespace ngraph ...@@ -39,7 +39,7 @@ namespace ngraph
public: public:
LayoutDescriptor(const ngraph::descriptor::TensorView& tv, LayoutDescriptor(const ngraph::descriptor::TensorView& tv,
const AxisVector& tv_axis_order); const AxisVector& tv_axis_order);
~LayoutDescriptor() {} ~LayoutDescriptor() override {}
size_t get_size() override { return size; } size_t get_size() override { return size; }
size_t get_offset() const { return offset; } size_t get_offset() const { return offset; }
size_t get_index_offset(const std::vector<size_t>& indices) override; size_t get_index_offset(const std::vector<size_t>& indices) override;
......
...@@ -33,7 +33,7 @@ namespace ngraph ...@@ -33,7 +33,7 @@ namespace ngraph
CPUTensorView(const ngraph::element::Type& element_type, CPUTensorView(const ngraph::element::Type& element_type,
const Shape& shape, const Shape& shape,
const std::string& name = "external"); const std::string& name = "external");
virtual ~CPUTensorView(); virtual ~CPUTensorView() override;
char* get_data_ptr(); char* get_data_ptr();
const char* get_data_ptr() const; const char* get_data_ptr() const;
......
...@@ -37,7 +37,7 @@ public: ...@@ -37,7 +37,7 @@ public:
HostTensorView(const ngraph::element::Type& element_type, HostTensorView(const ngraph::element::Type& element_type,
const Shape& shape, const Shape& shape,
const std::string& name = "external"); const std::string& name = "external");
virtual ~HostTensorView(); virtual ~HostTensorView() override;
char* get_data_ptr(); char* get_data_ptr();
const char* get_data_ptr() const; const char* get_data_ptr() const;
......
...@@ -95,7 +95,7 @@ using descriptor::layout::DenseTensorViewLayout; ...@@ -95,7 +95,7 @@ using descriptor::layout::DenseTensorViewLayout;
runtime::interpreter::ExternalFunction::ExternalFunction(const shared_ptr<Function>& function, runtime::interpreter::ExternalFunction::ExternalFunction(const shared_ptr<Function>& function,
bool release_function) bool release_function)
: runtime::ExternalFunction(function, release_function) : runtime::ExternalFunction(function, release_function)
, m_function(function) , m_interpreter_function(function)
{ {
} }
...@@ -106,14 +106,14 @@ void runtime::interpreter::ExternalFunction::compile() ...@@ -106,14 +106,14 @@ void runtime::interpreter::ExternalFunction::compile()
return; return;
} }
string function_name = m_function->get_name(); string function_name = m_interpreter_function->get_name();
string dump_filename = file_util::path_join(s_output_dir, function_name + "_ops.txt"); string dump_filename = file_util::path_join(s_output_dir, function_name + "_ops.txt");
pass::Manager pass_manager; pass::Manager pass_manager;
// For now, just make everyone row-major. // For now, just make everyone row-major.
pass_manager.register_pass<pass::AssignLayout<DenseTensorViewLayout>>(); pass_manager.register_pass<pass::AssignLayout<DenseTensorViewLayout>>();
pass_manager.register_pass<pass::Liveness>(); pass_manager.register_pass<pass::Liveness>();
pass_manager.run_passes(m_function); pass_manager.run_passes(m_interpreter_function);
m_is_compiled = true; m_is_compiled = true;
if (m_release_function) if (m_release_function)
...@@ -129,5 +129,6 @@ shared_ptr<runtime::CallFrame> runtime::interpreter::ExternalFunction::make_call ...@@ -129,5 +129,6 @@ shared_ptr<runtime::CallFrame> runtime::interpreter::ExternalFunction::make_call
compile(); compile();
} }
return make_shared<runtime::interpreter::INT_CallFrame>(shared_from_this(), m_function); return make_shared<runtime::interpreter::INT_CallFrame>(shared_from_this(),
m_interpreter_function);
} }
...@@ -37,7 +37,7 @@ namespace ngraph ...@@ -37,7 +37,7 @@ namespace ngraph
std::shared_ptr<ngraph::runtime::CallFrame> make_call_frame(); std::shared_ptr<ngraph::runtime::CallFrame> make_call_frame();
protected: protected:
std::shared_ptr<ngraph::Function> m_function; std::shared_ptr<ngraph::Function> m_interpreter_function;
void compile(); void compile();
}; };
} }
......
...@@ -1032,7 +1032,7 @@ TEST(cpu_fusion, rnn_fusion_from_json_model) ...@@ -1032,7 +1032,7 @@ TEST(cpu_fusion, rnn_fusion_from_json_model)
pass_manager.run_passes(func); pass_manager.run_passes(func);
const size_t NUM_STEPS = 10; const size_t NUM_STEPS = 10;
auto mmb_predicate = [NUM_STEPS](std::shared_ptr<Node> node) { auto mmb_predicate = [](std::shared_ptr<Node> node) {
auto users = node->get_users(); auto users = node->get_users();
return users.size() == NUM_STEPS && return users.size() == NUM_STEPS &&
std::all_of(begin(users), end(users), [](std::shared_ptr<Node> n) { std::all_of(begin(users), end(users), [](std::shared_ptr<Node> n) {
......
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