0

Prepare for -Wall for third-party code, -Wextra for chromium_code

This lands patch set 16 of https://codereview.chromium.org/1551753002/
(reviewed there), except for the changes to build/common.gypi and
build/config/compiler/BUILD.gn.  The changes to these two files are likely
to break some bot I don't know about, and I don't want to keep reverting
and relanding all these files.  So this lands the parts that are hopefully
harmless separately.

BUG=573250
TBR=thestig

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

Cr-Commit-Position: refs/heads/master@{#367252}
This commit is contained in:
thakis
2015-12-31 09:26:06 -08:00
committed by Commit bot
parent 92469c8c4b
commit 29de2c811d
32 changed files with 120 additions and 42 deletions
android_webview/native
base
chrome/browser
chromecast/crash/linux
chromeos/system
components
crash
history
core
nacl
renderer
content/browser/android/java
media/capture/video/linux
net/tools/quic
ppapi/native_client/src/untrusted/irt_stub
third_party
ui/views/widget/desktop_aura

@ -32,7 +32,7 @@ class InputStreamImpl : public InputStream {
~InputStreamImpl() override;
// Gets the underlying Java object. Guaranteed non-NULL.
const jobject jobj() const { return jobject_.obj(); }
jobject jobj() const { return jobject_.obj(); }
// InputStream implementation.
bool BytesAvailable(int* bytes_available) const override;

@ -48,6 +48,23 @@ config("tcmalloc_flags") {
"TCMALLOC_FOR_DEBUGALLOCATION",
]
}
if (is_clang) {
cflags = [
# tcmalloc initializes some fields in the wrong order.
"-Wno-reorder",
# tcmalloc contains some unused local template specializations.
"-Wno-unused-function",
# tcmalloc uses COMPILE_ASSERT without static_assert but with
# typedefs.
"-Wno-unused-local-typedefs",
# for magic2_ in debugallocation.cc (only built in Debug builds)
# typedefs.
"-Wno-unused-private-field",
]
}
}
# This config and libc modification are only used on Windows.

