summaryrefslogtreecommitdiffstats
path: root/third_party/libxml/BUILD.gn
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libxml/BUILD.gn')
-rw-r--r--third_party/libxml/BUILD.gn85
1 files changed, 45 insertions, 40 deletions
diff --git a/third_party/libxml/BUILD.gn b/third_party/libxml/BUILD.gn
index c967608..5e633c0 100644
--- a/third_party/libxml/BUILD.gn
+++ b/third_party/libxml/BUILD.gn
@@ -24,6 +24,44 @@ config("libxml_config") {
]
}
+config("libxml_warnings") {
+ if (is_win) {
+ cflags_c = [
+ "/wd4018", # Signed/unsigned mismatch in comparison.
+ "/wd4101", # Unreferenced local variable.
+ ]
+ }
+ if (is_clang) {
+ cflags = [
+ # libxml passes `const unsigned char*` through `const char*`.
+ "-Wno-pointer-sign",
+
+ # pattern.c and uri.c both have an intentional `for (...);` /
+ # `while(...);` loop. I submitted a patch to move the `'` to its own
+ # line, but until that's landed suppress the warning:
+ "-Wno-empty-body",
+
+ # debugXML.c compares array 'arg' to NULL.
+ "-Wno-tautological-pointer-compare",
+
+ # threads.c attempts to forward declare a pthread_equal which doesn't
+ # match the prototype in pthreads.h
+ "-Wno-ignored-attributes",
+
+ # libxml casts from int to long to void*.
+ "-Wno-int-to-void-pointer-cast",
+
+ # libxml passes a volatile LPCRITICAL_SECTION* to a function expecting
+ # a void* volatile*.
+ "-Wno-incompatible-pointer-types",
+
+ # trio_is_special_quantity and trio_is_negative are only
+ # used with certain preprocessor defines set.
+ "-Wno-unused-function",
+ ]
+ }
+}
+
static_library("libxml") {
output_name = "libxml2"
sources = [
@@ -144,7 +182,12 @@ static_library("libxml") {
]
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":libxml_warnings",
+ ]
public_configs = [ ":libxml_config" ]
public_deps = [
@@ -154,12 +197,7 @@ static_library("libxml") {
"//third_party/zlib",
]
- if (is_win) {
- cflags_c = [
- "/wd4018", # Signed/unsigned mismatch in comparison.
- "/wd4101", # Unreferenced local variable.
- ]
- } else if (is_mac || is_ios || is_android) {
+ if (is_mac || is_ios || is_android) {
# http://www.xmlsoft.org/threads.html says that this is required when using
# libxml from several threads, which can possibly happen in chrome. On
# linux, this is picked up by transitivity from pkg-config output from
@@ -167,38 +205,5 @@ static_library("libxml") {
defines = [ "_REENTRANT" ]
}
- config("libxml_warnings") {
- if (is_clang) {
- cflags = [
- # libxml passes `const unsigned char*` through `const char*`.
- "-Wno-pointer-sign",
-
- # pattern.c and uri.c both have an intentional `for (...);` /
- # `while(...);` loop. I submitted a patch to move the `'` to its own
- # line, but until that's landed suppress the warning:
- "-Wno-empty-body",
-
- # debugXML.c compares array 'arg' to NULL.
- "-Wno-tautological-pointer-compare",
-
- # threads.c attempts to forward declare a pthread_equal which doesn't
- # match the prototype in pthreads.h
- "-Wno-ignored-attributes",
-
- # libxml casts from int to long to void*.
- "-Wno-int-to-void-pointer-cast",
-
- # libxml passes a volatile LPCRITICAL_SECTION* to a function expecting
- # a void* volatile*.
- "-Wno-incompatible-pointer-types",
-
- # trio_is_special_quantity and trio_is_negative are only
- # used with certain preprocessor defines set.
- "-Wno-unused-function",
- ]
- }
- }
- configs += [ ":libxml_warnings" ]
-
include_dirs = [ "$os_include" ]
}