aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordmaclach <dmaclach@4c0a9323-5329-0410-9bdc-e9ce6186880e>2014-02-26 16:14:04 +0000
committerdmaclach <dmaclach@4c0a9323-5329-0410-9bdc-e9ce6186880e>2014-02-26 16:14:04 +0000
commit334b2c70f06c5cef6b5e2e0004da088b98c41ed9 (patch)
tree4bef2ccae9bde83b680da9a9f75b1f7e8c595f9e
parentFixup breakpad compile for Xcode 5.1 iOS release (diff)
downloadbreakpad-334b2c70f06c5cef6b5e2e0004da088b98c41ed9.tar.xz
Update GTM and enable -Wundef and strict C++11 flags.
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1283 4c0a9323-5329-0410-9bdc-e9ce6186880e
-rw-r--r--src/client/ios/Breakpad.xcodeproj/project.pbxproj4
-rw-r--r--src/client/mac/handler/minidump_generator.cc21
-rw-r--r--src/client/minidump_file_writer.cc8
-rw-r--r--src/common/mac/GTMDefines.h44
-rw-r--r--src/common/mac/GTMGarbageCollection.h72
-rw-r--r--src/common/mac/GTMLogger.m3
6 files changed, 51 insertions, 101 deletions
diff --git a/src/client/ios/Breakpad.xcodeproj/project.pbxproj b/src/client/ios/Breakpad.xcodeproj/project.pbxproj
index 91e1b812..e9fcae3f 100644
--- a/src/client/ios/Breakpad.xcodeproj/project.pbxproj
+++ b/src/client/ios/Breakpad.xcodeproj/project.pbxproj
@@ -498,6 +498,7 @@
1DEB922308733DC00010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -519,12 +520,14 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
SDKROOT = iphoneos;
+ WARNING_CFLAGS = "-Wundef";
};
name = Debug;
};
1DEB922408733DC00010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -544,6 +547,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
OTHER_LDFLAGS = "-ObjC";
SDKROOT = iphoneos;
+ WARNING_CFLAGS = "-Wundef";
};
name = Release;
};
diff --git a/src/client/mac/handler/minidump_generator.cc b/src/client/mac/handler/minidump_generator.cc
index 2326973a..7b166e58 100644
--- a/src/client/mac/handler/minidump_generator.cc
+++ b/src/client/mac/handler/minidump_generator.cc
@@ -62,7 +62,7 @@ using MacStringUtils::IntegerValueAtIndex;
namespace google_breakpad {
-#if __LP64__
+#if defined(__LP64__) && __LP64__
#define LC_SEGMENT_ARCH LC_SEGMENT_64
#else
#define LC_SEGMENT_ARCH LC_SEGMENT
@@ -627,8 +627,11 @@ bool MinidumpGenerator::WriteContextPPC(breakpad_thread_state_data_t state,
MDRawContextPPC *context_ptr = context.get();
context_ptr->context_flags = MD_CONTEXT_PPC_BASE;
-#define AddReg(a) context_ptr->a = REGISTER_FROM_THREADSTATE(machine_state, a)
-#define AddGPR(a) context_ptr->gpr[a] = REGISTER_FROM_THREADSTATE(machine_state, r ## a)
+#define AddReg(a) context_ptr->a = static_cast<__typeof__(context_ptr->a)>( \
+ REGISTER_FROM_THREADSTATE(machine_state, a))
+#define AddGPR(a) context_ptr->gpr[a] = \
+ static_cast<__typeof__(context_ptr->a)>( \
+ REGISTER_FROM_THREADSTATE(machine_state, r ## a)
AddReg(srr0);
AddReg(cr);
@@ -690,8 +693,11 @@ bool MinidumpGenerator::WriteContextPPC64(
MDRawContextPPC64 *context_ptr = context.get();
context_ptr->context_flags = MD_CONTEXT_PPC_BASE;
-#define AddReg(a) context_ptr->a = REGISTER_FROM_THREADSTATE(machine_state, a)
-#define AddGPR(a) context_ptr->gpr[a] = REGISTER_FROM_THREADSTATE(machine_state, r ## a)
+#define AddReg(a) context_ptr->a = static_cast<__typeof__(context_ptr->a)>( \
+ REGISTER_FROM_THREADSTATE(machine_state, a))
+#define AddGPR(a) context_ptr->gpr[a] = \
+ static_cast<__typeof__(context_ptr->a)>( \
+ REGISTER_FROM_THREADSTATE(machine_state, r ## a)
AddReg(srr0);
AddReg(cr);
@@ -789,7 +795,8 @@ bool MinidumpGenerator::WriteContextX86(breakpad_thread_state_data_t state,
*register_location = context.location();
MDRawContextX86 *context_ptr = context.get();
-#define AddReg(a) context_ptr->a = REGISTER_FROM_THREADSTATE(machine_state, a)
+#define AddReg(a) context_ptr->a = static_cast<__typeof__(context_ptr->a)>( \
+ REGISTER_FROM_THREADSTATE(machine_state, a))
context_ptr->context_flags = MD_CONTEXT_X86;
AddReg(eax);
@@ -828,7 +835,7 @@ bool MinidumpGenerator::WriteContextX86_64(
*register_location = context.location();
MDRawContextAMD64 *context_ptr = context.get();
-#define AddReg(a) context_ptr->a = static_cast<typeof(context_ptr->a)>( \
+#define AddReg(a) context_ptr->a = static_cast<__typeof__(context_ptr->a)>( \
REGISTER_FROM_THREADSTATE(machine_state, a))
context_ptr->context_flags = MD_CONTEXT_AMD64;
diff --git a/src/client/minidump_file_writer.cc b/src/client/minidump_file_writer.cc
index 1e18d24b..9e905335 100644
--- a/src/client/minidump_file_writer.cc
+++ b/src/client/minidump_file_writer.cc
@@ -40,7 +40,7 @@
#include "client/minidump_file_writer-inl.h"
#include "common/linux/linux_libc_support.h"
#include "common/string_conversion.h"
-#if __linux__
+#if defined(__linux__) && __linux__
#include "third_party/lss/linux_syscall_support.h"
#endif
@@ -62,7 +62,7 @@ MinidumpFileWriter::~MinidumpFileWriter() {
bool MinidumpFileWriter::Open(const char *path) {
assert(file_ == -1);
-#if __linux__
+#if defined(__linux__) && __linux__
file_ = sys_open(path, O_WRONLY | O_CREAT | O_EXCL, 0600);
#else
file_ = open(path, O_WRONLY | O_CREAT | O_EXCL, 0600);
@@ -84,7 +84,7 @@ bool MinidumpFileWriter::Close() {
if (-1 == ftruncate(file_, position_)) {
return false;
}
-#if __linux__
+#if defined(__linux__) && __linux__
result = (sys_close(file_) == 0);
#else
result = (close(file_) == 0);
@@ -253,7 +253,7 @@ bool MinidumpFileWriter::Copy(MDRVA position, const void *src, ssize_t size) {
return false;
// Seek and write the data
-#if __linux__
+#if defined(__linux__) && __linux__
if (sys_lseek(file_, position, SEEK_SET) == static_cast<off_t>(position)) {
if (sys_write(file_, src, size) == size) {
#else
diff --git a/src/common/mac/GTMDefines.h b/src/common/mac/GTMDefines.h
index b970d69c..14ffa7e1 100644
--- a/src/common/mac/GTMDefines.h
+++ b/src/common/mac/GTMDefines.h
@@ -193,9 +193,11 @@
// For iPhone specific stuff
#define GTM_IPHONE_SDK 1
#if TARGET_IPHONE_SIMULATOR
+ #define GTM_IPHONE_DEVICE 0
#define GTM_IPHONE_SIMULATOR 1
#else
#define GTM_IPHONE_DEVICE 1
+ #define GTM_IPHONE_SIMULATOR 0
#endif // TARGET_IPHONE_SIMULATOR
// By default, GTM has provided it's own unittesting support, define this
// to use the support provided by Xcode, especially for the Xcode4 support
@@ -203,9 +205,14 @@
#ifndef GTM_IPHONE_USE_SENTEST
#define GTM_IPHONE_USE_SENTEST 0
#endif
+ #define GTM_MACOS_SDK 0
#else
// For MacOS specific stuff
#define GTM_MACOS_SDK 1
+ #define GTM_IPHONE_SDK 0
+ #define GTM_IPHONE_SIMULATOR 0
+ #define GTM_IPHONE_DEVICE 0
+ #define GTM_IPHONE_USE_SENTEST 0
#endif
// Some of our own availability macros
@@ -217,21 +224,10 @@
#define GTM_AVAILABLE_ONLY_ON_MACOS UNAVAILABLE_ATTRIBUTE
#endif
-// Provide a symbol to include/exclude extra code for GC support. (This mainly
-// just controls the inclusion of finalize methods).
+// GC was dropped by Apple, define the old constant incase anyone still keys
+// off of it.
#ifndef GTM_SUPPORT_GC
- #if GTM_IPHONE_SDK
- // iPhone never needs GC
- #define GTM_SUPPORT_GC 0
- #else
- // We can't find a symbol to tell if GC is supported/required, so best we
- // do on Mac targets is include it if we're on 10.5 or later.
- #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
- #define GTM_SUPPORT_GC 0
- #else
- #define GTM_SUPPORT_GC 1
- #endif
- #endif
+ #define GTM_SUPPORT_GC 0
#endif
// To simplify support for 64bit (and Leopard in general), we provide the type
@@ -239,7 +235,7 @@
#if !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
// NSInteger/NSUInteger and Max/Mins
#ifndef NSINTEGER_DEFINED
- #if __LP64__ || NS_BUILD_32_LIKE_64
+ #if (defined(__LP64__) && __LP64__) || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
@@ -352,7 +348,15 @@
#endif
#ifndef GTM_NONNULL
- #define GTM_NONNULL(x) __attribute__((nonnull(x)))
+ #if defined(__has_attribute)
+ #if __has_attribute(nonnull)
+ #define GTM_NONNULL(x) __attribute__((nonnull x))
+ #else
+ #define GTM_NONNULL(x)
+ #endif
+ #else
+ #define GTM_NONNULL(x)
+ #endif
#endif
// Invalidates the initializer from which it's called.
@@ -374,6 +378,14 @@
#endif
#endif
+#ifndef GTMCFAutorelease
+ #if __has_feature(objc_arc)
+ #define GTMCFAutorelease(x) CFBridgingRelease(x)
+ #else
+ #define GTMCFAutorelease(x) ([(id)x autorelease])
+ #endif
+#endif
+
#ifdef __OBJC__
// Declared here so that it can easily be used for logging tracking if
diff --git a/src/common/mac/GTMGarbageCollection.h b/src/common/mac/GTMGarbageCollection.h
deleted file mode 100644
index 93d4efab..00000000
--- a/src/common/mac/GTMGarbageCollection.h
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// GTMGarbageCollection.h
-//
-// Copyright 2007-2008 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy
-// of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-//
-
-#import <Foundation/Foundation.h>
-
-#import "GTMDefines.h"
-
-// This allows us to easily move our code from GC to non GC.
-// They are no-ops unless we are require Leopard or above.
-// See
-// http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/index.html
-// and
-// http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcCoreFoundation.html#//apple_ref/doc/uid/TP40006687-SW1
-// for details.
-
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) && !GTM_IPHONE_SDK
-// General use would be to call this through GTMCFAutorelease
-// but there may be a reason the you want to make something collectable
-// but not autoreleased, especially in pure GC code where you don't
-// want to bother with the nop autorelease. Done as a define instead of an
-// inline so that tools like Clang's scan-build don't report code as leaking.
-#define GTMNSMakeCollectable(cf) ((id)NSMakeCollectable(cf))
-
-// GTMNSMakeUncollectable is for global maps, etc. that we don't
-// want released ever. You should still retain these in non-gc code.
-GTM_INLINE void GTMNSMakeUncollectable(id object) {
- [[NSGarbageCollector defaultCollector] disableCollectorForPointer:object];
-}
-
-// Hopefully no code really needs this, but GTMIsGarbageCollectionEnabled is
-// a common way to check at runtime if GC is on.
-// There are some places where GC doesn't work w/ things w/in Apple's
-// frameworks, so this is here so GTM unittests and detect it, and not run
-// individual tests to work around bugs in Apple's frameworks.
-GTM_INLINE BOOL GTMIsGarbageCollectionEnabled(void) {
- return ([NSGarbageCollector defaultCollector] != nil);
-}
-
-#else
-
-#define GTMNSMakeCollectable(cf) ((id)(cf))
-
-GTM_INLINE void GTMNSMakeUncollectable(id object) {
-}
-
-GTM_INLINE BOOL GTMIsGarbageCollectionEnabled(void) {
- return NO;
-}
-
-#endif
-
-// GTMCFAutorelease makes a CF object collectable in GC mode, or adds it
-// to the autorelease pool in non-GC mode. Either way it is taken care
-// of. Done as a define instead of an inline so that tools like Clang's
-// scan-build don't report code as leaking.
-#define GTMCFAutorelease(cf) ([GTMNSMakeCollectable(cf) autorelease])
-
diff --git a/src/common/mac/GTMLogger.m b/src/common/mac/GTMLogger.m
index 4b40747b..ebc5836a 100644
--- a/src/common/mac/GTMLogger.m
+++ b/src/common/mac/GTMLogger.m
@@ -17,7 +17,6 @@
//
#import "GTMLogger.h"
-#import "GTMGarbageCollection.h"
#import <fcntl.h>
#import <unistd.h>
#import <stdlib.h>
@@ -506,7 +505,7 @@ static BOOL IsVerboseLoggingEnabled(void) {
// In DEBUG builds, log everything. If we're not in a debug build we'll assume
// that we're in a Release build.
- (BOOL)filterAllowsMessage:(NSString *)msg level:(GTMLoggerLevel)level {
-#if DEBUG
+#if defined(DEBUG) && DEBUG
return YES;
#endif