summaryrefslogtreecommitdiff
path: root/third_party
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-05-05 17:13:42 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-05 17:13:42 -0700
commitd29882d3a0567e297756f69b77562ed4892f012a (patch)
tree1d97bf6fd79f9e6c7065434529cf4f9a9f79bdf5 /third_party
parent1f00dbf0203bdd6b4100457301fef1216546e2f7 (diff)
downloadpdfium-d29882d3a0567e297756f69b77562ed4892f012a.tar.xz
Resolve macro redefinition warnings when built in Chromium
Chromium defines WIN32_LEAN_AND_MEAN on Windows. Third party library libtiff also defines it. So we undefine it before compiling libtiff code for GYP build. Also, remove _CRT_SECURE_NO_WARNINGS macro since it is redefined in zlib library as well. Our code no longer needs it. After fixing the above, re-enable warning flag 4005 which alerts about "macro redefinition". For GN build, we disable warning 4005 for compiling libtiff code before we can figure out another way to do this. Review-Url: https://codereview.chromium.org/1954773002
Diffstat (limited to 'third_party')
-rw-r--r--third_party/BUILD.gn10
-rw-r--r--third_party/third_party.gyp12
2 files changed, 20 insertions, 2 deletions
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index e0c9bf116e..1176e92875 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -328,11 +328,21 @@ source_set("fx_lpng") {
}
if (pdf_enable_xfa) {
+ config("fx_tiff_warnings") {
+ visibility = [ ":*" ]
+ if (is_win) {
+ cflags = [
+ "/wd4005", # Macro redefinition for 'WIN32_LEAN_AND_MEAN'.
+ ]
+ }
+ }
source_set("fx_tiff") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
"//build/config/compiler:no_chromium_code",
"../:pdfium_config",
+
+ ":fx_tiff_warnings",
]
deps = [
"//third_party:jpeg",
diff --git a/third_party/third_party.gyp b/third_party/third_party.gyp
index 7fd1082454..840c16635d 100644
--- a/third_party/third_party.gyp
+++ b/third_party/third_party.gyp
@@ -12,7 +12,6 @@
'OPJ_STATIC',
'PNG_PREFIX',
'PNG_USE_READ_MACROS',
- '_CRT_SECURE_NO_WARNINGS',
],
'include_dirs': [
# This is implicit in GN.
@@ -20,7 +19,7 @@
'..',
],
'msvs_disabled_warnings': [
- 4005, 4018, 4146, 4333, 4345, 4267
+ 4018, 4146, 4333, 4345, 4267
],
},
'targets': [
@@ -411,6 +410,15 @@
'libtiff/tif_write.c',
'libtiff/tif_zip.c',
],
+ 'conditions': [
+ ['OS=="win"', {
+ 'defines!': [
+ # Need to undefine the macro since it is redefined in
+ # tif_ojpeg.c and tif_jpeg.c.
+ 'WIN32_LEAN_AND_MEAN',
+ ],
+ }],
+ ],
},
],
}],