diff --git a/mace/codegen/BUILD b/mace/codegen/BUILD index 29504c9b48255bc3ff543358662136ca1f38b801..8d7374d15df123c54615cfd059cc1db442c9f39b 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 252982f005128b1670224c60d327331d819e46ff..4714a0ebee50f86c7ee162e7cbf149cdeba8a8b6 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 ae1770b135d54a20081af51577313c3a8eef3ff4..341493fcadfad04d099e183b426a0368df45d288 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 9db67631e1cf877c60c96f151ee1ed8a193f4345..45063538648f7dd06b23d1820ed0095adcc0ce1e 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 a2ad37dbe93a1f00a7875cd244f2ecdf3d922f5e..1a3486ee0b624b7f14b04f9dda571e984fab13d2 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 2395ded6179dc8c7102f1ca4c0096aeaedbc9e79..890c46b9f1a273e2246d995ca643a51a138f10fb 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 321f451de2aaf9b141338e716440e507827465e5..5e026997a2d3c0d3ddb558e29ec7b70043f22772 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 d98c167532e0c511fc4775eace32e24e3edbd99a..2eb252ff7df9b85d3c9ffa29cc5f1dffd647f7d0 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"], )