OSDN Git Service

PR middle-end/52419
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / dll-10.c
1 /* { dg-do link } */
2 /* { dg-require-dll "" } */
3 /* { dg-additional-sources "dll-10a.c" } */
4 /* { dg-options "-w -O2 -std=gnu99 -fno-keep-inline-dllexport" } */
5 /* { dg-prune-output .*undefined.* } */
6 /* { dg-xfail-if "link failure expected" { *-*-* } } */
7
8 /* Test that inline functions declared "dllexport" appear in object files,
9    even if they are not called - except when -fno-keep-inline-dllexport.
10
11    This behavior is required by the ARM C++ ABI:
12
13      Exporting a function that can be inlined should force the
14      creation and export of an out-of-line copy of it.
15
16    and should presumably also apply.
17
18    Visual Studio 2005 also honors that rule.  */
19
20 __declspec(dllexport) inline void i1() {}
21
22 __declspec(dllexport) extern inline void e1() {}
23
24 /* It is invalid to declare the function inline after its definition.  */
25 #if 0
26 __declspec(dllexport) void i2() {}
27 inline void i2();
28
29 __declspec(dllexport) extern void e2() {}
30 inline void e2();
31 #endif
32
33 __declspec(dllexport) inline void i3() {}
34 void i3();
35
36 __declspec(dllexport) inline void e3() {}
37 extern void e3();
38
39 __declspec(dllexport) void i4();
40 inline void i4() {};
41
42 __declspec(dllexport) extern void e4();
43 inline void e4() {};
44
45 __declspec(dllexport) inline void i5();
46 void i5() {};
47
48 __declspec(dllexport) inline void e5();
49 extern void e5() {};
50
51 /* Make sure that just declaring the function -- without defining it
52    -- does not cause errors.  */
53 __declspec(dllexport) inline void i6();
54 __declspec(dllexport) extern inline void e6();