summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-16 18:25:37 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-16 18:25:37 +0000
commitc21e0e82db0a3e9a60940f7ceea74edb5a1c4122 (patch)
tree1bf0d8d3ab7e2adab9893158a8be1f8638698e62
parenta3cd502bb5891548171a4bb17fe1ce351cd45ba7 (diff)
downloadchromium_src-c21e0e82db0a3e9a60940f7ceea74edb5a1c4122.zip
chromium_src-c21e0e82db0a3e9a60940f7ceea74edb5a1c4122.tar.gz
chromium_src-c21e0e82db0a3e9a60940f7ceea74edb5a1c4122.tar.bz2
patch
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49982 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/linked_list.h6
-rw-r--r--base/logging.h23
-rw-r--r--base/message_loop_unittest.cc12
-rw-r--r--base/message_pump_libevent.cc12
-rw-r--r--base/string_util.h8
-rw-r--r--base/third_party/dmg_fp/dtoa.cc2
-rw-r--r--build/common.gypi12
-rw-r--r--chrome/browser/zygote_main_linux.cc5
-rw-r--r--ipc/ipc_message_utils.h6
-rw-r--r--media/audio/linux/alsa_output.cc3
-rw-r--r--media/audio/linux/alsa_output.h2
-rw-r--r--net/socket/tcp_client_socket_libevent.cc3
-rw-r--r--sandbox/sandbox.gyp4
-rw-r--r--skia/skia.gyp1
-rw-r--r--testing/gmock/include/gmock/gmock-actions.h2
-rw-r--r--testing/gtest.gyp2
16 files changed, 71 insertions, 32 deletions
diff --git a/base/linked_list.h b/base/linked_list.h
index 5b5184f..7464997 100644
--- a/base/linked_list.h
+++ b/base/linked_list.h
@@ -125,6 +125,10 @@ class LinkNode {
return static_cast<T*>(this);
}
+ void set(LinkNode<T>* prev, LinkNode<T>* next) {
+ previous_ = prev; next_ = next;
+ }
+
private:
LinkNode<T>* previous_;
LinkNode<T>* next_;
@@ -136,7 +140,7 @@ class LinkedList {
// The "root" node is self-referential, and forms the basis of a circular
// list (root_.next() will point back to the start of the list,
// and root_->previous() wraps around to the end of the list).
- LinkedList() : root_(&root_, &root_) {}
+ LinkedList() { root_.set(&root_, &root_); }
// Appends |e| to the end of the linked list.
void Append(LinkNode<T>* e) {
diff --git a/base/logging.h b/base/logging.h
index 07a0d0f..f11d3b2 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -101,6 +101,18 @@
// There is also the special severity of DFATAL, which logs FATAL in
// debug mode, ERROR_REPORT in normal mode.
+// XXX better comment -- must be before we use << and in global namespace
+// These functions are provided as a convenience for logging, which is where we
+// use streams (it is against Google style to use streams in other places). It
+// is designed to allow you to emit non-ASCII Unicode strings to the log file,
+// which is normally ASCII. It is relatively slow, so try not to use it for
+// common cases. Non-ASCII characters will be converted to UTF-8 by these
+// operators.
+std::ostream& operator<<(std::ostream& out, const wchar_t* wstr);
+inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
+ return out << wstr.c_str();
+}
+
namespace logging {
// Where to record logging output? A flat file and/or system debug log via
@@ -813,17 +825,6 @@ void RawLog(int level, const char* message);
} // namespace logging
-// These functions are provided as a convenience for logging, which is where we
-// use streams (it is against Google style to use streams in other places). It
-// is designed to allow you to emit non-ASCII Unicode strings to the log file,
-// which is normally ASCII. It is relatively slow, so try not to use it for
-// common cases. Non-ASCII characters will be converted to UTF-8 by these
-// operators.
-std::ostream& operator<<(std::ostream& out, const wchar_t* wstr);
-inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
- return out << wstr.c_str();
-}
-
// The NOTIMPLEMENTED() macro annotates codepaths which have
// not been implemented yet.
//
diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc
index 6208e99..6069f20 100644
--- a/base/message_loop_unittest.cc
+++ b/base/message_loop_unittest.cc
@@ -1578,8 +1578,10 @@ TEST(MessageLoopTest, FileDescriptorWatcherOutlivesMessageLoop) {
// and don't run the message loop, just destroy it.
}
}
- HANDLE_EINTR(close(pipefds[0]));
- HANDLE_EINTR(close(pipefds[1]));
+ if (HANDLE_EINTR(close(pipefds[0])) < 0)
+ PLOG(WARNING) << "close";
+ if (HANDLE_EINTR(close(pipefds[1])) < 0)
+ PLOG(WARNING) << "close";
}
TEST(MessageLoopTest, FileDescriptorWatcherDoubleStop) {
@@ -1601,8 +1603,10 @@ TEST(MessageLoopTest, FileDescriptorWatcherDoubleStop) {
controller.StopWatchingFileDescriptor();
}
}
- HANDLE_EINTR(close(pipefds[0]));
- HANDLE_EINTR(close(pipefds[1]));
+ if (HANDLE_EINTR(close(pipefds[0])) < 0)
+ PLOG(WARNING) << "close";
+ if (HANDLE_EINTR(close(pipefds[1])) < 0)
+ PLOG(WARNING) << "close";
}
} // namespace
diff --git a/base/message_pump_libevent.cc b/base/message_pump_libevent.cc
index c2390b4..3a749b4 100644
--- a/base/message_pump_libevent.cc
+++ b/base/message_pump_libevent.cc
@@ -160,10 +160,14 @@ MessagePumpLibevent::~MessagePumpLibevent() {
DCHECK(event_base_);
event_del(wakeup_event_);
delete wakeup_event_;
- if (wakeup_pipe_in_ >= 0)
- HANDLE_EINTR(close(wakeup_pipe_in_));
- if (wakeup_pipe_out_ >= 0)
- HANDLE_EINTR(close(wakeup_pipe_out_));
+ if (wakeup_pipe_in_ >= 0) {
+ if (HANDLE_EINTR(close(wakeup_pipe_in_)) < 0)
+ PLOG(WARNING) << "close";
+ }
+ if (wakeup_pipe_out_ >= 0) {
+ if (HANDLE_EINTR(close(wakeup_pipe_out_)) < 0)
+ PLOG(WARNING) << "close";
+ }
event_base_free(event_base_);
}
diff --git a/base/string_util.h b/base/string_util.h
index 11a9fd2..87865b6 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -54,6 +54,10 @@ int vswprintf(wchar_t* buffer, size_t size,
// Some of these implementations need to be inlined.
+// CLANG NOTE
+// Qualified calls with base:: is to work around
+// http://llvm.org/bugs/show_bug.cgi?id=6762
+
// We separate the declaration from the implementation of this inline
// function just so the PRINTF_FORMAT works.
inline int snprintf(char* buffer, size_t size, const char* format, ...)
@@ -61,7 +65,7 @@ inline int snprintf(char* buffer, size_t size, const char* format, ...)
inline int snprintf(char* buffer, size_t size, const char* format, ...) {
va_list arguments;
va_start(arguments, format);
- int result = vsnprintf(buffer, size, format, arguments);
+ int result = base::vsnprintf(buffer, size, format, arguments);
va_end(arguments);
return result;
}
@@ -73,7 +77,7 @@ inline int swprintf(wchar_t* buffer, size_t size, const wchar_t* format, ...)
inline int swprintf(wchar_t* buffer, size_t size, const wchar_t* format, ...) {
va_list arguments;
va_start(arguments, format);
- int result = vswprintf(buffer, size, format, arguments);
+ int result = base::vswprintf(buffer, size, format, arguments);
va_end(arguments);
return result;
}
diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc
index 3f7e794..ad71fb6 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['0'])
+ if (!hexdig[(int)'0'])
hexdig_init();
x[0] = x[1] = 0;
havedig = xshift = 0;
diff --git a/build/common.gypi b/build/common.gypi
index e2da12b..5f7740a 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -229,11 +229,14 @@
# Set this to true to enable SELinux support.
'selinux%': 0,
+ # Set this to true when building with Clang.
+ 'clang%': 1,
+
# Strip the binary after dumping symbols.
'linux_strip_binary%': 0,
- # Enable TCMalloc.
- 'linux_use_tcmalloc%': 1,
+ # Disable TCMalloc. It uses variable length arrays which aren't in C++.
+ 'linux_use_tcmalloc%': 0,
# Disable TCMalloc's debugallocation.
'linux_use_debugallocation%': 0,
@@ -810,6 +813,11 @@
'-Wno-unused-parameter',
# Don't warn about the "struct foo f = {0};" initialization pattern.
'-Wno-missing-field-initializers',
+ # Don't warn about unused variables, due to a common pattern:
+ # scoped_deleter_of_some_sort unused_variable(&thing_to_delete);
+ '-Wno-unused-variable',
+ # gtest confuses clang.
+ '-Wno-bool-conversions',
'-D_FILE_OFFSET_BITS=64',
# Don't export any symbols (for example, to plugins we dlopen()).
# Note: this is *required* to make some plugins work.
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index fc2d441..d58173a 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/chrome/browser/zygote_main_linux.cc
@@ -616,6 +616,11 @@ static bool EnterSandbox() {
#endif // CHROMIUM_SELINUX
+// CLANG HACK
+int SupportsSeccompSandbox(int) { return 0; }
+void SeccompSandboxSetProcSelfMaps(int) {}
+void StartSeccompSandbox() {}
+
bool ZygoteMain(const MainFunctionParams& params) {
#if !defined(CHROMIUM_SELINUX)
g_am_zygote_or_renderer = true;
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index df2c6c7..f4cd245 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -112,7 +112,8 @@ struct SimilarTypeTraits {
template <class P>
static inline void WriteParam(Message* m, const P& p) {
typedef typename SimilarTypeTraits<P>::Type Type;
- ParamTraits<Type>::Write(m, static_cast<const Type& >(p));
+ const Type& t = p;
+ ParamTraits<Type>::Write(m, t);
}
template <class P>
@@ -125,7 +126,8 @@ static inline bool WARN_UNUSED_RESULT ReadParam(const Message* m, void** iter,
template <class P>
static inline void LogParam(const P& p, std::wstring* l) {
typedef typename SimilarTypeTraits<P>::Type Type;
- ParamTraits<Type>::Log(static_cast<const Type& >(p), l);
+ const Type& t = p;
+ ParamTraits<Type>::Log(t, l);
}
template <>
diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc
index b4c4dd2..1b433ba 100644
--- a/media/audio/linux/alsa_output.cc
+++ b/media/audio/linux/alsa_output.cc
@@ -210,7 +210,8 @@ static void Swizzle51Layout(Format* b, uint32 filled) {
} // namespace
-// Not in an anonymous so that it can be a friend to AlsaPcmOutputStream.
+// Not in an anonymous namespace so that it can be a friend to
+// AlsaPcmOutputStream.
std::ostream& operator<<(std::ostream& os,
AlsaPcmOutputStream::InternalState state) {
switch (state) {
diff --git a/media/audio/linux/alsa_output.h b/media/audio/linux/alsa_output.h
index 5f54d3b..6a2795b 100644
--- a/media/audio/linux/alsa_output.h
+++ b/media/audio/linux/alsa_output.h
@@ -114,6 +114,7 @@ class AlsaPcmOutputStream :
virtual ~AlsaPcmOutputStream();
+ public: // clang workaround
// Flags indicating the state of the stream.
enum InternalState {
kInError = 0,
@@ -123,6 +124,7 @@ class AlsaPcmOutputStream :
kIsStopped,
kIsClosed
};
+ private:
friend std::ostream& operator<<(std::ostream& os, InternalState);
// Various tasks that complete actions started in the public API.
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc
index 102a8fb..fc0e33b 100644
--- a/net/socket/tcp_client_socket_libevent.cc
+++ b/net/socket/tcp_client_socket_libevent.cc
@@ -256,7 +256,8 @@ void TCPClientSocketLibevent::DoDisconnect() {
DCHECK(ok);
ok = write_socket_watcher_.StopWatchingFileDescriptor();
DCHECK(ok);
- HANDLE_EINTR(close(socket_));
+ if (HANDLE_EINTR(close(socket_)) < 0)
+ PLOG(WARNING) << "close";
socket_ = kInvalidSocket;
}
diff --git a/sandbox/sandbox.gyp b/sandbox/sandbox.gyp
index 706cba2..ab89665 100644
--- a/sandbox/sandbox.gyp
+++ b/sandbox/sandbox.gyp
@@ -135,7 +135,7 @@
},
],
}],
- [ 'OS=="linux" and selinux==0', {
+ [ 'OS=="linux" and selinux==0 and clang==0', {
'targets': [
{
'target_name': 'chrome_sandbox',
@@ -168,7 +168,7 @@
},
],
}],
- [ 'OS=="linux" and selinux==1', {
+ [ 'OS=="linux" and (selinux==1 or clang==1)', {
# GYP requires that each file have at least one target defined.
'targets': [
{
diff --git a/skia/skia.gyp b/skia/skia.gyp
index 2b17094..38e8423 100644
--- a/skia/skia.gyp
+++ b/skia/skia.gyp
@@ -552,6 +552,7 @@
],
'defines': [
'SK_BUILD_NO_IMAGE_ENCODE',
+ 'SK_RESTRICT=', # Remove use of __restrict__ -- not sure it's correct.
],
'sources!': [
'../third_party/skia/include/core/SkTypes.h',
diff --git a/testing/gmock/include/gmock/gmock-actions.h b/testing/gmock/include/gmock/gmock-actions.h
index 007ad9d..d7baa5d 100644
--- a/testing/gmock/include/gmock/gmock-actions.h
+++ b/testing/gmock/include/gmock/gmock-actions.h
@@ -680,7 +680,7 @@ class SetArgumentPointeeAction {
template <typename Result, typename ArgumentTuple>
void Perform(const ArgumentTuple& args) const {
- CompileAssertTypesEqual<void, Result>();
+ // CompileAssertTypesEqual<void, Result>();
*::std::tr1::get<N>(args) = value_;
}
diff --git a/testing/gtest.gyp b/testing/gtest.gyp
index c8f64e5..706f11d 100644
--- a/testing/gtest.gyp
+++ b/testing/gtest.gyp
@@ -69,10 +69,12 @@
# must be instructed that RTTI is disabled here, and for any
# direct dependents that might include gtest headers.
'GTEST_HAS_RTTI=0',
+ 'GTEST_USE_OWN_TR1_TUPLE=1',
],
'direct_dependent_settings': {
'defines': [
'GTEST_HAS_RTTI=0',
+ 'GTEST_USE_OWN_TR1_TUPLE=1',
],
},
}],