gcc/
[official-gcc.git] / gcc / testsuite / gcc.dg / dll-10.c
blob2f0c6ce31a58ac40fb0ae0a831ae54db1c7ced5f
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" { *-*-* } } */
8 /* Test that inline functions declared "dllexport" appear in object files,
9 even if they are not called - except when -fno-keep-inline-dllexport.
11 This behavior is required by the ARM C++ ABI:
13 Exporting a function that can be inlined should force the
14 creation and export of an out-of-line copy of it.
16 and should presumably also apply.
18 Visual Studio 2005 also honors that rule. */
20 __declspec(dllexport) inline void i1() {}
22 __declspec(dllexport) extern inline void e1() {}
24 /* It is invalid to declare the function inline after its definition. */
25 #if 0
26 __declspec(dllexport) void i2() {}
27 inline void i2();
29 __declspec(dllexport) extern void e2() {}
30 inline void e2();
31 #endif
33 __declspec(dllexport) inline void i3() {}
34 void i3();
36 __declspec(dllexport) inline void e3() {}
37 extern void e3();
39 __declspec(dllexport) void i4();
40 inline void i4() {};
42 __declspec(dllexport) extern void e4();
43 inline void e4() {};
45 __declspec(dllexport) inline void i5();
46 void i5() {};
48 __declspec(dllexport) inline void e5();
49 extern void e5() {};
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();