diff options
Diffstat (limited to 'third_party/python/gyp/test/win/compiler-flags')
66 files changed, 1686 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/win/compiler-flags/additional-include-dirs.cc b/third_party/python/gyp/test/win/compiler-flags/additional-include-dirs.cc new file mode 100644 index 0000000000..f1e11dd12d --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/additional-include-dirs.cc @@ -0,0 +1,10 @@ +// 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. + +// No path qualification to test compiler include dir specification. +#include "header.h" + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/additional-include-dirs.gyp b/third_party/python/gyp/test/win/compiler-flags/additional-include-dirs.gyp new file mode 100644 index 0000000000..42c7e849f6 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/additional-include-dirs.gyp @@ -0,0 +1,20 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_incs', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'AdditionalIncludeDirectories': [ + 'subdir', + ], + } + }, + 'sources': ['additional-include-dirs.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/additional-options.cc b/third_party/python/gyp/test/win/compiler-flags/additional-options.cc new file mode 100644 index 0000000000..c79572bafa --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/additional-options.cc @@ -0,0 +1,10 @@ +// 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. + +int main() { + // Generate a warning that will appear at level 4, but not level 1 + // (truncation and unused local). + char c = 123456; + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/additional-options.gyp b/third_party/python/gyp/test/win/compiler-flags/additional-options.gyp new file mode 100644 index 0000000000..6a365a2062 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/additional-options.gyp @@ -0,0 +1,31 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_additional_none', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '4', + 'WarnAsError': 'true', + } + }, + 'sources': ['additional-options.cc'], + }, + { + 'target_name': 'test_additional_one', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '4', + 'WarnAsError': 'true', + 'AdditionalOptions': [ '/W1' ], + } + }, + 'sources': ['additional-options.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/analysis.gyp b/third_party/python/gyp/test/win/compiler-flags/analysis.gyp new file mode 100644 index 0000000000..97e942258f --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/analysis.gyp @@ -0,0 +1,40 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_analysis_on', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnablePREfast': 'true', + 'WarnAsError': 'true', + }, + }, + 'sources': ['uninit.cc'], + }, + { + 'target_name': 'test_analysis_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnablePREfast': 'false', + 'WarnAsError': 'true', + }, + }, + 'sources': ['uninit.cc'], + }, + { + 'target_name': 'test_analysis_unspec', + 'type': 'executable', + 'sources': ['uninit.cc'], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarnAsError': 'true', + }, + }, + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/buffer-security-check.gyp b/third_party/python/gyp/test/win/compiler-flags/buffer-security-check.gyp new file mode 100644 index 0000000000..cc5a12b953 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/buffer-security-check.gyp @@ -0,0 +1,51 @@ +# 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. + +{ + 'targets': [ + # Turn debug information on so that we can see the name of the buffer + # security check cookie in the disassembly. + { + 'target_name': 'test_bsc_unset', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'sources': ['buffer-security.cc'], + }, + { + 'target_name': 'test_bsc_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'BufferSecurityCheck': 'false', + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'sources': ['buffer-security.cc'], + }, + { + 'target_name': 'test_bsc_on', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'BufferSecurityCheck': 'true', + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'sources': ['buffer-security.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/buffer-security.cc b/third_party/python/gyp/test/win/compiler-flags/buffer-security.cc new file mode 100644 index 0000000000..e8a48a2a67 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/buffer-security.cc @@ -0,0 +1,12 @@ +// 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. + +#include <malloc.h> +#include <string.h> + +int main() { + char* stuff = reinterpret_cast<char*>(_alloca(256)); + strcpy(stuff, "blah"); + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/calling-convention-cdecl.def b/third_party/python/gyp/test/win/compiler-flags/calling-convention-cdecl.def new file mode 100644 index 0000000000..dc1dba055a --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/calling-convention-cdecl.def @@ -0,0 +1,6 @@ +; Copyright (c) 2014 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. + +EXPORTS + foo diff --git a/third_party/python/gyp/test/win/compiler-flags/calling-convention-fastcall.def b/third_party/python/gyp/test/win/compiler-flags/calling-convention-fastcall.def new file mode 100644 index 0000000000..2c61afe208 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/calling-convention-fastcall.def @@ -0,0 +1,6 @@ +; Copyright (c) 2014 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. + +EXPORTS + @foo@0 diff --git a/third_party/python/gyp/test/win/compiler-flags/calling-convention-stdcall.def b/third_party/python/gyp/test/win/compiler-flags/calling-convention-stdcall.def new file mode 100644 index 0000000000..6c7e05e9ea --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/calling-convention-stdcall.def @@ -0,0 +1,6 @@ +; Copyright (c) 2014 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. + +EXPORTS + _foo@0 diff --git a/third_party/python/gyp/test/win/compiler-flags/calling-convention-vectorcall.def b/third_party/python/gyp/test/win/compiler-flags/calling-convention-vectorcall.def new file mode 100644 index 0000000000..4ef119c3e3 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/calling-convention-vectorcall.def @@ -0,0 +1,6 @@ +; Copyright (c) 2014 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. + +EXPORTS + foo@@0 diff --git a/third_party/python/gyp/test/win/compiler-flags/calling-convention.cc b/third_party/python/gyp/test/win/compiler-flags/calling-convention.cc new file mode 100644 index 0000000000..0d78a0cc05 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/calling-convention.cc @@ -0,0 +1,6 @@ +// Copyright (c) 2014 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. + +extern "C" void foo() { +} diff --git a/third_party/python/gyp/test/win/compiler-flags/calling-convention.gyp b/third_party/python/gyp/test/win/compiler-flags/calling-convention.gyp new file mode 100644 index 0000000000..5069c552bc --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/calling-convention.gyp @@ -0,0 +1,66 @@ +# Copyright (c) 2014 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. + +{ + 'targets': [ + { + 'target_name': 'test_cdecl', + 'type': 'loadable_module', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'CallingConvention': 0, + }, + }, + 'sources': [ + 'calling-convention.cc', + 'calling-convention-cdecl.def', + ], + }, + { + 'target_name': 'test_fastcall', + 'type': 'loadable_module', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'CallingConvention': 1, + }, + }, + 'sources': [ + 'calling-convention.cc', + 'calling-convention-fastcall.def', + ], + }, + { + 'target_name': 'test_stdcall', + 'type': 'loadable_module', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'CallingConvention': 2, + }, + }, + 'sources': [ + 'calling-convention.cc', + 'calling-convention-stdcall.def', + ], + }, + ], + 'conditions': [ + ['MSVS_VERSION[0:4]>="2013"', { + 'targets': [ + { + 'target_name': 'test_vectorcall', + 'type': 'loadable_module', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'CallingConvention': 3, + }, + }, + 'sources': [ + 'calling-convention.cc', + 'calling-convention-vectorcall.def', + ], + }, + ], + }], + ], +} diff --git a/third_party/python/gyp/test/win/compiler-flags/character-set-mbcs.cc b/third_party/python/gyp/test/win/compiler-flags/character-set-mbcs.cc new file mode 100644 index 0000000000..3286304730 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/character-set-mbcs.cc @@ -0,0 +1,11 @@ +// 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. + +#ifndef _MBCS +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/character-set-unicode.cc b/third_party/python/gyp/test/win/compiler-flags/character-set-unicode.cc new file mode 100644 index 0000000000..32e69724a5 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/character-set-unicode.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. + +#ifndef _UNICODE +#error +#endif + +#ifndef UNICODE +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/character-set.gyp b/third_party/python/gyp/test/win/compiler-flags/character-set.gyp new file mode 100644 index 0000000000..3dc45557d9 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/character-set.gyp @@ -0,0 +1,35 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_cs_notset', + 'product_name': 'test_cs_notset', + 'type': 'executable', + 'msvs_configuration_attributes': { + 'CharacterSet': '0' + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_cs_unicode', + 'product_name': 'test_cs_unicode', + 'type': 'executable', + 'msvs_configuration_attributes': { + 'CharacterSet': '1' + }, + 'sources': ['character-set-unicode.cc'], + }, + { + 'target_name': 'test_cs_mbcs', + 'product_name': 'test_cs_mbcs', + 'type': 'executable', + 'msvs_configuration_attributes': { + 'CharacterSet': '2' + }, + 'sources': ['character-set-mbcs.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/compile-as-managed.cc b/third_party/python/gyp/test/win/compiler-flags/compile-as-managed.cc new file mode 100644 index 0000000000..a29c71ee1d --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/compile-as-managed.cc @@ -0,0 +1,9 @@ +// Copyright (c) 2015 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. + +#include <vcclr.h> + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/compile-as-managed.gyp b/third_party/python/gyp/test/win/compiler-flags/compile-as-managed.gyp new file mode 100644 index 0000000000..3bacbbc135 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/compile-as-managed.gyp @@ -0,0 +1,29 @@ +# Copyright (c) 2015 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. + +{ + 'targets': [ + { + 'target_name': 'test-compile-as-managed', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'CompileAsManaged': 'true', + 'ExceptionHandling': '0' # /clr is incompatible with /EHs + } + }, + 'sources': ['compile-as-managed.cc'], + }, + { + 'target_name': 'test-compile-as-unmanaged', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'CompileAsManaged': 'false', + } + }, + 'sources': ['compile-as-managed.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/compile-as-winrt.cc b/third_party/python/gyp/test/win/compiler-flags/compile-as-winrt.cc new file mode 100644 index 0000000000..da9954f8fb --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/compile-as-winrt.cc @@ -0,0 +1,12 @@ +// Copyright (c) 2016 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. + +using namespace Platform; + +int main() { + wchar_t msg[] = L"Test"; + String^ str1 = ref new String(msg); + auto str2 = String::Concat(str1, " Concat"); + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/compile-as-winrt.gyp b/third_party/python/gyp/test/win/compiler-flags/compile-as-winrt.gyp new file mode 100644 index 0000000000..8978e5059d --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/compile-as-winrt.gyp @@ -0,0 +1,20 @@ +# Copyright (c) 2016 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. + +{ + 'targets': [ + { + 'target_name': 'test-compile-as-winrt', + 'type': 'executable', + 'msvs_windows_sdk_version': 'v10.0', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'AdditionalUsingDirectories': ['$(VCInstallDir)vcpackages;$(WindowsSdkDir)UnionMetadata;%(AdditionalUsingDirectories)'], + 'CompileAsWinRT': 'true' + } + }, + 'sources': ['compile-as-winrt.cc'] + } + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/debug-format.gyp b/third_party/python/gyp/test/win/compiler-flags/debug-format.gyp new file mode 100644 index 0000000000..daaed23ff1 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/debug-format.gyp @@ -0,0 +1,48 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test-debug-format-off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '0' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test-debug-format-oldstyle', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '1' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test-debug-format-pdb', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test-debug-format-editcontinue', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '4' + } + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/default-char-is-unsigned.cc b/third_party/python/gyp/test/win/compiler-flags/default-char-is-unsigned.cc new file mode 100644 index 0000000000..beeca2aa15 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/default-char-is-unsigned.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. + +template <bool> +struct CompileAssert { +}; + +#define COMPILE_ASSERT(expr, msg) \ + typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] + +int main() { + COMPILE_ASSERT(char(-1) > 0, default_char_is_unsigned); + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/default-char-is-unsigned.gyp b/third_party/python/gyp/test/win/compiler-flags/default-char-is-unsigned.gyp new file mode 100644 index 0000000000..941e5810dd --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/default-char-is-unsigned.gyp @@ -0,0 +1,20 @@ +# Copyright (c) 2010 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. + +{ + 'targets': [ + { + 'target_name': 'test_default_char_is_unsigned', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DefaultCharIsUnsigned': 'true', + }, + }, + 'sources': [ + 'default-char-is-unsigned.cc', + ], + }, + ], +} diff --git a/third_party/python/gyp/test/win/compiler-flags/disable-specific-warnings.cc b/third_party/python/gyp/test/win/compiler-flags/disable-specific-warnings.cc new file mode 100644 index 0000000000..d312f5f481 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/disable-specific-warnings.cc @@ -0,0 +1,9 @@ +// 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. + +int main() { + // Causes level 1 warning (C4700) + int i; + return i; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/disable-specific-warnings.gyp b/third_party/python/gyp/test/win/compiler-flags/disable-specific-warnings.gyp new file mode 100644 index 0000000000..d81d694c62 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/disable-specific-warnings.gyp @@ -0,0 +1,29 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_disable_specific_warnings_set', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarnAsError': 'true', + 'DisableSpecificWarnings': ['4700'] + } + }, + 'sources': ['disable-specific-warnings.cc'] + }, + { + 'target_name': 'test_disable_specific_warnings_unset', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarnAsError': 'true' + } + }, + 'sources': ['disable-specific-warnings.cc'] + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.cc b/third_party/python/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.cc new file mode 100644 index 0000000000..432ef54eda --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.cc @@ -0,0 +1,28 @@ +// Copyright (c) 2014 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. + +#include <stdio.h> + +static const char* GetArchOption() { +#if _M_IX86_FP == 0 + return "IA32"; +#elif _M_IX86_FP == 1 + return "SSE"; +#elif _M_IX86_FP == 2 +# if defined(__AVX2__) + return "AVX2"; +# elif defined(__AVX__) + return "AVX"; +# else + return "SSE2"; +# endif +#else + return "UNSUPPORTED OPTION"; +#endif +} + +int main() { + printf("/arch:%s\n", GetArchOption()); + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.gyp b/third_party/python/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.gyp new file mode 100644 index 0000000000..9c49edc7ff --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.gyp @@ -0,0 +1,68 @@ +# Copyright (c) 2014 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. + +{ + 'targets': [ + { + 'target_name': 'sse_extensions', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableEnhancedInstructionSet': '1', # StreamingSIMDExtensions + } + }, + 'sources': ['enable-enhanced-instruction-set.cc'], + }, + { + 'target_name': 'sse2_extensions', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableEnhancedInstructionSet': '2', # StreamingSIMDExtensions2 + } + }, + 'sources': ['enable-enhanced-instruction-set.cc'], + }, + ], + 'conditions': [ + ['MSVS_VERSION[0:4]>"2010"', { + 'targets': [ + { + 'target_name': 'avx_extensions', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableEnhancedInstructionSet': '3', # AdvancedVectorExtensions + } + }, + 'sources': ['enable-enhanced-instruction-set.cc'], + }, + { + 'target_name': 'no_extensions', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableEnhancedInstructionSet': '4', # NoExtensions + } + }, + 'sources': ['enable-enhanced-instruction-set.cc'], + }, + ], + }], + ['MSVS_VERSION[0:4]>="2013"', { + 'targets': [ + { + 'target_name': 'avx2_extensions', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableEnhancedInstructionSet': '5', # AdvancedVectorExtensions2 + } + }, + 'sources': ['enable-enhanced-instruction-set.cc'], + }, + ], + }], + ], +} diff --git a/third_party/python/gyp/test/win/compiler-flags/exception-handling-on.cc b/third_party/python/gyp/test/win/compiler-flags/exception-handling-on.cc new file mode 100644 index 0000000000..5d9a3af77d --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/exception-handling-on.cc @@ -0,0 +1,24 @@ +// 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. + +#include <excpt.h> +#include <stdlib.h> + +void fail() { + try { + int i = 0, j = 1; + j /= i; + } catch(...) { + exit(1); + } +} + +int main() { + __try { + fail(); + } __except(EXCEPTION_EXECUTE_HANDLER) { + return 2; + } + return 3; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/exception-handling.gyp b/third_party/python/gyp/test/win/compiler-flags/exception-handling.gyp new file mode 100644 index 0000000000..c266768dda --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/exception-handling.gyp @@ -0,0 +1,46 @@ +# 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. + +{ + 'targets': [ + # Optimization disabled so that the exception-causing code is not removed + # (divide by zero was getting optimized away in VS2010). + { + 'target_name': 'test_eh_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'ExceptionHandling': '0', + 'WarnAsError': 'true', + 'Optimization': '0', + } + }, + 'sources': ['exception-handling-on.cc'], + }, + { + 'target_name': 'test_eh_s', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'ExceptionHandling': '1', + 'WarnAsError': 'true', + 'Optimization': '0', + } + }, + 'sources': ['exception-handling-on.cc'], + }, + { + 'target_name': 'test_eh_a', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'ExceptionHandling': '2', + 'WarnAsError': 'true', + 'Optimization': '0', + } + }, + 'sources': ['exception-handling-on.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/floating-point-model-fast.cc b/third_party/python/gyp/test/win/compiler-flags/floating-point-model-fast.cc new file mode 100644 index 0000000000..9d22152f5e --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/floating-point-model-fast.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2014 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. + +#ifdef _M_FP_PRECISE +#error +#endif + +#ifdef _M_FP_STRICT +#error +#endif + +#ifndef _M_FP_FAST +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/floating-point-model-precise.cc b/third_party/python/gyp/test/win/compiler-flags/floating-point-model-precise.cc new file mode 100644 index 0000000000..1191a74ed1 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/floating-point-model-precise.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2014 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. + +#ifndef _M_FP_PRECISE +#error +#endif + +#ifdef _M_FP_STRICT +#error +#endif + +#ifdef _M_FP_FAST +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/floating-point-model-strict.cc b/third_party/python/gyp/test/win/compiler-flags/floating-point-model-strict.cc new file mode 100644 index 0000000000..1ffde36e0c --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/floating-point-model-strict.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2014 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. + +#ifdef _M_FP_PRECISE +#error +#endif + +#ifndef _M_FP_STRICT +#error +#endif + +#ifdef _M_FP_FAST +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/floating-point-model.gyp b/third_party/python/gyp/test/win/compiler-flags/floating-point-model.gyp new file mode 100644 index 0000000000..857b275a8f --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/floating-point-model.gyp @@ -0,0 +1,43 @@ +# Copyright (c) 2014 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. + +{ + 'targets': [ + { + 'target_name': 'test-floating-point-model-default', + 'type': 'executable', + 'sources': ['floating-point-model-precise.cc'], + }, + { + 'target_name': 'test-floating-point-model-precise', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'FloatingPointModel': '0' + } + }, + 'sources': ['floating-point-model-precise.cc'], + }, + { + 'target_name': 'test-floating-point-model-strict', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'FloatingPointModel': '1' + } + }, + 'sources': ['floating-point-model-strict.cc'], + }, + { + 'target_name': 'test-floating-point-model-fast', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'FloatingPointModel': '2' + } + }, + 'sources': ['floating-point-model-fast.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/force-include-files-with-precompiled.cc b/third_party/python/gyp/test/win/compiler-flags/force-include-files-with-precompiled.cc new file mode 100644 index 0000000000..85cb0f32a6 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/force-include-files-with-precompiled.cc @@ -0,0 +1,10 @@ +// 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. + +#include <stdio.h> + +int main() { + std::string s; + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/force-include-files.cc b/third_party/python/gyp/test/win/compiler-flags/force-include-files.cc new file mode 100644 index 0000000000..4a93de55d4 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/force-include-files.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. + +int main() { + std::list<std::vector<std::string> > l; + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/force-include-files.gyp b/third_party/python/gyp/test/win/compiler-flags/force-include-files.gyp new file mode 100644 index 0000000000..2031546cc5 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/force-include-files.gyp @@ -0,0 +1,36 @@ +# Copyright (c) 2010 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. + +{ + 'targets': [ + { + 'target_name': 'test_force_include_files', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'ForcedIncludeFiles': ['string', 'vector', 'list'], + }, + }, + 'sources': [ + 'force-include-files.cc', + ], + }, + { + 'target_name': 'test_force_include_with_precompiled', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'ForcedIncludeFiles': ['string'], + }, + }, + 'msvs_precompiled_header': 'stdio.h', + 'msvs_precompiled_source': 'precomp.cc', + 'msvs_disabled_warnings': [ 4530, ], + 'sources': [ + 'force-include-files-with-precompiled.cc', + 'precomp.cc', + ], + }, + ], +} diff --git a/third_party/python/gyp/test/win/compiler-flags/function-level-linking.cc b/third_party/python/gyp/test/win/compiler-flags/function-level-linking.cc new file mode 100644 index 0000000000..4952272817 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/function-level-linking.cc @@ -0,0 +1,11 @@ +// 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. + +int comdat_function() { + return 1; +} + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/function-level-linking.gyp b/third_party/python/gyp/test/win/compiler-flags/function-level-linking.gyp new file mode 100644 index 0000000000..5858586a24 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/function-level-linking.gyp @@ -0,0 +1,28 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_fll_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableFunctionLevelLinking': 'false' + } + }, + 'sources': ['function-level-linking.cc'], + }, + { + 'target_name': 'test_fll_on', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableFunctionLevelLinking': 'true', + } + }, + 'sources': ['function-level-linking.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/hello.cc b/third_party/python/gyp/test/win/compiler-flags/hello.cc new file mode 100644 index 0000000000..1711567ef5 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/hello.cc @@ -0,0 +1,7 @@ +// 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. + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/optimizations.gyp b/third_party/python/gyp/test/win/compiler-flags/optimizations.gyp new file mode 100644 index 0000000000..e63096f0f7 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/optimizations.gyp @@ -0,0 +1,207 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_opt_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '0' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_lev_size', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '1' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_lev_speed', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '2' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_lev_max', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '3' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_unset', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_fpo', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'OmitFramePointers': 'true' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_fpo_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'OmitFramePointers': 'false' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_intrinsic', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableIntrinsicFunctions': 'true' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_intrinsic_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableIntrinsicFunctions': 'false' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_inline_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'InlineFunctionExpansion': '0' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_inline_manual', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'InlineFunctionExpansion': '1' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_inline_auto', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'InlineFunctionExpansion': '2' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_neither', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'FavorSizeOrSpeed': '0' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_speed', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'FavorSizeOrSpeed': '1' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_size', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'FavorSizeOrSpeed': '2' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_wpo', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WholeProgramOptimization': 'true' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_sp', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'StringPooling': 'true' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_sp_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'StringPooling': 'false' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_fso', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableFiberSafeOptimizations': 'true' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_fso_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableFiberSafeOptimizations': 'false' + } + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/pdbname-override.gyp b/third_party/python/gyp/test/win/compiler-flags/pdbname-override.gyp new file mode 100644 index 0000000000..dad20e01fd --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/pdbname-override.gyp @@ -0,0 +1,26 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_pdbname', + 'type': 'executable', + 'sources': [ + 'hello.cc', + 'pdbname.cc', + ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3', + 'ProgramDataBaseFileName': '<(PRODUCT_DIR)/compiler_generated.pdb', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + 'ProgramDatabaseFile': '<(PRODUCT_DIR)/linker_generated.pdb', + }, + }, + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/pdbname.cc b/third_party/python/gyp/test/win/compiler-flags/pdbname.cc new file mode 100644 index 0000000000..0fe05d5afb --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/pdbname.cc @@ -0,0 +1,7 @@ +// 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. + +int some_function() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/pdbname.gyp b/third_party/python/gyp/test/win/compiler-flags/pdbname.gyp new file mode 100644 index 0000000000..8fcf754727 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/pdbname.gyp @@ -0,0 +1,24 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_pdbname', + 'type': 'executable', + 'sources': [ + 'hello.cc', + 'pdbname.cc', + ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/precomp.cc b/third_party/python/gyp/test/win/compiler-flags/precomp.cc new file mode 100644 index 0000000000..d16bac890f --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/precomp.cc @@ -0,0 +1,6 @@ +// Copyright 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. + +#include <windows.h> +#include <stdio.h> diff --git a/third_party/python/gyp/test/win/compiler-flags/rtti-on.cc b/third_party/python/gyp/test/win/compiler-flags/rtti-on.cc new file mode 100644 index 0000000000..2d3ad03ae4 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/rtti-on.cc @@ -0,0 +1,11 @@ +// 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. + +#ifndef _CPPRTTI +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/rtti.gyp b/third_party/python/gyp/test/win/compiler-flags/rtti.gyp new file mode 100644 index 0000000000..704cd58f5a --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/rtti.gyp @@ -0,0 +1,37 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_rtti_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeTypeInfo': 'false', + 'WarnAsError': 'true' + } + }, + 'sources': ['rtti-on.cc'], + }, + { + 'target_name': 'test_rtti_on', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeTypeInfo': 'true', + 'WarnAsError': 'true' + } + }, + 'sources': ['rtti-on.cc'], + }, + { + 'target_name': 'test_rtti_unset', + 'type': 'executable', + 'msvs_settings': { + }, + 'sources': ['rtti-on.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/runtime-checks.cc b/third_party/python/gyp/test/win/compiler-flags/runtime-checks.cc new file mode 100644 index 0000000000..fdb811da87 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/runtime-checks.cc @@ -0,0 +1,11 @@ +// 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. + +#ifndef __MSVC_RUNTIME_CHECKS +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/runtime-checks.gyp b/third_party/python/gyp/test/win/compiler-flags/runtime-checks.gyp new file mode 100644 index 0000000000..8ea3092057 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/runtime-checks.gyp @@ -0,0 +1,29 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_brc_none', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '0', + } + }, + 'sources': ['runtime-checks.cc'], + }, + { + 'target_name': 'test_brc_1', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '0', + 'BasicRuntimeChecks': '3' + } + }, + 'sources': ['runtime-checks.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/runtime-library-md.cc b/third_party/python/gyp/test/win/compiler-flags/runtime-library-md.cc new file mode 100644 index 0000000000..87c83021d4 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/runtime-library-md.cc @@ -0,0 +1,19 @@ +// 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. + +#ifndef _MT +#error +#endif + +#ifdef _DEBUG +#error +#endif + +#ifndef _DLL +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/runtime-library-mdd.cc b/third_party/python/gyp/test/win/compiler-flags/runtime-library-mdd.cc new file mode 100644 index 0000000000..9f175e493e --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/runtime-library-mdd.cc @@ -0,0 +1,19 @@ +// 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. + +#ifndef _MT +#error +#endif + +#ifndef _DEBUG +#error +#endif + +#ifndef _DLL +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/runtime-library-mt.cc b/third_party/python/gyp/test/win/compiler-flags/runtime-library-mt.cc new file mode 100644 index 0000000000..27e62b63db --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/runtime-library-mt.cc @@ -0,0 +1,19 @@ +// 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. + +#ifndef _MT +#error +#endif + +#ifdef _DEBUG +#error +#endif + +#ifdef _DLL +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/runtime-library-mtd.cc b/third_party/python/gyp/test/win/compiler-flags/runtime-library-mtd.cc new file mode 100644 index 0000000000..a9921db9e2 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/runtime-library-mtd.cc @@ -0,0 +1,19 @@ +// 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. + +#ifndef _MT +#error +#endif + +#ifndef _DEBUG +#error +#endif + +#ifdef _DLL +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/runtime-library.gyp b/third_party/python/gyp/test/win/compiler-flags/runtime-library.gyp new file mode 100644 index 0000000000..04afc391c7 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/runtime-library.gyp @@ -0,0 +1,48 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_rl_md', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': '2' + } + }, + 'sources': ['runtime-library-md.cc'], + }, + { + 'target_name': 'test_rl_mdd', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': '3' + } + }, + 'sources': ['runtime-library-mdd.cc'], + }, + { + 'target_name': 'test_rl_mt', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': '0' + } + }, + 'sources': ['runtime-library-mt.cc'], + }, + { + 'target_name': 'test_rl_mtd', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': '1' + } + }, + 'sources': ['runtime-library-mtd.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/spectre-mitigation.gyp b/third_party/python/gyp/test/win/compiler-flags/spectre-mitigation.gyp new file mode 100644 index 0000000000..dad9cbd2c9 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/spectre-mitigation.gyp @@ -0,0 +1,44 @@ +# Copyright (c) 2023 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. + +{ + 'targets': [ + { + 'target_name': 'test_sm_notset', + 'product_name': 'test_sm_notset', + 'type': 'executable', + 'msvs_configuration_attributes': { + 'SpectreMitigation': 'false' + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_sm_spectre', + 'product_name': 'test_sm_spectre', + 'type': 'executable', + 'msvs_configuration_attributes': { + 'SpectreMitigation': 'Spectre' + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_sm_spectre_load', + 'product_name': 'test_sm_spectre_load', + 'type': 'executable', + 'msvs_configuration_attributes': { + 'SpectreMitigation': 'SpectreLoad' + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_sm_spectre_load_cf', + 'product_name': 'test_sm_spectre_load_cf', + 'type': 'executable', + 'msvs_configuration_attributes': { + 'SpectreMitigation': 'SpectreLoadCF' + }, + 'sources': ['hello.cc'], + } + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/subdir/header.h b/third_party/python/gyp/test/win/compiler-flags/subdir/header.h new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/subdir/header.h diff --git a/third_party/python/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type.gyp b/third_party/python/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type.gyp new file mode 100644 index 0000000000..456fe047d0 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type.gyp @@ -0,0 +1,33 @@ +# Copyright (c) 2010 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. + +{ + 'targets': [ + { + 'target_name': 'test_treat_wchar_t_as_built_in_type_negative', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'TreatWChar_tAsBuiltInType': 'false', + }, + }, + 'sources': [ + 'treat-wchar-t-as-built-in-type1.cc', + ], + }, + { + 'target_name': 'test_treat_wchar_t_as_built_in_type_positive', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'TreatWChar_tAsBuiltInType': 'true', + }, + }, + 'sources': [ + 'treat-wchar-t-as-built-in-type2.cc', + ], + }, + + ], +} diff --git a/third_party/python/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type1.cc b/third_party/python/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type1.cc new file mode 100644 index 0000000000..fc1ed0b7ea --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type1.cc @@ -0,0 +1,11 @@ +// 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. + +#ifdef _NATIVE_WCHAR_T_DEFINED +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type2.cc b/third_party/python/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type2.cc new file mode 100644 index 0000000000..28ab94f742 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type2.cc @@ -0,0 +1,11 @@ +// 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. + +#ifndef _NATIVE_WCHAR_T_DEFINED +#error +#endif + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/uninit.cc b/third_party/python/gyp/test/win/compiler-flags/uninit.cc new file mode 100644 index 0000000000..a9d5f5d483 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/uninit.cc @@ -0,0 +1,13 @@ +// 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. + +// Should trigger C6001: using uninitialized memory <variable> for |i|. +int f(bool b) { + int i; + if (b) + i = 0; + return i; +} + +int main() {} diff --git a/third_party/python/gyp/test/win/compiler-flags/warning-as-error.cc b/third_party/python/gyp/test/win/compiler-flags/warning-as-error.cc new file mode 100644 index 0000000000..fd2130aca5 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/warning-as-error.cc @@ -0,0 +1,9 @@ +// 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. + +int main() { + // Cause a warning, even at /W1 + int export; + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/warning-as-error.gyp b/third_party/python/gyp/test/win/compiler-flags/warning-as-error.gyp new file mode 100644 index 0000000000..d71f261141 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/warning-as-error.gyp @@ -0,0 +1,37 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'test_warn_as_error_false', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarnAsError': 'false' + } + }, + 'sources': ['warning-as-error.cc'] + }, + { + 'target_name': 'test_warn_as_error_true', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarnAsError': 'true' + } + }, + 'sources': ['warning-as-error.cc'] + }, + { + 'target_name': 'test_warn_as_error_unset', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + } + }, + 'sources': ['warning-as-error.cc'] + }, + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/warning-level.gyp b/third_party/python/gyp/test/win/compiler-flags/warning-level.gyp new file mode 100644 index 0000000000..2297aa7cac --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/warning-level.gyp @@ -0,0 +1,115 @@ +# 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. + +{ + 'targets': [ + # Level 1 + { + 'target_name': 'test_wl1_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '1', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level1.cc'], + }, + { + 'target_name': 'test_wl1_pass', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '1', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level2.cc'], + }, + + # Level 2 + { + 'target_name': 'test_wl2_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '2', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level2.cc'], + }, + { + 'target_name': 'test_wl2_pass', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '2', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level3.cc'], + }, + + # Level 3 + { + 'target_name': 'test_wl3_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '3', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level3.cc'], + }, + { + 'target_name': 'test_wl3_pass', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '3', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level4.cc'], + }, + + + # Level 4 + { + 'target_name': 'test_wl4_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '4', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level4.cc'], + }, + + # Default level + { + 'target_name': 'test_def_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level1.cc'], + }, + { + 'target_name': 'test_def_pass', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + } + }, + 'sources': ['warning-level2.cc'], + }, + + ] +} diff --git a/third_party/python/gyp/test/win/compiler-flags/warning-level1.cc b/third_party/python/gyp/test/win/compiler-flags/warning-level1.cc new file mode 100644 index 0000000000..119578d694 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/warning-level1.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. + +int main() { + int export; // Cause a level 1 warning (C4237). + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/warning-level2.cc b/third_party/python/gyp/test/win/compiler-flags/warning-level2.cc new file mode 100644 index 0000000000..9a26703180 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/warning-level2.cc @@ -0,0 +1,14 @@ +// 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. + +int f(int x) { + return 0; +} + +int main() { + double x = 10.1; + // Cause a level 2 warning (C4243). + return f(x); + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/warning-level3.cc b/third_party/python/gyp/test/win/compiler-flags/warning-level3.cc new file mode 100644 index 0000000000..e0a9f3cdd9 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/warning-level3.cc @@ -0,0 +1,11 @@ +// 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. + +// Cause a level 3 warning (C4359). +struct __declspec(align(8)) C8 { __int64 i; }; +struct __declspec(align(4)) C4 { C8 m8; }; + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/win/compiler-flags/warning-level4.cc b/third_party/python/gyp/test/win/compiler-flags/warning-level4.cc new file mode 100644 index 0000000000..48a4fb7018 --- /dev/null +++ b/third_party/python/gyp/test/win/compiler-flags/warning-level4.cc @@ -0,0 +1,10 @@ +// 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. + +int main() { + const int i = -1; + // Cause a level 4 warning (C4245). + unsigned int j = i; + return 0; +} |