Skip to content

Commit

Permalink
Suppress uninitialized variable warnings in zstd (#177)
Browse files Browse the repository at this point in the history
* Format BUILD.zstd

* -Wno-uninitialized for zstd legacy

should fix #176

* Don't pass the -Wno-... flag on Windows
  • Loading branch information
nelhage authored May 1, 2020
1 parent fe9a079 commit 135d46b
Showing 1 changed file with 137 additions and 122 deletions.
259 changes: 137 additions & 122 deletions BUILD.zstd
Original file line number Diff line number Diff line change
@@ -1,223 +1,238 @@
cc_library(
name = 'zstd',
hdrs = ['lib/zstd.h'],
includes = ['lib'],
visibility = ['//visibility:public'],
name = "zstd",
hdrs = ["lib/zstd.h"],
includes = ["lib"],
visibility = ["//visibility:public"],
deps = [
':common',
':compress',
':decompress',
':deprecated',
":common",
":compress",
":decompress",
":deprecated",
],
)

cc_library(
name = 'compress',
visibility = ['//visibility:public'],
name = "compress",
srcs = glob([
"lib/compress/zstd*.c",
"lib/compress/hist.c",
]),
hdrs = glob([
'lib/compress/zstd*.h',
"lib/compress/zstd*.h",
]),
srcs = glob(['lib/compress/zstd*.c', 'lib/compress/hist.c']),
deps = [':common'],
visibility = ["//visibility:public"],
deps = [":common"],
)

cc_library(
name = 'decompress',
visibility = ['//visibility:public'],
name = "decompress",
srcs = glob(["lib/decompress/zstd*.c"]) + [
"lib/decompress/zstd_decompress_internal.h",
"lib/decompress/zstd_decompress_block.h",
"lib/decompress/zstd_ddict.h",
],
hdrs = glob([
'lib/decompress/*_impl.h',
"lib/decompress/*_impl.h",
]),
srcs = glob(['lib/decompress/zstd*.c']) + [
'lib/decompress/zstd_decompress_internal.h',
'lib/decompress/zstd_decompress_block.h',
'lib/decompress/zstd_ddict.h',
],
visibility = ["//visibility:public"],
deps = [
':common',
':legacy',
":common",
":legacy",
],
)

cc_library(
name = 'deprecated',
visibility = ['//visibility:public'],
name = "deprecated",
srcs = glob(["lib/deprecated/*.c"]),
hdrs = glob([
'lib/deprecated/*.h',
"lib/deprecated/*.h",
]),
srcs = glob(['lib/deprecated/*.c']),
deps = [':common'],
visibility = ["//visibility:public"],
deps = [":common"],
)

cc_library(
name = 'legacy',
visibility = ['//visibility:public'],
includes = [ 'lib/legacy' ],
name = "legacy",
srcs = glob(["lib/legacy/*.c"]),
hdrs = glob([
'lib/legacy/*.h',
"lib/legacy/*.h",
]),
srcs = glob(['lib/legacy/*.c']),
deps = [':common'],
copts =
select({
":windows": [],
"//conditions:default": ["-Wno-uninitialized"],
}),
defines = [
'ZSTD_LEGACY_SUPPORT=4',
"ZSTD_LEGACY_SUPPORT=4",
],
includes = ["lib/legacy"],
visibility = ["//visibility:public"],
deps = [":common"],
)

cc_library(
name = 'compiler',
visibility = ['//visibility:public'],
includes = ['lib/common'],
name = "compiler",
hdrs = [
'lib/common/compiler.h',
"lib/common/compiler.h",
],
includes = ["lib/common"],
visibility = ["//visibility:public"],
)

cc_library(
name = 'cpu',
visibility = ['//visibility:public'],
name = "cpu",
hdrs = [
'lib/common/cpu.h',
"lib/common/cpu.h",
],
visibility = ["//visibility:public"],
)

cc_library(
name = 'bitstream',
visibility = ['//visibility:public'],
name = "bitstream",
hdrs = [
'lib/common/bitstream.h',
"lib/common/bitstream.h",
],
visibility = ["//visibility:public"],
)

cc_library(
name = 'entropy',
visibility = ['//visibility:public'],
hdrs = [
'lib/common/fse.h',
'lib/common/huf.h',
],
name = "entropy",
srcs = [
'lib/common/entropy_common.c',
'lib/common/fse_decompress.c',
'lib/compress/fse_compress.c',
'lib/compress/huf_compress.c',
'lib/compress/hist.h',
'lib/decompress/huf_decompress.c',
"lib/common/entropy_common.c",
"lib/common/fse_decompress.c",
"lib/compress/fse_compress.c",
"lib/compress/hist.h",
"lib/compress/huf_compress.c",
"lib/decompress/huf_decompress.c",
],
hdrs = [
"lib/common/fse.h",
"lib/common/huf.h",
],
visibility = ["//visibility:public"],
deps = [
':debug',
':bitstream',
':compiler',
':errors',
':mem',
":bitstream",
":compiler",
":debug",
":errors",
":mem",
],
)

cc_library(
name = 'errors',
visibility = ['//visibility:public'],
name = "errors",
srcs = ["lib/common/error_private.c"],
hdrs = [
'lib/common/error_private.h',
'lib/common/zstd_errors.h',
"lib/common/error_private.h",
"lib/common/zstd_errors.h",
],
srcs = ['lib/common/error_private.c'],
visibility = ["//visibility:public"],
)

cc_library(
name = 'mem',
visibility = ['//visibility:public'],
name = "mem",
hdrs = [
'lib/common/mem.h',
"lib/common/mem.h",
],
visibility = ["//visibility:public"],
)

cc_library(
name = 'pool',
visibility = ['//visibility:public'],
hdrs = [
'lib/common/pool.h',
],
name = "pool",
srcs = [
'lib/common/pool.c'
"lib/common/pool.c",
],
hdrs = [
"lib/common/pool.h",
],
visibility = ["//visibility:public"],
deps = [
':threading',
':zstd_common',
":threading",
":zstd_common",
],
)

cc_library(
name = 'threading',
visibility = ['//visibility:public'],
name = "threading",
srcs = ["lib/common/threading.c"],
hdrs = [
'lib/common/threading.h',
"lib/common/threading.h",
],
srcs = ['lib/common/threading.c'],
defines = [
'ZSTD_MULTITHREAD',
"ZSTD_MULTITHREAD",
],
linkopts = [
'-pthread',
"-pthread",
],
visibility = ["//visibility:public"],
deps = [
':debug',
":debug",
],
)

cc_library(
name = 'xxhash',
visibility = ['//visibility:public'],
name = "xxhash",
srcs = ["lib/common/xxhash.c"],
hdrs = [
'lib/common/xxhash.h',
"lib/common/xxhash.h",
],
srcs = ['lib/common/xxhash.c'],
defines = [
'XXH_NAMESPACE=ZSTD_',
"XXH_NAMESPACE=ZSTD_",
],
visibility = ["//visibility:public"],
)

cc_library(
name = 'zstd_common',
visibility = ['//visibility:public'],
name = "zstd_common",
srcs = ["lib/common/zstd_common.c"],
hdrs = [
'lib/zstd.h',
'lib/common/zstd_internal.h',
"lib/common/zstd_internal.h",
"lib/zstd.h",
],
includes = ['lib'],
srcs = ['lib/common/zstd_common.c'],
includes = ["lib"],
visibility = ["//visibility:public"],
deps = [
':compiler',
':errors',
':mem',
':debug',
':entropy',
':xxhash',
":compiler",
":debug",
":entropy",
":errors",
":mem",
":xxhash",
],
)

cc_library(
name = 'debug',
visibility = ["//visibility:public"],
includes = ['lib/common'],
hdrs = [
'lib/common/debug.h',
],
name = "debug",
srcs = [
'lib/common/debug.c',
"lib/common/debug.c",
],
hdrs = [
"lib/common/debug.h",
],
includes = ["lib/common"],
visibility = ["//visibility:public"],
)

cc_library(
name = 'common',
name = "common",
deps = [
':debug',
':bitstream',
':compiler',
':cpu',
':entropy',
':errors',
':mem',
':pool',
':threading',
':xxhash',
':zstd_common',
]
":bitstream",
":compiler",
":cpu",
":debug",
":entropy",
":errors",
":mem",
":pool",
":threading",
":xxhash",
":zstd_common",
],
)

config_setting(
name = "windows",
constraint_values = [
"@bazel_tools//platforms:windows",
],
)

0 comments on commit 135d46b

Please sign in to comment.