From e175a1fcf2afc7d881b470ce4b9d88b26da24563 Mon Sep 17 00:00:00 2001 From: Liangliang He Date: Thu, 28 Dec 2017 11:53:00 +0800 Subject: [PATCH] Fix no return error --- mace/codegen/BUILD | 8 ++++---- mace/core/BUILD | 4 ++-- mace/core/operator.cc | 5 ++++- mace/examples/BUILD | 6 +++--- mace/kernels/BUILD | 5 +++-- mace/ops/BUILD | 6 +++--- mace/tools/benchmark/BUILD | 4 ++-- mace/utils/BUILD | 11 ++++++----- 8 files changed, 27 insertions(+), 22 deletions(-) diff --git a/mace/codegen/BUILD b/mace/codegen/BUILD index 29504c9b..8d7374d1 100644 --- a/mace/codegen/BUILD +++ b/mace/codegen/BUILD @@ -10,7 +10,7 @@ load("//mace:mace.bzl", "if_embed_binary_program") cc_library( name = "generated_models_lib", srcs = glob(["models/*/*.cc"]), - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkstatic = 1, deps = [ "//mace/core", @@ -25,21 +25,21 @@ cc_library( cc_library( name = "generated_opencl_lib", srcs = glob(["opencl/*.cc"]), - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkstatic = 1, ) cc_library( name = "generated_tuning_lib", srcs = glob(["tuning/*.cc"]), - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkstatic = 1, ) cc_library( name = "version_lib", srcs = glob(["version/*.cc"]), - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkstatic = 1, deps = [ "//mace/core", diff --git a/mace/core/BUILD b/mace/core/BUILD index 252982f0..4714a0eb 100644 --- a/mace/core/BUILD +++ b/mace/core/BUILD @@ -21,7 +21,7 @@ cc_library( "runtime/opencl/cl2.hpp", "runtime/opencl/*.h", ]), - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"] + + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"] + if_profiling_enabled(["-DMACE_OPENCL_PROFILING"]) + if_embed_binary_program(["-DMACE_EMBED_BINARY_PROGRAM"]), linkopts = if_android(["-pie", "-ldl"]), @@ -43,7 +43,7 @@ cc_library( "testing/test_benchmark.cc", "testing/test_benchmark_main.cc", ], - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], alwayslink = 1, deps = [ ":core", diff --git a/mace/core/operator.cc b/mace/core/operator.cc index ae1770b1..341493fc 100644 --- a/mace/core/operator.cc +++ b/mace/core/operator.cc @@ -14,7 +14,10 @@ OperatorBase::OperatorBase(const OperatorDef &operator_def, Workspace *ws) OpKeyBuilder::OpKeyBuilder(const char *op_name) : op_name_(op_name) {} -OpKeyBuilder &OpKeyBuilder::Device(DeviceType device) { device_type_ = device; } +OpKeyBuilder &OpKeyBuilder::Device(DeviceType device) { + device_type_ = device; + return *this; +} OpKeyBuilder &OpKeyBuilder::TypeConstraint(const char *attr_name, const DataType allowed) { diff --git a/mace/examples/BUILD b/mace/examples/BUILD index 9db67631..45063538 100644 --- a/mace/examples/BUILD +++ b/mace/examples/BUILD @@ -6,7 +6,7 @@ cc_binary( srcs = [ "helloworld.cc", ], - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkopts = if_enable_neon(["-fopenmp"]), deps = [ "//mace/core", @@ -18,7 +18,7 @@ cc_test( name = "benchmark_example", testonly = 1, srcs = ["benchmark_example.cc"], - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkopts = if_enable_neon(["-fopenmp"]), linkstatic = 1, deps = [ @@ -30,7 +30,7 @@ cc_test( cc_binary( name = "mace_run", srcs = ["mace_run.cc"], - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkopts = if_enable_neon(["-fopenmp"]), linkstatic = 1, deps = [ diff --git a/mace/kernels/BUILD b/mace/kernels/BUILD index a2ad37db..1a3486ee 100644 --- a/mace/kernels/BUILD +++ b/mace/kernels/BUILD @@ -20,6 +20,7 @@ cc_library( copts = [ "-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", + "-Werror=return-type", ] + if_embed_binary_program(["-DMACE_EMBED_BINARY_PROGRAM"]) + if_enable_neon(["-fopenmp"]), @@ -34,7 +35,7 @@ cc_test( name = "kernel_test", testonly = 1, srcs = glob(["test/*.cc"]), - copts = ["-std=c++11"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkopts = if_android(["-pie"]), linkstatic = 1, deps = [ @@ -48,7 +49,7 @@ cc_test( name = "benchmark", testonly = 1, srcs = glob(["benchmark/*.cc"]), - copts = ["-std=c++11"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkstatic = 1, deps = [ ":kernels", diff --git a/mace/ops/BUILD b/mace/ops/BUILD index 2395ded6..890c46b9 100644 --- a/mace/ops/BUILD +++ b/mace/ops/BUILD @@ -34,7 +34,7 @@ cc_library( ["*.h"], exclude = ["ops_test_util.h"], ), - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"] + + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"] + if_enable_neon(["-DMACE_ENABLE_NEON"]), deps = [ "//mace/kernels", @@ -48,7 +48,7 @@ cc_test( srcs = glob( ["*_test.cc"], ), - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkopts = ["-fopenmp"], linkstatic = 1, deps = [ @@ -62,7 +62,7 @@ cc_test( name = "ops_benchmark", testonly = 1, srcs = glob(["*_benchmark.cc"]), - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkopts = ["-fopenmp"], linkstatic = 1, deps = [ diff --git a/mace/tools/benchmark/BUILD b/mace/tools/benchmark/BUILD index 321f451d..5e026997 100644 --- a/mace/tools/benchmark/BUILD +++ b/mace/tools/benchmark/BUILD @@ -7,7 +7,7 @@ cc_library( name = "stat_summarizer", srcs = ["stat_summarizer.cc"], hdrs = ["stat_summarizer.h"], - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkstatic = 1, deps = [ "//mace/core", @@ -19,7 +19,7 @@ cc_binary( srcs = [ "benchmark_model.cc", ], - copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkstatic = 1, deps = [ ":stat_summarizer", diff --git a/mace/utils/BUILD b/mace/utils/BUILD index d98c1675..2eb252ff 100644 --- a/mace/utils/BUILD +++ b/mace/utils/BUILD @@ -17,7 +17,7 @@ cc_library( hdrs = [ "logging.h", ], - copts = ["-std=c++11"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkopts = if_android([ "-llog", ]), @@ -31,7 +31,7 @@ cc_library( hdrs = [ "command_line_flags.h", ], - copts = ["-std=c++11"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], deps = [ ":logging", ], @@ -43,7 +43,7 @@ cc_library( "tuner.h", "timer.h", ], - copts = ["-std=c++11"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], deps = [ ":utils_hdrs", ":logging", @@ -56,7 +56,7 @@ cc_test( srcs = [ "tuner_test.cc", ], - copts = ["-std=c++11"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkopts = if_android(["-pie", "-lm"]), linkstatic = 1, deps = [ @@ -72,7 +72,7 @@ cc_library( "utils.h", "env_time.h", ], - copts = ["-std=c++11"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], ) cc_library( @@ -83,4 +83,5 @@ cc_library( ":command_line_flags", ":logging", ], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], ) -- GitLab