File: calling-conv-complete-params.c

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (53 lines) | stat: -rw-r--r-- 1,965 bytes parent folder | download | duplicates (23)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// RUN: %clang_cc1 -fsyntax-only -fms-extensions -verify -triple i686-pc-win32 %s
// RUN: %clang_cc1 -fsyntax-only -fms-extensions -verify -triple x86_64-pc-win32 %s
// RUN: %clang_cc1 -x c++ -fsyntax-only -fms-extensions -verify -triple i686-pc-win32 %s
// RUN: %clang_cc1 -x c++ -DEXTERN_C='extern "C"' -fsyntax-only -fms-extensions -verify -triple i686-pc-win32 %s

#ifndef EXTERN_C
#define EXTERN_C
#if defined(__cplusplus)
#define EXPECT_NODIAG
// expected-no-diagnostics
#endif
#endif

#ifndef EXPECT_NODIAG
// expected-note-re@+2 1+ {{forward declaration of '{{(struct )?}}Foo'}}
#endif
struct Foo;

EXTERN_C void __stdcall fwd_std(struct Foo p);
#if !defined(EXPECT_NODIAG) && defined(_M_IX86)
// expected-error@+2 {{parameter 'p' must have a complete type to use function 'fwd_std' with the stdcall calling convention}}
#endif
void (__stdcall *fp_fwd_std)(struct Foo) = &fwd_std;

EXTERN_C void __fastcall fwd_fast(struct Foo p);
#if !defined(EXPECT_NODIAG) && defined(_M_IX86)
// expected-error@+2 {{parameter 'p' must have a complete type to use function 'fwd_fast' with the fastcall calling convention}}
#endif
void (__fastcall *fp_fwd_fast)(struct Foo) = &fwd_fast;

EXTERN_C void __vectorcall fwd_vector(struct Foo p);
#if !defined(EXPECT_NODIAG)
// expected-error@+2 {{parameter 'p' must have a complete type to use function 'fwd_vector' with the vectorcall calling convention}}
#endif
void (__vectorcall *fp_fwd_vector)(struct Foo) = &fwd_vector;

#if defined(__cplusplus)
template <typename T> struct TemplateWrapper {
#ifndef EXPECT_NODIAG
  // expected-error@+2 {{field has incomplete type 'Foo'}}
#endif
  T field;
};

EXTERN_C void __vectorcall tpl_ok(TemplateWrapper<int> p);
void(__vectorcall *fp_tpl_ok)(TemplateWrapper<int>) = &tpl_ok;

EXTERN_C void __vectorcall tpl_fast(TemplateWrapper<Foo> p);
#ifndef EXPECT_NODIAG
// expected-note@+2 {{requested here}}
#endif
void(__vectorcall *fp_tpl_fast)(TemplateWrapper<Foo>) = &tpl_fast;
#endif