xref: /illumos-gate/usr/src/test/util-tests/tests/ctf/test-function.c (revision a92282e44f968185a6bba094d1e5fece2da819cf)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright (c) 2019, Joyent, Inc.
14  */
15 
16 #include <sys/types.h>
17 #include <string.h>
18 
19 /*
20  * Test various function and function pointer cases.
21  */
22 
23 void
24 simple_func(void)
25 {
26 }
27 
28 void
29 one(int v)
30 {
31 }
32 
33 void
34 two(int v, const char *a)
35 {
36 }
37 
38 void
39 three(int v, const char *a, float b)
40 {
41 }
42 
43 const char *
44 noarg(void)
45 {
46 	return ("hello, world");
47 }
48 
49 const char *
50 argument(uintptr_t base)
51 {
52 	return ((const char *)(base + 1));
53 }
54 
55 void
56 vararg(const char *foo, ...)
57 {
58 
59 }
60 
61 uintptr_t
62 vararg_ret(const char *foo, ...)
63 {
64 	return ((uintptr_t)foo);
65 }
66 
67 typedef int (*strfunc_t)(const char *, const char *);
68 typedef void (*vararg_t)(const char *, ...);
69 
70 strfunc_t s = strcmp;
71 vararg_t v = vararg;
72