From 5a3b9149085f033097663a63c90e152051fd6c56 Mon Sep 17 00:00:00 2001 From: "tony@chromium.org" Date: Fri, 28 Aug 2009 21:03:17 +0000 Subject: Revert "Fix a ton of compiler warnings." This reverts commit r24792. TBR=estade Review URL: http://codereview.chromium.org/179028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24796 0039d316-1c4b-4281-b951-d872f2087c98 --- base/field_trial_unittest.cc | 4 ++-- base/file_descriptor_shuffle.h | 3 --- base/multiprocess_test.h | 10 +++++----- base/process_util_linux.cc | 11 ++++++----- base/process_util_unittest.cc | 4 ++-- base/stats_table_unittest.cc | 4 ++-- base/system_monitor.h | 5 +---- base/task.h | 6 +----- base/third_party/dmg_fp/README.chromium | 1 - base/third_party/dmg_fp/dtoa.cc | 6 +++--- base/time.cc | 9 ++++----- base/time.h | 8 ++++---- base/time_posix.cc | 2 +- base/waitable_event.h | 5 +---- base/waitable_event_watcher_unittest.cc | 6 +++--- 15 files changed, 35 insertions(+), 49 deletions(-) (limited to 'base') diff --git a/base/field_trial_unittest.cc b/base/field_trial_unittest.cc index 1ab5669..430fd67 100644 --- a/base/field_trial_unittest.cc +++ b/base/field_trial_unittest.cc @@ -160,8 +160,8 @@ TEST_F(FieldTrialTest, Save) { } TEST_F(FieldTrialTest, Restore) { - EXPECT_TRUE(NULL == FieldTrialList::Find("Some_name")); - EXPECT_TRUE(NULL == FieldTrialList::Find("xxx")); + EXPECT_EQ(NULL, FieldTrialList::Find("Some_name")); + EXPECT_EQ(NULL, FieldTrialList::Find("xxx")); FieldTrialList::StringAugmentsState("Some_name/Winner/xxx/yyyy/"); diff --git a/base/file_descriptor_shuffle.h b/base/file_descriptor_shuffle.h index 108a874..8ee77409 100644 --- a/base/file_descriptor_shuffle.h +++ b/base/file_descriptor_shuffle.h @@ -37,9 +37,6 @@ class InjectionDelegate { virtual bool Move(int src, int dest) = 0; // Delete an element of the domain. virtual void Close(int fd) = 0; - - protected: - ~InjectionDelegate() {} }; // An implementation of the InjectionDelegate interface using the file diff --git a/base/multiprocess_test.h b/base/multiprocess_test.h index 75a8a3e..99c2c79 100644 --- a/base/multiprocess_test.h +++ b/base/multiprocess_test.h @@ -1,9 +1,9 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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 BASE_MULTIPROCESS_TEST_H_ -#define BASE_MULTIPROCESS_TEST_H_ +#ifndef BASE_MULTIPROCESS_TEST_H__ +#define BASE_MULTIPROCESS_TEST_H__ #include "base/base_switches.h" #include "base/command_line.h" @@ -106,7 +106,7 @@ class MultiProcessTest : public PlatformTest { const base::file_handle_mapping_vector& fds_to_map, bool debug_on_start) { CommandLine cl(*CommandLine::ForCurrentProcess()); - base::ProcessHandle handle = 0; + base::ProcessHandle handle = static_cast(NULL); cl.AppendSwitchWithValue(kRunClientProcess, procname); if (debug_on_start) @@ -118,4 +118,4 @@ class MultiProcessTest : public PlatformTest { #endif }; -#endif // BASE_MULTIPROCESS_TEST_H_ +#endif // BASE_MULTIPROCESS_TEST_H__ diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc index f93b359..a05e9bb 100644 --- a/base/process_util_linux.cc +++ b/base/process_util_linux.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2008 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. @@ -259,6 +259,7 @@ bool ProcessMetrics::GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const { int private_kb = 0; int pss_kb = 0; bool have_pss = false; + const int kPssAdjust = 0.5; if (!file_util::ReadFileToString(stat_file, &smaps)) return false; @@ -277,12 +278,12 @@ bool ProcessMetrics::GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const { return false; } if (StartsWithASCII(last_key_name, "Shared_", 1)) { - shared_kb += StringToInt(tokenizer.token()); + shared_kb += StringToInt(tokenizer.token()); } else if (StartsWithASCII(last_key_name, "Private_", 1)) { - private_kb += StringToInt(tokenizer.token()); + private_kb += StringToInt(tokenizer.token()); } else if (StartsWithASCII(last_key_name, "Pss", 1)) { - have_pss = true; - pss_kb += StringToInt(tokenizer.token()); + have_pss = true; + pss_kb += StringToInt(tokenizer.token()) + kPssAdjust; } state = KEY_NAME; break; diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc index 6f74daf..b75bdb8 100644 --- a/base/process_util_unittest.cc +++ b/base/process_util_unittest.cc @@ -41,7 +41,7 @@ MULTIPROCESS_TEST_MAIN(SimpleChildProcess) { TEST_F(ProcessUtilTest, SpawnChild) { ProcessHandle handle = this->SpawnChild(L"SimpleChildProcess"); - ASSERT_NE(0, handle); + ASSERT_NE(static_cast(NULL), handle); EXPECT_TRUE(WaitForSingleProcess(handle, 5000)); base::CloseProcessHandle(handle); } @@ -62,7 +62,7 @@ MULTIPROCESS_TEST_MAIN(SlowChildProcess) { TEST_F(ProcessUtilTest, KillSlowChild) { remove("SlowChildProcess.die"); ProcessHandle handle = this->SpawnChild(L"SlowChildProcess"); - ASSERT_NE(0, handle); + ASSERT_NE(static_cast(NULL), handle); FILE *fp = fopen("SlowChildProcess.die", "w"); fclose(fp); EXPECT_TRUE(base::WaitForSingleProcess(handle, 5000)); diff --git a/base/stats_table_unittest.cc b/base/stats_table_unittest.cc index f022b9b..d8535cb 100644 --- a/base/stats_table_unittest.cc +++ b/base/stats_table_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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. @@ -208,7 +208,7 @@ TEST_F(StatsTableTest, MultipleProcesses) { // Spawn the processes. for (int16 index = 0; index < kMaxProcs; index++) { procs[index] = this->SpawnChild(L"StatsTableMultipleProcessMain"); - EXPECT_NE(0, procs[index]); + EXPECT_NE(static_cast(NULL), procs[index]); } // Wait for the processes to finish. diff --git a/base/system_monitor.h b/base/system_monitor.h index 6322be9..aeec42b 100644 --- a/base/system_monitor.h +++ b/base/system_monitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2008 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. @@ -72,9 +72,6 @@ class SystemMonitor { // Notification that the system is resuming. virtual void OnResume(SystemMonitor*) = 0; - - protected: - ~PowerObserver() {} }; // Add a new observer. diff --git a/base/task.h b/base/task.h index 2b3b51c..447bfab 100644 --- a/base/task.h +++ b/base/task.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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. @@ -678,7 +678,6 @@ template struct CallbackWithReturnValue { class Type { public: - virtual ~Type() {} virtual ReturnValue Run() = 0; }; }; @@ -694,9 +693,6 @@ class CallbackWithReturnValueImpl virtual ReturnValue Run() { return (this->obj_->*(this->meth_))(); } - - protected: - ~CallbackWithReturnValueImpl() {} }; template diff --git a/base/third_party/dmg_fp/README.chromium b/base/third_party/dmg_fp/README.chromium index b857044..046f273 100644 --- a/base/third_party/dmg_fp/README.chromium +++ b/base/third_party/dmg_fp/README.chromium @@ -14,4 +14,3 @@ List of changes made to original code: - made some minor changes to allow clean compilation under g++ -Wall, see gcc_warnings.patch. - made some minor changes to build on 64-bit, see gcc_64_bit.patch. - - made some implicit type converisons explicit, see type_conversion.patch. diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc index ffbc088..c1bc476 100644 --- a/base/third_party/dmg_fp/dtoa.cc +++ b/base/third_party/dmg_fp/dtoa.cc @@ -1559,7 +1559,7 @@ hexnan CONST char *s; int c1, havedig, udx0, xshift; - if (!hexdig[static_cast('0')]) + if (!hexdig['0']) hexdig_init(); x[0] = x[1] = 0; havedig = xshift = 0; @@ -3283,7 +3283,7 @@ strtod #ifdef Avoid_Underflow if (bc.scale && y <= 2*P*Exp_msk1) { if (aadj <= 0x7fffffff) { - if ((z = static_cast(aadj)) <= 0) + if ((z = aadj) <= 0) z = 1; aadj = z; aadj1 = bc.dsign ? aadj : -aadj; @@ -3837,7 +3837,7 @@ dtoa */ dval(&eps) = 0.5/tens[ilim-1] - dval(&eps); for(i = 0;;) { - L = static_cast(dval(&u)); + L = dval(&u); dval(&u) -= L; *s++ = '0' + (int)L; if (dval(&u) < dval(&eps)) diff --git a/base/time.cc b/base/time.cc index 93b3311..992e256 100644 --- a/base/time.cc +++ b/base/time.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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. @@ -51,7 +51,7 @@ int64 TimeDelta::InMicroseconds() const { Time Time::FromTimeT(time_t tt) { if (tt == 0) return Time(); // Preserve 0 so we can tell it doesn't exist. - return Time((tt * kMicrosecondsPerSecond) + kTimeTToMicrosecondsOffset); + return (tt * kMicrosecondsPerSecond) + kTimeTToMicrosecondsOffset; } time_t Time::ToTimeT() const { @@ -62,9 +62,8 @@ time_t Time::ToTimeT() const { // static Time Time::FromDoubleT(double dt) { - return Time(static_cast((dt * - static_cast(kMicrosecondsPerSecond)) + - kTimeTToMicrosecondsOffset)); + return (dt * static_cast(kMicrosecondsPerSecond)) + + kTimeTToMicrosecondsOffset; } double Time::ToDoubleT() const { diff --git a/base/time.h b/base/time.h index 6a181af..a57c04f 100644 --- a/base/time.h +++ b/base/time.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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. @@ -313,10 +313,10 @@ class Time { // Return a new time modified by some delta. Time operator+(TimeDelta delta) const { - return Time(us_ + delta.delta_); + return us_ + delta.delta_; } Time operator-(TimeDelta delta) const { - return Time(us_ - delta.delta_); + return us_ - delta.delta_; } // Comparison operators @@ -350,7 +350,7 @@ class Time { // |is_local = true| or UTC |is_local = false|. static Time FromExploded(bool is_local, const Exploded& exploded); - explicit Time(int64 us) : us_(us) { + Time(int64 us) : us_(us) { } // The representation of Jan 1, 1970 UTC in microseconds since the diff --git a/base/time_posix.cc b/base/time_posix.cc index 66e0345..66f41d3 100644 --- a/base/time_posix.cc +++ b/base/time_posix.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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. diff --git a/base/waitable_event.h b/base/waitable_event.h index 2b498497..31aa085 100644 --- a/base/waitable_event.h +++ b/base/waitable_event.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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. @@ -121,9 +121,6 @@ class WaitableEvent { // pointers match then this function is called as a final check. See the // comments in ~Handle for why. virtual bool Compare(void* tag) = 0; - - protected: - ~Waiter() {} }; private: diff --git a/base/waitable_event_watcher_unittest.cc b/base/waitable_event_watcher_unittest.cc index 80e64b5..049de38 100644 --- a/base/waitable_event_watcher_unittest.cc +++ b/base/waitable_event_watcher_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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. @@ -38,7 +38,7 @@ void RunTest_BasicSignal(MessageLoop::Type message_loop_type) { WaitableEvent event(true, false); WaitableEventWatcher watcher; - EXPECT_TRUE(NULL == watcher.GetWatchedEvent()); + EXPECT_EQ(NULL, watcher.GetWatchedEvent()); QuitDelegate delegate; watcher.StartWatching(&event, &delegate); @@ -48,7 +48,7 @@ void RunTest_BasicSignal(MessageLoop::Type message_loop_type) { MessageLoop::current()->Run(); - EXPECT_TRUE(NULL == watcher.GetWatchedEvent()); + EXPECT_EQ(NULL, watcher.GetWatchedEvent()); } void RunTest_BasicCancel(MessageLoop::Type message_loop_type) { -- cgit v1.1