xref: /illumos-gate/usr/src/test/util-tests/tests/ctf/test-reference.c (revision 5bb525f494c825f138113d51f2ba7acf185093f3)
1*5bb525f4SRobert Mustacchi /*
2*5bb525f4SRobert Mustacchi  * This file and its contents are supplied under the terms of the
3*5bb525f4SRobert Mustacchi  * Common Development and Distribution License ("CDDL"), version 1.0.
4*5bb525f4SRobert Mustacchi  * You may only use this file in accordance with the terms of version
5*5bb525f4SRobert Mustacchi  * 1.0 of the CDDL.
6*5bb525f4SRobert Mustacchi  *
7*5bb525f4SRobert Mustacchi  * A full copy of the text of the CDDL should have accompanied this
8*5bb525f4SRobert Mustacchi  * source.  A copy of the CDDL is also available via the Internet at
9*5bb525f4SRobert Mustacchi  * http://www.illumos.org/license/CDDL.
10*5bb525f4SRobert Mustacchi  */
11*5bb525f4SRobert Mustacchi 
12*5bb525f4SRobert Mustacchi /*
13*5bb525f4SRobert Mustacchi  * Copyright (c) 2019, Joyent, Inc.
14*5bb525f4SRobert Mustacchi  */
15*5bb525f4SRobert Mustacchi 
16*5bb525f4SRobert Mustacchi /*
17*5bb525f4SRobert Mustacchi  * Test the encoding of references to another type. Specifically the references
18*5bb525f4SRobert Mustacchi  * that we generally care about are things like:
19*5bb525f4SRobert Mustacchi  *
20*5bb525f4SRobert Mustacchi  * o pointers
21*5bb525f4SRobert Mustacchi  * o typedefs
22*5bb525f4SRobert Mustacchi  * o const
23*5bb525f4SRobert Mustacchi  * o volatile
24*5bb525f4SRobert Mustacchi  * o restrict
25*5bb525f4SRobert Mustacchi  */
26*5bb525f4SRobert Mustacchi 
27*5bb525f4SRobert Mustacchi int a;
28*5bb525f4SRobert Mustacchi typedef int test_int_t;
29*5bb525f4SRobert Mustacchi test_int_t aa;
30*5bb525f4SRobert Mustacchi const short b;
31*5bb525f4SRobert Mustacchi volatile float c;
32*5bb525f4SRobert Mustacchi 
33*5bb525f4SRobert Mustacchi int *d;
34*5bb525f4SRobert Mustacchi int **dd;
35*5bb525f4SRobert Mustacchi int ***ddd;
36*5bb525f4SRobert Mustacchi test_int_t *e;
37*5bb525f4SRobert Mustacchi const test_int_t *ce;
38*5bb525f4SRobert Mustacchi volatile test_int_t *ve;
39*5bb525f4SRobert Mustacchi volatile const test_int_t *cve;
40*5bb525f4SRobert Mustacchi int *const *f;
41*5bb525f4SRobert Mustacchi const char *const g;
42*5bb525f4SRobert Mustacchi 
43*5bb525f4SRobert Mustacchi typedef int *const * foo_t;
44*5bb525f4SRobert Mustacchi const volatile foo_t *cvh;
45