From 5f3b41bca725090391b9053a9435c86fa7b22df1 Mon Sep 17 00:00:00 2001 From: weili Date: Mon, 16 May 2016 17:52:17 -0700 Subject: Use chromium_code standard for PDFium GYP compilation Define and use chromium_code to be used in standalone PDFium GYP build so that PDFium code can have more stringent warning level. This is also enabled on GN build by default so that GYP and GN builds can have consistent compilation results. Also enable chromium_code for PDFium compilation in Chromium since most of the warnings are cleared. The left ones are clearly marked and will be addressed soon. A few more clean-ups for the build: -- Remove the suppression of sign-compare warnings for Clang since the code is clean and the warning can be re-enabled. -- Re-enable "treat warning as errors" on Mac -- Add a flag to make GCC build works as well. BUG=pdfium:29, pdfium:475 Review-Url: https://codereview.chromium.org/1985843002 --- build_gyp/standalone.gypi | 51 +++++++++++++++++++++++++++++++++++++++------ pdfium.gyp | 11 +--------- third_party/third_party.gyp | 9 +++++++- xfa.gyp | 8 ------- 4 files changed, 54 insertions(+), 25 deletions(-) diff --git a/build_gyp/standalone.gypi b/build_gyp/standalone.gypi index be18b5006c..f191c28e42 100644 --- a/build_gyp/standalone.gypi +++ b/build_gyp/standalone.gypi @@ -7,6 +7,7 @@ { 'variables': { 'component%': 'static_library', + 'chromium_code%': 0, 'clang%': 0, 'asan%': 0, 'sanitizer_coverage%': 0, @@ -172,11 +173,9 @@ 'cflags': [ '-Wall', '-Werror', - '-W', + '-Wextra', + # Two common warning flags for Clang and GCC. '-Wno-missing-field-initializers', - # Code might someday be made clean for -Wsign-compare, but for now - # this produces too much noise to be useful. - '-Wno-sign-compare', '-Wno-unused-parameter', '-pthread', '-fno-exceptions', @@ -360,6 +359,7 @@ 'xcode_settings': { 'ALWAYS_SEARCH_USER_PATHS': 'NO', 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', + 'CLANG_CXX_LIBRARY': 'libc++', # -stdlib=libc++ 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic # (Equivalent to -fPIC) @@ -371,6 +371,7 @@ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', # -Werror 'GCC_WARN_NON_VIRTUAL_DESTRUCTOR': 'YES', # -Wnon-virtual-dtor + 'MACOSX_DEPLOYMENT_TARGET': '10.7', # -mmacosx-version-min 'SYMROOT': '<(DEPTH)/xcodebuild', 'USE_HEADERMAP': 'NO', 'OTHER_CFLAGS': [ @@ -378,12 +379,13 @@ ], 'WARNING_CFLAGS': [ '-Wall', - '-Wendif-labels', - '-W', + '-Werror', + '-Wextra', '-Wno-unused-parameter', ], }, 'variables': { + 'chromium_code%': '<(chromium_code)', 'clang_warning_flags': [ # TODO(thakis): https://crbug.com/604888 '-Wno-undefined-var-template', @@ -469,6 +471,43 @@ 'defines': ['CR_CLANG_REVISION=