Skip to content

Commit

Permalink
Enable -Wunused-local-typedef
Browse files Browse the repository at this point in the history
BUG=321833
TBR=brettw

Review URL: https://codereview.chromium.org/722513003

Cr-Commit-Position: refs/heads/master@{#303892}
  • Loading branch information
nico authored and Commit bot committed Nov 12, 2014
1 parent 3a2200e commit 4970b58
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 22 deletions.
2 changes: 2 additions & 0 deletions base/memory/scoped_ptr_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,9 @@ TEST(ScopedPtrTest, SelfResetAbortsWithCustomDeleter) {
TEST(ScopedPtrTest, SelfResetWithCustomDeleterOptOut) {
// A custom deleter should be able to opt out of self-reset abort behavior.
struct NoOpDeleter {
#if !defined(NDEBUG)
typedef void AllowSelfReset;
#endif
inline void operator()(int*) {}
};
scoped_ptr<int> owner(new int);
Expand Down
3 changes: 0 additions & 3 deletions build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -2516,9 +2516,6 @@
# code generated by flex (used in angle) contains that keyword.
# http://crbug.com/255186
'-Wno-deprecated-register',

# TODO(hans): Clean this up. Or disable with finer granularity.
'-Wno-unused-local-typedef',
],
},
'includes': [ 'set_clang_warning_flags.gypi', ],
Expand Down
3 changes: 0 additions & 3 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,6 @@ config("default_warnings") {

# TODO(thakis): Remove, http://crbug.com/263960
"-Wno-reserved-user-defined-literal",

# TODO(hans): Clean this up. Or disable with finer granularity.
"-Wno-unused-local-typedef",
]
}
if (gcc_version >= 48) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -888,8 +888,6 @@ void EventRouter::DispatchDirectoryChangeEventWithEntryDefinition(
const std::string* extension_id,
bool watcher_error,
const EntryDefinition& entry_definition) {
typedef std::map<base::FilePath, drive::FileChange::ChangeList> ChangeListMap;

// TODO(mtomasz): Add support for watching files in File System Provider API.
if (entry_definition.error != base::File::FILE_OK ||
!entry_definition.is_directory) {
Expand Down
23 changes: 17 additions & 6 deletions chrome/browser/ui/libgtk2ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ component("libgtk2ui") {
"gconf_listener.h",
]
}
if (is_clang) {
# G_DEFINE_TYPE automatically generates a *get_instance_private inline
# function after glib 2.37. That's unused. Prevent to complain about it.
cflags = [ "-Wno-unused-function" ]
}

defines = [ "LIBGTK2UI_IMPLEMENTATION" ]

configs += [
Expand All @@ -87,6 +81,23 @@ component("libgtk2ui") {
"//printing:cups",
]

# gn orders flags on a target before flags from configs. The default config
# adds -Wall, and these flags have to be after -Wall -- so they need to come
# from a config and can't be on the target directly.
config("libgtk2ui_warnings") {
if (is_clang) {
cflags = [
# G_DEFINE_TYPE automatically generates a *get_instance_private inline
# function after glib 2.37. That's unused. Prevent to complain about it.
"-Wno-unused-function",

# G_STATIC_ASSERT uses a typedef as a static_assert.
"-Wno-unused-local-typedef",
]
}
}
configs += [ ":libgtk2ui_warnings", ]

deps = [
"//base",
"//base:i18n",
Expand Down
7 changes: 5 additions & 2 deletions chrome/browser/ui/libgtk2ui/libgtk2ui.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,13 @@
],
}],
[ 'clang==1', {
# G_DEFINE_TYPE automatically generates a *get_instance_private inline function after glib 2.37.
# That's unused. Prevent to complain about it.
'cflags': [
# G_DEFINE_TYPE automatically generates a *get_instance_private inline function after glib 2.37.
# That's unused. Prevent to complain about it.
'-Wno-unused-function',

# G_STATIC_ASSERT uses a typedef as a static_assert.
'-Wno-unused-local-typedef',
],
}],
],
Expand Down
2 changes: 0 additions & 2 deletions components/pairing/fake_host_pairing_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ FakeHostPairingController::~FakeHostPairingController() {
}

void FakeHostPairingController::ApplyConfig(const std::string& config) {
typedef std::vector<std::string> Tokens;

base::StringPairs kv_pairs;
CHECK(base::SplitStringIntoKeyValuePairs(config, ':', ',', &kv_pairs))
<< "Wrong config format.";
Expand Down
22 changes: 18 additions & 4 deletions sdch/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ static_library("sdch") {
"//third_party/zlib",
]

# gn orders flags on a target before flags from configs. The default config
# adds -Wall, and these flags have to be after -Wall -- so they need to come
# from a config and can't be on the target directly.
config("sdch_warnings") {
cflags = []
if (is_linux) {
# TODO(mostynb): remove this if open-vcdiff is ever updated for c++11:
cflags += [ "-Wno-deprecated-declarations" ]
}

if (is_clang) {
# sdch uses the pre-c++11 typedef-as-static_assert hack.
# https://code.google.com/p/open-vcdiff/issues/detail?id=44
cflags += [ "-Wno-unused-local-typedef" ]
}
}
configs += [ ":sdch_warnings" ]

if (is_linux || is_android) {
include_dirs = [ "linux" ]
} else if (is_ios) {
Expand All @@ -69,9 +87,5 @@ static_library("sdch") {
} else {
logging_file = rebase_path("logging_forward.h", root_build_dir)
cflags = [ "-include", logging_file ]
if (is_linux) {
# TODO(mostynb): remove this if open-vcdiff is ever updated for c++11:
cflags += [ "-Wno-deprecated-declarations" ]
}
}
}
5 changes: 5 additions & 0 deletions sdch/sdch.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
# introduce static initializers, and which prevents open-vcdiff's
# logging.h from being used).
'variables': {
'clang_warning_flags': [
# sdch uses the pre-c++11 typedef-as-static_assert hack.
# https://code.google.com/p/open-vcdiff/issues/detail?id=44
'-Wno-unused-local-typedef',
],
'logging_path': 'logging_forward.h',
'conditions': [
# gyp leaves unspecified what the cwd is when running the compiler,
Expand Down
10 changes: 10 additions & 0 deletions third_party/libphonenumber/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ test("libphonenumber_unittests") {

include_dirs = [ "src/test" ]

# gn orders flags on a target before flags from configs. The default config
# adds -Wall, and these flags have to be after -Wall -- so they need to come
# from a config and can't be on the target directly.
config("libphonenumber_unittests_warnings") {
if (is_clang) {
cflags = [ "-Wno-unused-local-typedef" ]
}
}
configs += [ ":libphonenumber_unittests_warnings" ]

deps = [
":libphonenumber_without_metadata",
"//base",
Expand Down
2 changes: 2 additions & 0 deletions third_party/libphonenumber/libphonenumber.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
'../../testing/gtest.gyp:gtest',
'libphonenumber_without_metadata',
],
# TODO: https://code.google.com/p/libphonenumber/issues/detail?id=553
'variables': { 'clang_warning_flags': [ '-Wno-unused-local-typedef' ] },
'conditions': [
['OS=="win"', {
'action': [
Expand Down

0 comments on commit 4970b58

Please sign in to comment.