@ -284,6 +284,20 @@
'<(tcmalloc_dir)/src/debugallocation.cc',
'<(tcmalloc_dir)/src/tcmalloc.cc',
],
'variables': {
'clang_warning_flags': [
# tcmalloc initializes some fields in the wrong order.
'-Wno-reorder',
# tcmalloc contains some unused local template specializations.
'-Wno-unused-function',
# tcmalloc uses COMPILE_ASSERT without static_assert but with
# typedefs.
'-Wno-unused-local-typedefs',
# for magic2_ in debugallocation.cc (only built in Debug builds)
# typedefs.
'-Wno-unused-private-field',
],
},
'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="solaris" or OS=="android"', {
'sources!': [

@ -33,7 +33,7 @@ void SetNativeApplicationContext(JNIEnv* env, const JavaRef<jobject>& context) {
} // namespace
const jobject GetApplicationContext() {
jobject GetApplicationContext() {
DCHECK(!g_application_context.Get().is_null());
return g_application_context.Get().obj();
}

@ -16,7 +16,7 @@ namespace android {
// Gets a global ref to the application context set with
// InitApplicationContext(). Ownership is retained by the function - the caller
// must NOT release it.
const BASE_EXPORT jobject GetApplicationContext();
BASE_EXPORT jobject GetApplicationContext();
// Initialize the global application context object.
// Either this or the Java equivalent ContextUtils.initApplicationContext must

@ -73,7 +73,7 @@ class TabDataUseEntryTest : public testing::Test {
tab_entry_.reset(new TabDataUseEntry(tab_model_.get()));
}
const size_t GetMaxSessionsPerTab() const {
size_t GetMaxSessionsPerTab() const {
return tab_model_->max_sessions_per_tab();
}

@ -122,7 +122,7 @@ bool OfflinePageUtils::HasOfflinePageForOnlineURL(
}
// static
const bool OfflinePageUtils::HasOfflinePages(
bool OfflinePageUtils::HasOfflinePages(
content::BrowserContext* browser_context) {
DCHECK(browser_context);

@ -46,7 +46,7 @@ class OfflinePageUtils {
const GURL& online_url);
// Checks whether any offline page is saved.
static const bool HasOfflinePages(content::BrowserContext* browser_context);
static bool HasOfflinePages(content::BrowserContext* browser_context);
};
} // namespace offline_pages

@ -69,7 +69,7 @@ class AccessibilityFeaturesApiTest : public ExtensionApiTest,
bool ShouldModifyingFeatureSucceed() const { return GetParam(); }
// Returns preference path for accessibility features as defined by the API.
const char* const GetPrefForFeature(const std::string& feature) {
const char* GetPrefForFeature(const std::string& feature) {
if (feature == "spokenFeedback")
return prefs::kAccessibilitySpokenFeedbackEnabled;
if (feature == "largeCursor")

@ -49,8 +49,8 @@ class ProvidedFileSystemInfo {
bool supports_notify_tag() const { return supports_notify_tag_; }
int opened_files_limit() const { return opened_files_limit_; }
const base::FilePath& mount_path() const { return mount_path_; }
const bool configurable() const { return configurable_; }
const bool watchable() const { return watchable_; }
bool configurable() const { return configurable_; }
bool watchable() const { return watchable_; }
extensions::FileSystemProviderSource source() const { return source_; }
private:

@ -151,10 +151,10 @@ class FakeRegistry : public RegistryInterface {
it->second.last_tag = watcher.last_tag;
}
ProvidedFileSystemInfo* const file_system_info() const {
const ProvidedFileSystemInfo* file_system_info() const {
return file_system_info_.get();
}
Watchers* const watchers() const { return watchers_.get(); }
const Watchers* watchers() const { return watchers_.get(); }
private:
scoped_ptr<ProvidedFileSystemInfo> file_system_info_;

@ -62,7 +62,7 @@ class DumpInfo {
// }
scoped_ptr<base::Value> GetAsValue() const;
const MinidumpParams& params() const { return params_; }
const bool valid() const { return valid_; }
bool valid() const { return valid_; }
private:
// Checks if parsed JSON in |value| is valid, if so populates the object's

@ -218,8 +218,7 @@ class StatisticsProviderImpl : public StatisticsProvider {
const base::DictionaryValue* GetRegionDictionary() const;
// Returns extractor from regional_data_extractors_ or nullptr.
const RegionDataExtractor GetRegionalDataExtractor(
const std::string& name) const;
RegionDataExtractor GetRegionalDataExtractor(const std::string& name) const;
bool load_statistics_started_;
NameValuePairsParser::NameValueMap machine_info_;
@ -272,7 +271,7 @@ const base::DictionaryValue* StatisticsProviderImpl::GetRegionDictionary()
return region_dict;
}
const StatisticsProviderImpl::RegionDataExtractor
StatisticsProviderImpl::RegionDataExtractor
StatisticsProviderImpl::GetRegionalDataExtractor(
const std::string& name) const {
const auto it = regional_data_extractors_.find(name);

@ -76,7 +76,7 @@
// where we either a) know the call cannot fail, or b) there is nothing we
// can do when a call fails, we mark the return code as ignored. This avoids
// spurious compiler warnings.
#define IGNORE_RET(x) do { if (x); } while (0)
#define IGNORE_RET(x) ignore_result(x)
using crash_reporter::GetCrashReporterClient;
using google_breakpad::ExceptionHandler;

@ -127,7 +127,7 @@ class HistoryAndBookmarkRow {
set_value_explicitly(PARENT_ID);
parent_id_ = parent_id;
}
const int64_t parent_id() const { return parent_id_; }
int64_t parent_id() const { return parent_id_; }
// The internal URLID
void set_url_id(URLID url_id) {

@ -33,9 +33,6 @@
'cflags': [
'-Wno-long-long',
],
'cflags!': [
'-Wno-unused-parameter', # be a bit stricter to match NaCl flags.
],
'conditions': [
['asan!=1 and msan!=1 and ubsan_vptr!=1', {
'ldflags': [

@ -209,7 +209,7 @@ GinJavaMethodInvocationHelper::GetSafeAnnotationClass() {
return safe_annotation_clazz_;
}
const GinJavaBridgeError GinJavaMethodInvocationHelper::GetInvocationError() {
GinJavaBridgeError GinJavaMethodInvocationHelper::GetInvocationError() {
return invocation_error_;
}

@ -66,7 +66,7 @@ class CONTENT_EXPORT GinJavaMethodInvocationHelper
const base::ListValue& GetPrimitiveResult();
const base::android::JavaRef<jobject>& GetObjectResult();
const base::android::JavaRef<jclass>& GetSafeAnnotationClass();
const GinJavaBridgeError GetInvocationError();
GinJavaBridgeError GetInvocationError();
private:
friend class base::RefCountedThreadSafe<GinJavaMethodInvocationHelper>;

@ -70,7 +70,7 @@ class V4L2CaptureDelegate
// specific.
virtual bool Init(int fd, const v4l2_buffer& buffer) = 0;
uint8_t* const GetPlaneStart(size_t plane) const {
const uint8_t* GetPlaneStart(size_t plane) const {
DCHECK_LT(plane, planes_.size());
return planes_[plane].start;
}

@ -65,7 +65,7 @@ class QuicSimpleServerStreamPeer : public QuicSimpleServerStream {
return stream->body_;
}
static const int content_length(QuicSimpleServerStream* stream) {
static int content_length(QuicSimpleServerStream* stream) {
return stream->content_length_;
}

@ -30,7 +30,7 @@ static int thread_join(uintptr_t tid) {
return pthread_join((pthread_t) tid, NULL);
}
const static struct PP_ThreadFunctions thread_funcs = {
static const struct PP_ThreadFunctions thread_funcs = {
thread_create,
thread_join
};

@ -15,8 +15,11 @@ namespace crazy {
class Sleb128Decoder {
public:
Sleb128Decoder(const uint8_t* buffer, size_t count)
: current_(buffer), end_(buffer + count) { }
Sleb128Decoder(const uint8_t* buffer, size_t count) : current_(buffer)
#ifndef NDEBUG
, end_(buffer + count)
#endif
{}
size_t pop_front() {
size_t value = 0;
@ -42,7 +45,9 @@ class Sleb128Decoder {
private:
const uint8_t* current_;
#ifndef NDEBUG
const uint8_t* const end_;
#endif
};
} // namespace crazy

@ -3,10 +3,24 @@
# found in the LICENSE file.
if (current_toolchain == host_toolchain) {
config("android_protoc_warnings") {
cflags = [
"-Wno-null-conversion",
"-Wno-tautological-undefined-compare",
"-Wno-unused-function",
"-Wno-unused-local-typedef",
]
}
# GYP: //third_party/android_protobuf/android_protobuf.gyp:android_protoc
executable("android_protoc") {
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 so warning flags are ordered correctly.
":android_protoc_warnings",
]
deps = [
"//build/config/sanitizers:deps",
@ -114,12 +128,6 @@ if (current_toolchain == host_toolchain) {
"src/src",
]
if (is_clang) {
cflags = [
"-Wno-null-conversion",
"-Wno-tautological-undefined-compare",
]
}
defines = [
# This macro must be defined to suppress the use
# of dynamic_cast<>, which requires RTTI.

@ -128,6 +128,8 @@
'cflags': [
'-Wno-null-conversion',
'-Wno-tautological-undefined-compare',
'-Wno-unused-function',
'-Wno-unused-local-typedef',
],
'defines': [
# This macro must be defined to suppress the use

@ -18,3 +18,7 @@ tarball's src folder over to src, then checking for removed or added files
and update our build recipes in BUILD.gn and harfbuzz.gyp accordingly, update
the NEWS file from HarfBuzz' release notes, and bump the version numbers
in README.chromium.
Local changes:
* merge https://github.com/behdad/harfbuzz/pull/203
* merge https://github.com/behdad/harfbuzz/pull/206

@ -693,7 +693,6 @@ resize_and_retry:
scratch += old_scratch_used;
scratch_size -= old_scratch_used;
}
retry:
{
string_ref = CFStringCreateWithCharactersNoCopy (NULL,
pchars, chars_len,
@ -1129,10 +1128,6 @@ fail:
* AAT shaper
*/
HB_SHAPER_DATA_ENSURE_DECLARE(coretext_aat, face)
HB_SHAPER_DATA_ENSURE_DECLARE(coretext_aat, font)
/*
* shaper face data
*/

@ -2,6 +2,19 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
config("libudis86_warnings") {
if (is_clang) {
cflags = [
# syn.c contains a switch with an assert(false) in a default:
# block. In release builds, the function is missing a return.
"-Wno-return-type",
# Fires once in decode.c.
"-Wno-sometimes-uninitialized",
]
}
}
static_library("libudis86") {
sources = [
"libudis86/decode.c",
@ -29,7 +42,12 @@ static_library("libudis86") {
cflags = [ "-Wno-return-type" ]
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.
":libudis86_warnings",
]
if (is_clang) {
# For UD_ASSERT(!"message");

@ -47,6 +47,13 @@
# For UD_ASSERT(!"message");
'-Wstring-conversion',
],
'clang_warning_flags': [
# syn.c contains a switch with an assert(false) in a default:
# block. In release builds, the function is missing a return.
'-Wno-return-type',
# Fires once in decode.c.
'-Wno-sometimes-uninitialized',
],
},
},
{

@ -8,6 +8,11 @@ config("ocmock_config") {
include_dirs = [ "//third_party/ocmock" ]
}
config("ocmock_warnings") {
# NSInvocation+OCMAdditions.m has some `- (void) foo; {...`
cflags = [ "-Wno-semicolon-before-method-body" ]
}
source_set("ocmock") {
testonly = true
@ -70,4 +75,5 @@ source_set("ocmock") {
"//testing/gtest",
]
public_configs = [ ":ocmock_config" ]
configs += [ ":ocmock_warnings" ]
}

@ -72,6 +72,12 @@
'OCMock/OCObserverMockObject.h',
'OCMock/OCObserverMockObject.m',
],
'variables': {
'clang_warning_flags': [
# NSInvocation+OCMAdditions.m has some `- (void) foo; {...`
'-Wno-semicolon-before-method-body',
],
},
},
],
}],

@ -2017,7 +2017,7 @@ gfx::Rect DesktopWindowTreeHostX11::ToPixelRect(
return gfx::ToEnclosingRect(rect_in_pixels);
}
const XID DesktopWindowTreeHostX11::GetModalDialog() {
XID DesktopWindowTreeHostX11::GetModalDialog() {
return modal_dialog_xid_;
}

@ -96,7 +96,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
// Returns XID of dialog currently displayed. When it returns 0,
// there is no dialog on the host window.
const XID GetModalDialog();
XID GetModalDialog();
protected:
// Overridden from DesktopWindowTreeHost: