diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 04:11:49 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 04:11:49 +0000 |
commit | 6cbc30510b56b312e0ddcee83636b356d6f073ea (patch) | |
tree | 65c5af784d31d905f139317ab48622993632bcbe /sdch | |
parent | c6898666cd5fec00e919bc2ae93978ec91644a05 (diff) | |
download | chromium_src-6cbc30510b56b312e0ddcee83636b356d6f073ea.zip chromium_src-6cbc30510b56b312e0ddcee83636b356d6f073ea.tar.gz chromium_src-6cbc30510b56b312e0ddcee83636b356d6f073ea.tar.bz2 |
Remove static initializers introduced by open-vcdiff's logging.h.
I wanted to change open-vcdiff's logging.h directly, put we pull it directly
from google code, not through deps, so we can't have downstream diffs.
Maybe that's enough to eliminate all static initializers added by open-vcdiff.
BUG=94925
Review URL: https://codereview.chromium.org/68253006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234746 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sdch')
-rw-r--r-- | sdch/logging_forward.h | 22 | ||||
-rw-r--r-- | sdch/sdch.gyp | 32 |
2 files changed, 52 insertions, 2 deletions
diff --git a/sdch/logging_forward.h b/sdch/logging_forward.h new file mode 100644 index 0000000..fc0d327 --- /dev/null +++ b/sdch/logging_forward.h @@ -0,0 +1,22 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SDCH_LOGGING_FORWARD_H_ +#define SDCH_LOGGING_FORWARD_H_ + +// Define open-vcdiff's logging.h header guard, so that it doesn't get used. +#define OPEN_VCDIFF_LOGGING_H_ + +#include "base/logging.h" + +// open-vcdiff's logging.h includes iostream, which adds static initializers +// to several compilation units. To prevent this, provide this replacement +// header which forwards open-vcdiffs logging macros to chromium's base logging +// mechanism. +#define VCD_WARNING LOG(WARNING) +#define VCD_ERROR LOG(ERROR) +#define VCD_DFATAL LOG(DFATAL) +#define VCD_ENDL "\n" + +#endif // SDCH_LOGGING_FORWARD_H_ diff --git a/sdch/sdch.gyp b/sdch/sdch.gyp index d84be58..8b4a8b9 100644 --- a/sdch/sdch.gyp +++ b/sdch/sdch.gyp @@ -11,9 +11,11 @@ 'target_name': 'sdch', 'type': 'static_library', 'dependencies': [ + '../base/base.gyp:base', '../third_party/zlib/zlib.gyp:zlib', ], 'sources': [ + 'logging_forward.h', 'open-vcdiff/src/addrcache.cc', 'open-vcdiff/src/blockhash.cc', 'open-vcdiff/src/blockhash.h', @@ -31,8 +33,6 @@ 'open-vcdiff/src/headerparser.h', 'open-vcdiff/src/instruction_map.cc', 'open-vcdiff/src/instruction_map.h', - 'open-vcdiff/src/logging.cc', - 'open-vcdiff/src/logging.h', 'open-vcdiff/src/rolling_hash.h', 'open-vcdiff/src/testing.h', 'open-vcdiff/src/varint_bigendian.cc', @@ -59,6 +59,34 @@ [ 'OS == "mac"', { 'include_dirs': [ 'mac' ] } ], [ 'OS == "win"', { 'include_dirs': [ 'open-vcdiff/vsprojects' ] } ], ], + # open-vcdiff's logging.h introduces static initializers. This was + # reported upstream years ago ( + # https://code.google.com/p/open-vcdiff/issues/detail?id=33 ). Since + # upstream won't fix this, work around it on the chromium side: + # Inject a header that forwards to base/logging.h instead (which doesn't + # introduce static initializers, and which prevents open-vcdiff's + # logging.h from being used). + 'variables': { + 'logging_path': 'logging_forward.h', + 'conditions': [ + # gyp leaves unspecified what the cwd is when running the compiler, + # and gyp/linux doesn't have a built-in way for forcing an include. + # So hardcode the base directory. If this spreads, provide native + # support in gyp, like we have for gyp/mac and gyp/windows. + # path. + ['"<(GENERATOR)"=="ninja"', { 'logging_dir': '../..' }, + { 'logging_dir': '.' } + ], + ], + }, + # GCC_PREFIX_HEADER is relative to the current directory, + # ForcedIncludeFiles is relative to include_dirs, cflags relative to the + # build directory. + 'xcode_settings': { 'GCC_PREFIX_HEADER': '<(logging_path)' }, + 'msvs_settings': { + 'VCCLCompilerTool': { 'ForcedIncludeFiles': [ 'sdch/<(logging_path)' ] } + }, + 'cflags': [ '-include', '<(logging_dir)/sdch/<(logging_path)' ], }, ], } |