Add -Wc++14-compat to common TFLite warning opts
PiperOrigin-RevId: 351631306 Change-Id: Ie0b5b545d23751ce216a72a43d83d2b95dc4200d
This commit is contained in:
parent
ec31ec335a
commit
26c468322d
@ -1,5 +1,5 @@
|
||||
load("//tensorflow:tensorflow.bzl", "if_not_windows", "tf_cc_test")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_cc_shared_object", "tflite_copts")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_cc_shared_object", "tflite_copts", "tflite_copts_warnings")
|
||||
load("//tensorflow/lite:special_rules.bzl", "internal_visibility_allowlist", "tflite_portable_test_suite")
|
||||
load("//tensorflow:tensorflow.bzl", "get_compatible_with_portable")
|
||||
|
||||
@ -58,12 +58,6 @@ config_setting(
|
||||
},
|
||||
)
|
||||
|
||||
TFLITE_DEFAULT_COPTS = if_not_windows([
|
||||
"-Wall",
|
||||
"-Wno-comment",
|
||||
"-Wno-extern-c-compat",
|
||||
])
|
||||
|
||||
FRAMEWORK_LIB_HDRS = [
|
||||
"allocation.h",
|
||||
"context.h",
|
||||
@ -91,7 +85,7 @@ cc_library(
|
||||
name = "version",
|
||||
hdrs = ["version.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
# Note that we only use the header defines from :version_lib.
|
||||
deps = ["//tensorflow/core:version_lib"],
|
||||
)
|
||||
@ -109,7 +103,7 @@ cc_library(
|
||||
srcs = ["arena_planner.cc"],
|
||||
hdrs = ["arena_planner.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
deps = [
|
||||
":graph_info",
|
||||
":memory_planner",
|
||||
@ -140,7 +134,7 @@ cc_library(
|
||||
name = "context",
|
||||
hdrs = ["context.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
deps = ["//tensorflow/lite/c:common"],
|
||||
)
|
||||
|
||||
@ -149,7 +143,7 @@ cc_library(
|
||||
srcs = ["external_cpu_backend_context.cc"],
|
||||
hdrs = ["external_cpu_backend_context.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
deps = [
|
||||
"//tensorflow/lite/c:common",
|
||||
],
|
||||
@ -159,7 +153,7 @@ cc_library(
|
||||
name = "graph_info",
|
||||
hdrs = ["graph_info.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
deps = ["//tensorflow/lite/c:common"],
|
||||
)
|
||||
|
||||
@ -167,7 +161,7 @@ cc_library(
|
||||
name = "memory_planner",
|
||||
hdrs = ["memory_planner.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
deps = ["//tensorflow/lite/c:common"],
|
||||
)
|
||||
|
||||
@ -176,7 +170,7 @@ cc_library(
|
||||
srcs = ["simple_memory_arena.cc"],
|
||||
hdrs = ["simple_memory_arena.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
deps = ["//tensorflow/lite/c:common"],
|
||||
)
|
||||
|
||||
@ -211,7 +205,7 @@ cc_library(
|
||||
"string_type.h",
|
||||
],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
)
|
||||
|
||||
cc_library(
|
||||
@ -233,7 +227,7 @@ cc_library(
|
||||
"allocation.h",
|
||||
],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
deps = [
|
||||
":string",
|
||||
"//tensorflow/lite/c:common",
|
||||
@ -247,7 +241,7 @@ cc_library(
|
||||
name = "framework_lib",
|
||||
hdrs = FRAMEWORK_LIB_HDRS,
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = tflite_copts() + TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
visibility = [
|
||||
"//tensorflow/lite:__subpackages__",
|
||||
],
|
||||
@ -292,7 +286,7 @@ cc_library(
|
||||
srcs = [],
|
||||
hdrs = FRAMEWORK_LIB_HDRS,
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = tflite_copts() + TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
deps = [
|
||||
":allocation",
|
||||
":arena_planner",
|
||||
@ -335,7 +329,7 @@ cc_library(
|
||||
"model_builder.h",
|
||||
],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = tflite_copts() + TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
visibility = [
|
||||
"//tensorflow/lite/core/shims:__subpackages__",
|
||||
"//tensorflow/lite/kernels:__subpackages__",
|
||||
@ -377,7 +371,7 @@ cc_library(
|
||||
],
|
||||
hdrs = ["optional_debug_tools.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = tflite_copts() + TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
@ -393,7 +387,7 @@ cc_library(
|
||||
name = "error_reporter",
|
||||
hdrs = ["error_reporter.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = tflite_copts() + TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
@ -408,7 +402,7 @@ cc_library(
|
||||
srcs = ["stderr_reporter.cc"],
|
||||
hdrs = ["stderr_reporter.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = tflite_copts() + TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
@ -423,7 +417,7 @@ cc_library(
|
||||
name = "op_resolver",
|
||||
hdrs = ["op_resolver.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = tflite_copts() + TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
@ -438,7 +432,7 @@ cc_library(
|
||||
srcs = ["mutable_op_resolver.cc"],
|
||||
hdrs = ["mutable_op_resolver.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = tflite_copts() + TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
@ -454,7 +448,7 @@ cc_library(
|
||||
srcs = ["string_util.cc"],
|
||||
hdrs = ["string_util.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
deps = [
|
||||
":string",
|
||||
"//tensorflow/lite/c:common",
|
||||
@ -466,7 +460,7 @@ cc_library(
|
||||
cc_library(
|
||||
name = "tflite_with_xnnpack",
|
||||
srcs = ["tflite_with_xnnpack.cc"],
|
||||
copts = tflite_copts() + TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
linkstatic = True,
|
||||
deps = [
|
||||
"//tensorflow/lite/c:common",
|
||||
@ -517,7 +511,7 @@ cc_library(
|
||||
"tflite_with_xnnpack_optional.h",
|
||||
],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = tflite_copts() + TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
deps = [
|
||||
"//tensorflow/lite/c:common",
|
||||
] + select({
|
||||
@ -712,7 +706,7 @@ cc_library(
|
||||
srcs = ["util.cc"],
|
||||
hdrs = ["util.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS + tflite_copts(),
|
||||
copts = tflite_copts_warnings() + tflite_copts(),
|
||||
deps = [
|
||||
":kernel_api",
|
||||
"//tensorflow/lite/c:common",
|
||||
@ -766,7 +760,7 @@ cc_library(
|
||||
}),
|
||||
hdrs = ["minimal_logging.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS + tflite_copts(),
|
||||
copts = tflite_copts_warnings() + tflite_copts(),
|
||||
linkopts = select({
|
||||
"//tensorflow:android": ["-llog"],
|
||||
"//conditions:default": [],
|
||||
|
@ -11,7 +11,7 @@ load("//tensorflow/lite/java:aar_with_jni.bzl", "aar_with_jni")
|
||||
load("@build_bazel_rules_android//android:rules.bzl", "android_library")
|
||||
|
||||
def tflite_copts():
|
||||
"""Defines compile time flags."""
|
||||
"""Defines common compile time flags for TFLite libraries."""
|
||||
copts = [
|
||||
"-DFARMHASH_NO_CXX_STRING",
|
||||
] + select({
|
||||
@ -46,6 +46,27 @@ def tflite_copts():
|
||||
|
||||
return copts
|
||||
|
||||
def tflite_copts_warnings():
|
||||
"""Defines common warning flags used primarily by internal TFLite libraries."""
|
||||
|
||||
# TODO(b/155906820): Include with `tflite_copts()` after validating clients.
|
||||
|
||||
return select({
|
||||
clean_dep("//tensorflow:windows"): [
|
||||
# We run into trouble on Windows toolchains with warning flags,
|
||||
# as mentioned in the comments below on each flag.
|
||||
# We could be more aggressive in enabling supported warnings on each
|
||||
# Windows toolchain, but we compromise with keeping BUILD files simple
|
||||
# by limiting the number of config_setting's.
|
||||
],
|
||||
"//conditions:default": [
|
||||
"-Wall",
|
||||
# TensorFlow is C++14 at the moment. This flag ensures that we warn
|
||||
# on any code that isn't C++14. Not supported by MSVC.
|
||||
"-Wc++14-compat",
|
||||
],
|
||||
})
|
||||
|
||||
EXPORTED_SYMBOLS = clean_dep("//tensorflow/lite/java/src/main/native:exported_symbols.lds")
|
||||
LINKER_SCRIPT = clean_dep("//tensorflow/lite/java/src/main/native:version_script.lds")
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
# Description: this package contains shim library targets that forward
|
||||
# to the TF Lite C and C++ API targets. See README.md.
|
||||
|
||||
load("//tensorflow:tensorflow.bzl", "if_not_windows")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_copts")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_copts", "tflite_copts_warnings")
|
||||
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite")
|
||||
load("//tensorflow:tensorflow.bzl", "get_compatible_with_portable")
|
||||
load(":build_defs.bzl", "build_test")
|
||||
@ -12,12 +11,6 @@ package(
|
||||
licenses = ["notice"], # Apache 2.0
|
||||
)
|
||||
|
||||
TFLITE_DEFAULT_COPTS = if_not_windows([
|
||||
"-Wall",
|
||||
"-Wno-comment",
|
||||
"-Wno-extern-c-compat",
|
||||
])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# C++ API
|
||||
|
||||
@ -47,7 +40,7 @@ cc_library(
|
||||
srcs = [],
|
||||
hdrs = FRAMEWORK_LIB_HDRS + CC_API_HDRS,
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = tflite_copts() + TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
visibility = [
|
||||
"//tensorflow/lite:__subpackages__",
|
||||
"//tensorflow_lite_support:__subpackages__",
|
||||
@ -79,7 +72,7 @@ cc_library(
|
||||
srcs = [],
|
||||
hdrs = CC_API_HDRS,
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = tflite_copts() + TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
visibility = ["//tensorflow/lite:__pkg__"],
|
||||
deps = [
|
||||
"//tensorflow/lite:allocation",
|
||||
@ -139,7 +132,7 @@ cc_library(
|
||||
name = "c_api",
|
||||
hdrs = ["c/c_api.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
visibility = [
|
||||
"//tensorflow/lite:__subpackages__",
|
||||
"//tensorflow_lite_support:__subpackages__",
|
||||
@ -151,7 +144,7 @@ cc_library(
|
||||
name = "c_api_experimental",
|
||||
hdrs = ["c/c_api_experimental.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
visibility = [
|
||||
"//tensorflow/lite:__subpackages__",
|
||||
"//tensorflow_lite_support:__subpackages__",
|
||||
@ -163,7 +156,7 @@ cc_library(
|
||||
name = "common",
|
||||
hdrs = ["c/common.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
visibility = [
|
||||
"//tensorflow/lite:__subpackages__",
|
||||
"//tensorflow_lite_support:__subpackages__",
|
||||
@ -175,7 +168,7 @@ cc_library(
|
||||
name = "builtin_op_data",
|
||||
hdrs = ["c/builtin_op_data.h"],
|
||||
compatible_with = get_compatible_with_portable(),
|
||||
copts = TFLITE_DEFAULT_COPTS,
|
||||
copts = tflite_copts_warnings(),
|
||||
visibility = [
|
||||
"//tensorflow/lite:__subpackages__",
|
||||
"//tensorflow_lite_support:__subpackages__",
|
||||
|
@ -1,6 +1,5 @@
|
||||
load("//tensorflow:tensorflow.bzl", "if_not_windows")
|
||||
load("//tensorflow:tensorflow.bzl", "get_compatible_with_portable")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_copts")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_copts", "tflite_copts_warnings")
|
||||
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite_combined")
|
||||
|
||||
package(
|
||||
@ -8,7 +7,7 @@ package(
|
||||
licenses = ["notice"], # Apache 2.0
|
||||
)
|
||||
|
||||
common_copts = tflite_copts() + if_not_windows(["-Wall"])
|
||||
common_copts = tflite_copts() + tflite_copts_warnings()
|
||||
|
||||
cc_library(
|
||||
name = "profiler",
|
||||
|
@ -1,5 +1,5 @@
|
||||
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_copts")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_copts", "tflite_copts_warnings")
|
||||
load("//tensorflow:tensorflow.bzl", "tf_cc_binary", "tf_cc_test")
|
||||
|
||||
package(
|
||||
@ -13,8 +13,6 @@ exports_files([
|
||||
"logging.h",
|
||||
])
|
||||
|
||||
common_copts = ["-Wall"]
|
||||
|
||||
py_binary(
|
||||
name = "visualize",
|
||||
srcs = ["visualize.py"],
|
||||
@ -236,7 +234,7 @@ cc_test(
|
||||
cc_library(
|
||||
name = "logging",
|
||||
hdrs = ["logging.h"],
|
||||
copts = common_copts,
|
||||
copts = tflite_copts_warnings(),
|
||||
)
|
||||
|
||||
cc_library(
|
||||
|
@ -1,6 +1,6 @@
|
||||
load("//tensorflow:tensorflow.bzl", "tf_cc_binary")
|
||||
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_copts", "tflite_linkopts")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_copts", "tflite_copts_warnings", "tflite_linkopts")
|
||||
|
||||
package(
|
||||
default_visibility = [
|
||||
@ -9,7 +9,7 @@ package(
|
||||
licenses = ["notice"], # Apache 2.0
|
||||
)
|
||||
|
||||
common_copts = ["-Wall"] + tflite_copts()
|
||||
common_copts = tflite_copts() + tflite_copts_warnings()
|
||||
|
||||
# We create a library for benchmark_main.cc to faciliate the creation of a
|
||||
# customized benchmark model binary that only needs linking with extra
|
||||
@ -237,7 +237,6 @@ cc_test(
|
||||
srcs = [
|
||||
"benchmark_utils_test.cc",
|
||||
],
|
||||
copts = common_copts,
|
||||
deps = [
|
||||
":benchmark_utils",
|
||||
"//tensorflow/lite/profiling:time",
|
||||
|
@ -1,4 +1,4 @@
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_copts")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_copts", "tflite_copts_warnings")
|
||||
|
||||
package(
|
||||
default_visibility = [
|
||||
@ -7,7 +7,7 @@ package(
|
||||
licenses = ["notice"], # Apache 2.0
|
||||
)
|
||||
|
||||
common_copts = ["-Wall"] + tflite_copts()
|
||||
common_copts = tflite_copts() + tflite_copts_warnings()
|
||||
|
||||
cc_library(
|
||||
name = "delegate_provider_hdr",
|
||||
|
@ -1,7 +1,6 @@
|
||||
# Utilities for signature_defs in TFLite
|
||||
load("//tensorflow:tensorflow.bzl", "pybind_extension")
|
||||
load("//tensorflow:tensorflow.bzl", "if_not_windows")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_copts")
|
||||
load("//tensorflow/lite:build_def.bzl", "tflite_copts", "tflite_copts_warnings")
|
||||
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite")
|
||||
|
||||
package(
|
||||
@ -11,17 +10,11 @@ package(
|
||||
licenses = ["notice"], # Apache 2.0
|
||||
)
|
||||
|
||||
TFLITE_DEFAULT_COPTS = if_not_windows([
|
||||
"-Wall",
|
||||
"-Wno-comment",
|
||||
"-Wno-extern-c-compat",
|
||||
])
|
||||
|
||||
cc_library(
|
||||
name = "signature_def_util",
|
||||
srcs = ["signature_def_util.cc"],
|
||||
hdrs = ["signature_def_util.h"],
|
||||
copts = TFLITE_DEFAULT_COPTS + tflite_copts(),
|
||||
copts = tflite_copts() + tflite_copts_warnings(),
|
||||
deps = [
|
||||
"//tensorflow/core:lib_proto_parsing",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
|
Loading…
Reference in New Issue
Block a user