summaryrefslogtreecommitdiffstats
path: root/third_party/python/gyp/test/mac/xcode-gcc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/python/gyp/test/mac/xcode-gcc')
-rw-r--r--third_party/python/gyp/test/mac/xcode-gcc/aliasing.cc13
-rw-r--r--third_party/python/gyp/test/mac/xcode-gcc/test-clang.gyp42
-rw-r--r--third_party/python/gyp/test/mac/xcode-gcc/test.gyp60
-rw-r--r--third_party/python/gyp/test/mac/xcode-gcc/valid_c.c8
-rw-r--r--third_party/python/gyp/test/mac/xcode-gcc/valid_cc.cc8
-rw-r--r--third_party/python/gyp/test/mac/xcode-gcc/valid_m.m8
-rw-r--r--third_party/python/gyp/test/mac/xcode-gcc/valid_mm.mm8
-rw-r--r--third_party/python/gyp/test/mac/xcode-gcc/warn_about_invalid_offsetof_macro.cc15
-rw-r--r--third_party/python/gyp/test/mac/xcode-gcc/warn_about_missing_newline.c8
9 files changed, 170 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/mac/xcode-gcc/aliasing.cc b/third_party/python/gyp/test/mac/xcode-gcc/aliasing.cc
new file mode 100644
index 0000000000..16a41efb15
--- /dev/null
+++ b/third_party/python/gyp/test/mac/xcode-gcc/aliasing.cc
@@ -0,0 +1,13 @@
+#include <stdio.h>
+
+void check(int* h, long* k) {
+ *h = 1;
+ *k = 0;
+ printf("%d\n", *h);
+}
+
+int main(void) {
+ long k;
+ check((int*)&k, &k);
+ return 0;
+}
diff --git a/third_party/python/gyp/test/mac/xcode-gcc/test-clang.gyp b/third_party/python/gyp/test/mac/xcode-gcc/test-clang.gyp
new file mode 100644
index 0000000000..9f4a98ae73
--- /dev/null
+++ b/third_party/python/gyp/test/mac/xcode-gcc/test-clang.gyp
@@ -0,0 +1,42 @@
+# Copyright (c) 2013 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+{
+ 'make_global_settings': [
+ ['CC', '/usr/bin/clang'],
+ ['CXX', '/usr/bin/clang++'],
+ ],
+
+ 'targets': [
+ {
+ 'target_name': 'aliasing_yes',
+ 'type': 'executable',
+ 'sources': [ 'aliasing.cc', ],
+ 'xcode_settings': {
+ 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
+ 'GCC_STRICT_ALIASING': 'YES',
+ 'GCC_OPTIMIZATION_LEVEL': 2,
+ },
+ },
+ {
+ 'target_name': 'aliasing_no',
+ 'type': 'executable',
+ 'sources': [ 'aliasing.cc', ],
+ 'xcode_settings': {
+ 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
+ 'GCC_STRICT_ALIASING': 'NO',
+ 'GCC_OPTIMIZATION_LEVEL': 2,
+ },
+ },
+ {
+ 'target_name': 'aliasing_default',
+ 'type': 'executable',
+ 'sources': [ 'aliasing.cc', ],
+ 'xcode_settings': {
+ 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
+ 'GCC_OPTIMIZATION_LEVEL': 2,
+ },
+ },
+ ],
+}
+
diff --git a/third_party/python/gyp/test/mac/xcode-gcc/test.gyp b/third_party/python/gyp/test/mac/xcode-gcc/test.gyp
new file mode 100644
index 0000000000..1ca8b215d8
--- /dev/null
+++ b/third_party/python/gyp/test/mac/xcode-gcc/test.gyp
@@ -0,0 +1,60 @@
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+{
+ 'target_defaults': {
+ 'xcode_settings': {
+ 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',
+ },
+ },
+
+ 'variables': {
+ # Non-failing tests should check that these trivial files in every language
+ # still compile correctly.
+ 'valid_sources': [
+ 'valid_c.c',
+ 'valid_cc.cc',
+ 'valid_m.m',
+ 'valid_mm.mm',
+ ],
+ },
+
+ # Targets come in pairs: 'foo' and 'foo-fail', with the former building with
+ # no warnings and the latter not.
+ 'targets': [
+ # GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO (default: YES):
+ {
+ 'target_name': 'warn_about_invalid_offsetof_macro',
+ 'type': 'executable',
+ 'sources': [
+ 'warn_about_invalid_offsetof_macro.cc',
+ '<@(valid_sources)',
+ ],
+ 'xcode_settings': {
+ 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO',
+ },
+ },
+ {
+ 'target_name': 'warn_about_invalid_offsetof_macro-fail',
+ 'type': 'executable',
+ 'sources': [ 'warn_about_invalid_offsetof_macro.cc', ],
+ },
+ # GCC_WARN_ABOUT_MISSING_NEWLINE (default: NO):
+ {
+ 'target_name': 'warn_about_missing_newline',
+ 'type': 'executable',
+ 'sources': [
+ 'warn_about_missing_newline.c',
+ '<@(valid_sources)',
+ ],
+ },
+ {
+ 'target_name': 'warn_about_missing_newline-fail',
+ 'type': 'executable',
+ 'sources': [ 'warn_about_missing_newline.c', ],
+ 'xcode_settings': {
+ 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',
+ },
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/mac/xcode-gcc/valid_c.c b/third_party/python/gyp/test/mac/xcode-gcc/valid_c.c
new file mode 100644
index 0000000000..2b10ac3ed7
--- /dev/null
+++ b/third_party/python/gyp/test/mac/xcode-gcc/valid_c.c
@@ -0,0 +1,8 @@
+// Copyright (c) 2012 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file exists to test that valid C files compile correctly.
+
+void FunctionInCFile(void) {
+}
diff --git a/third_party/python/gyp/test/mac/xcode-gcc/valid_cc.cc b/third_party/python/gyp/test/mac/xcode-gcc/valid_cc.cc
new file mode 100644
index 0000000000..31cddc3c9c
--- /dev/null
+++ b/third_party/python/gyp/test/mac/xcode-gcc/valid_cc.cc
@@ -0,0 +1,8 @@
+// Copyright (c) 2012 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file exists to test that valid C++ files compile correctly.
+
+void FunctionInCCFile() {
+}
diff --git a/third_party/python/gyp/test/mac/xcode-gcc/valid_m.m b/third_party/python/gyp/test/mac/xcode-gcc/valid_m.m
new file mode 100644
index 0000000000..95bddb2723
--- /dev/null
+++ b/third_party/python/gyp/test/mac/xcode-gcc/valid_m.m
@@ -0,0 +1,8 @@
+// Copyright (c) 2012 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file exists to test that valid Objective-C files compile correctly.
+
+void FunctionInMFile(void) {
+}
diff --git a/third_party/python/gyp/test/mac/xcode-gcc/valid_mm.mm b/third_party/python/gyp/test/mac/xcode-gcc/valid_mm.mm
new file mode 100644
index 0000000000..a7db7e3ad6
--- /dev/null
+++ b/third_party/python/gyp/test/mac/xcode-gcc/valid_mm.mm
@@ -0,0 +1,8 @@
+// Copyright (c) 2012 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file exists to test that valid Objective-C++ files compile correctly.
+
+void FunctionInMMFile() {
+}
diff --git a/third_party/python/gyp/test/mac/xcode-gcc/warn_about_invalid_offsetof_macro.cc b/third_party/python/gyp/test/mac/xcode-gcc/warn_about_invalid_offsetof_macro.cc
new file mode 100644
index 0000000000..4a4612be0d
--- /dev/null
+++ b/third_party/python/gyp/test/mac/xcode-gcc/warn_about_invalid_offsetof_macro.cc
@@ -0,0 +1,15 @@
+// Copyright (c) 2012 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#define offsetof(st, m) ((unsigned)((char*)&((st*)0)->m - (char*)0))
+
+struct MyStruct {
+ virtual void MyFunc() = 0;
+ int my_member;
+};
+
+int main() {
+ unsigned x = offsetof(MyStruct, my_member);
+ return x ? 0 : 1;
+}
diff --git a/third_party/python/gyp/test/mac/xcode-gcc/warn_about_missing_newline.c b/third_party/python/gyp/test/mac/xcode-gcc/warn_about_missing_newline.c
new file mode 100644
index 0000000000..6faf0895db
--- /dev/null
+++ b/third_party/python/gyp/test/mac/xcode-gcc/warn_about_missing_newline.c
@@ -0,0 +1,8 @@
+// Copyright (c) 2012 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Important: Don't terminate this file with a newline.
+int main() {
+ return 0;
+} \ No newline at end of file