Introduce GN config pdfium_noshorten_config
Avoid conditionals every time this is used in BUILD.gn files.
Change-Id: Ic6214b4763350b27c9fd51a255d27f70ee629ab6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/90631
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 3276689..c344c9b 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -289,6 +289,13 @@
]
}
+config("pdfium_noshorten_config") {
+ cflags = []
+ if (is_clang) {
+ cflags += [ "-Wshorten-64-to-32" ]
+ }
+}
+
source_set("pdfium_public_headers_impl") {
sources = [
"public/cpp/fpdf_deleters.h",
diff --git a/core/fdrm/BUILD.gn b/core/fdrm/BUILD.gn
index 0b14d7f..b4557be 100644
--- a/core/fdrm/BUILD.gn
+++ b/core/fdrm/BUILD.gn
@@ -12,13 +12,12 @@
"fx_crypt_aes.cpp",
"fx_crypt_sha.cpp",
]
- cflags = []
- configs += [ "../../:pdfium_strict_config" ]
+ configs += [
+ "../../:pdfium_strict_config",
+ "../../:pdfium_noshorten_config",
+ ]
deps = [ "../fxcrt" ]
visibility = [ "../../*" ]
- if (is_clang) {
- cflags += [ "-Wshorten-64-to-32" ]
- }
}
pdfium_unittest_source_set("unittests") {
diff --git a/core/fpdfapi/cmaps/BUILD.gn b/core/fpdfapi/cmaps/BUILD.gn
index 8fbf83a..a2e9929 100644
--- a/core/fpdfapi/cmaps/BUILD.gn
+++ b/core/fpdfapi/cmaps/BUILD.gn
@@ -70,11 +70,10 @@
"fpdf_cmaps.cpp",
"fpdf_cmaps.h",
]
- cflags = []
- configs += [ "../../../:pdfium_strict_config" ]
+ configs += [
+ "../../../:pdfium_strict_config",
+ "../../../:pdfium_noshorten_config",
+ ]
deps = [ "../../fxcrt" ]
visibility = [ "../../../*" ]
- if (is_clang) {
- cflags += [ "-Wshorten-64-to-32" ]
- }
}
diff --git a/core/fpdfapi/font/BUILD.gn b/core/fpdfapi/font/BUILD.gn
index a5fe8cd..9dbc9ef 100644
--- a/core/fpdfapi/font/BUILD.gn
+++ b/core/fpdfapi/font/BUILD.gn
@@ -40,8 +40,10 @@
"cpdf_type3font.cpp",
"cpdf_type3font.h",
]
- cflags = []
- configs += [ "../../../:pdfium_strict_config" ]
+ configs += [
+ "../../../:pdfium_strict_config",
+ "../../../:pdfium_noshorten_config",
+ ]
deps = [
"../../fxcrt",
"../../fxge",
@@ -52,9 +54,6 @@
if (is_mac) {
frameworks = [ "CoreFoundation.framework" ]
}
- if (is_clang) {
- cflags += [ "-Wshorten-64-to-32" ]
- }
}
pdfium_unittest_source_set("unittests") {
diff --git a/core/fpdfapi/render/BUILD.gn b/core/fpdfapi/render/BUILD.gn
index ab33f91..a4ab336 100644
--- a/core/fpdfapi/render/BUILD.gn
+++ b/core/fpdfapi/render/BUILD.gn
@@ -44,8 +44,10 @@
"cpdf_type3glyphmap.cpp",
"cpdf_type3glyphmap.h",
]
- cflags = []
- configs += [ "../../../:pdfium_strict_config" ]
+ configs += [
+ "../../../:pdfium_strict_config",
+ "../../../:pdfium_noshorten_config",
+ ]
deps = [
"../../../constants",
"../../fxcodec",
@@ -56,9 +58,6 @@
"../parser",
]
visibility = [ "../../../*" ]
- if (is_clang) {
- cflags += [ "-Wshorten-64-to-32" ]
- }
if (is_win) {
sources += [
"cpdf_windowsrenderdevice.cpp",
diff --git a/core/fpdfdoc/BUILD.gn b/core/fpdfdoc/BUILD.gn
index c917a5c..feecb7a 100644
--- a/core/fpdfdoc/BUILD.gn
+++ b/core/fpdfdoc/BUILD.gn
@@ -77,8 +77,10 @@
"cpvt_wordrange.h",
"ipvt_fontmap.h",
]
- cflags = []
- configs += [ "../../:pdfium_strict_config" ]
+ configs += [
+ "../../:pdfium_strict_config",
+ "../../:pdfium_noshorten_config",
+ ]
deps = [
"../../constants",
"../fpdfapi/font",
@@ -89,9 +91,6 @@
"../fxge",
]
visibility = [ "../../*" ]
- if (is_clang) {
- cflags += [ "-Wshorten-64-to-32" ]
- }
}
pdfium_unittest_source_set("unittests") {
diff --git a/core/fxcodec/BUILD.gn b/core/fxcodec/BUILD.gn
index 5b77639..9f26331 100644
--- a/core/fxcodec/BUILD.gn
+++ b/core/fxcodec/BUILD.gn
@@ -69,11 +69,10 @@
"scanlinedecoder.cpp",
"scanlinedecoder.h",
]
- configs += [ "../../:pdfium_strict_config" ]
- cflags = []
- if (is_clang) {
- cflags += [ "-Wshorten-64-to-32" ]
- }
+ configs += [
+ "../../:pdfium_strict_config",
+ "../../:pdfium_noshorten_config",
+ ]
include_dirs = []
deps = [
"../../third_party:lcms2",
diff --git a/core/fxcrt/BUILD.gn b/core/fxcrt/BUILD.gn
index 86b8fb1..fb7d04f 100644
--- a/core/fxcrt/BUILD.gn
+++ b/core/fxcrt/BUILD.gn
@@ -98,11 +98,10 @@
"xml/cfx_xmltext.cpp",
"xml/cfx_xmltext.h",
]
- configs += [ "../../:pdfium_strict_config" ]
- cflags = []
- if (is_clang) {
- cflags += [ "-Wshorten-64-to-32" ]
- }
+ configs += [
+ "../../:pdfium_strict_config",
+ "../../:pdfium_noshorten_config",
+ ]
visibility = [
"../*",
"../../:*",
diff --git a/core/fxge/BUILD.gn b/core/fxge/BUILD.gn
index 7dafd7d..23f80e1 100644
--- a/core/fxge/BUILD.gn
+++ b/core/fxge/BUILD.gn
@@ -10,8 +10,6 @@
visibility = [ ":*" ]
if (is_clang) {
cflags = [
- "-Wshorten-64-to-32",
-
# http://code.google.com/p/pdfium/issues/detail?id=188
"-Wno-switch",
]
@@ -118,6 +116,7 @@
configs += [
":fxge_warnings",
"../../:pdfium_strict_config",
+ "../../:pdfium_noshorten_config",
]
deps = [ "../fxcrt" ]
diff --git a/xfa/fgas/crt/BUILD.gn b/xfa/fgas/crt/BUILD.gn
index 7a5ad60..eca3c4c 100644
--- a/xfa/fgas/crt/BUILD.gn
+++ b/xfa/fgas/crt/BUILD.gn
@@ -16,9 +16,9 @@
"locale_iface.h",
"locale_mgr_iface.h",
]
- cflags = []
configs += [
"../../../:pdfium_strict_config",
+ "../../../:pdfium_noshorten_config",
"../../:xfa_warnings",
]
deps = [
@@ -26,9 +26,6 @@
"../../../core/fxcrt",
]
visibility = [ "../../../*" ]
- if (is_clang) {
- cflags += [ "-Wshorten-64-to-32" ]
- }
}
pdfium_unittest_source_set("unittests") {