This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix various compiler warnings from XS code
[perl5.git] / dist / ExtUtils-ParseXS / t / XSMore.xs
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4
5 =for testing
6
7 This parts are ignored.
8
9 =cut
10
11 STATIC void
12 outlist(int* a, int* b){
13         *a = 'a';
14         *b = 'b';
15 }
16
17 STATIC int
18 len(const char* const s, int const l){
19         PERL_UNUSED_ARG(s);
20         return l;
21 }
22
23 MODULE = XSMore         PACKAGE = XSMore
24
25 =for testing
26
27 This parts are also ignored.
28
29 =cut
30
31 PROTOTYPES: ENABLE
32
33 VERSIONCHECK: DISABLE
34
35 REQUIRE: 2.20
36
37 SCOPE: DISABLE
38
39 FALLBACK: TRUE
40
41 BOOT:
42         sv_setiv(get_sv("XSMore::boot_ok", TRUE), 100);
43
44
45 void
46 prototype_ssa()
47 PROTOTYPE: $$@
48 CODE:
49         NOOP;
50
51 void
52 attr_method(self, ...)
53 ATTRS: method
54 CODE:
55         NOOP;
56
57 #define RET_1 1
58 #define RET_2 2
59
60 int
61 return_1()
62 CASE: ix == 1
63         ALIAS:
64                 return_1 = RET_1
65                 return_2 = RET_2
66         CODE:
67                 RETVAL = ix;
68         OUTPUT:
69                 RETVAL
70 CASE: ix == 2
71         CODE:
72                 RETVAL = ix;
73         OUTPUT:
74                 RETVAL
75
76 int
77 arg_init(x)
78         int x = SvIV($arg);
79 CODE:
80         RETVAL = x;
81 OUTPUT:
82         RETVAL
83
84 int
85 myabs(...)
86 OVERLOAD: abs
87 CODE:
88         PERL_UNUSED_VAR(items);
89         RETVAL = 42;
90 OUTPUT:
91         RETVAL
92
93 void
94 hook(IN AV* av)
95 INIT:
96         av_push(av, newSVpv("INIT", 0));
97 CODE:
98         av_push(av, newSVpv("CODE", 0));
99 POSTCALL:
100         av_push(av, newSVpv("POSTCALL", 0));
101 CLEANUP:
102         av_push(av, newSVpv("CLEANUP", 0));
103
104
105 void
106 outlist(OUTLIST int a, OUTLIST int b)
107
108 int
109 len(char* s, int length(s))
110
111 INCLUDE_COMMAND: $^X -Ilib -It/lib -MIncludeTester -e IncludeTester::print_xs
112
113 #if 1
114
115 INCLUDE: XSInclude.xsh
116
117 #else
118
119 # for testing #else directive
120
121 #endif