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.
guard(nocf)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 __declspec (guard (nocf))i)10 void 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.
guard(nocf,nocf)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.
guard(cf)26 __declspec(guard(cf)) void testGuardNoCFInvalidParam() { // expected-warning {{'guard' attribute argument not supported: 'cf'}}
27 }
28