1 // RUN: %clang_cc1 -triple %ms_abi_triple -fms-extensions -verify -fsyntax-only %s 2 // RUN: %clang_cc1 -triple %ms_abi_triple -fms-extensions -verify -std=c++11 -fsyntax-only -x c++ %s 3 4 // Function definition. testGuardNoCF()5__declspec(guard(nocf)) void testGuardNoCF() { // no warning 6 } 7 8 // Can not be used on variable, parameter, or function pointer declarations. 9 int __declspec(guard(nocf)) i; // expected-warning {{'guard' attribute only applies to functions}} testGuardNoCFFuncParam(double i)10void testGuardNoCFFuncParam(double __declspec(guard(nocf)) i) {} // expected-warning {{'guard' attribute only applies to functions}} 11 __declspec(guard(nocf)) typedef void (*FuncPtrWithGuardNoCF)(void); // expected-warning {{'guard' attribute only applies to functions}} 12 13 // 'guard' Attribute requries an argument. testGuardNoCFParams()14__declspec(guard) void testGuardNoCFParams() { // expected-error {{'guard' attribute takes one argument}} 15 } 16 17 // 'guard' Attribute requries an identifier as argument. testGuardNoCFParamType()18__declspec(guard(1)) void testGuardNoCFParamType() { // expected-error {{'guard' attribute requires an identifier}} 19 } 20 21 // 'guard' Attribute only takes a single argument. testGuardNoCFTooManyParams()22__declspec(guard(nocf, nocf)) void testGuardNoCFTooManyParams() { // expected-error {{use of undeclared identifier 'nocf'}} 23 } 24 25 // 'guard' Attribute argument must be a supported identifier. testGuardNoCFInvalidParam()26__declspec(guard(cf)) void testGuardNoCFInvalidParam() { // expected-warning {{'guard' attribute argument not supported: 'cf'}} 27 } 28