1 /* Test file for C language.
2 * Attempt to include as many aspects of the C language as possible.
4 * $Id: test.c,v 1.1 2007-11-26 15:12:21 michaels Exp $
7 /* types of include files */
8 #include "includeme1.h"
9 #include <includeme2.h>
10 #include <subdir/includeme3.h>
11 #include <includeme.notanhfile>
14 int dont_show_function()
30 } var_of_type_mystruct2;
36 } var_of_anonymous_struct;
38 typedef struct mystruct1 typedef_of_mystruct1;
39 typedef struct mystruct1 *typedef_of_pointer_mystruct1;
40 typedef struct { int slot_a; } typedef_of_anonymous_struct;
44 typedef struct mystruct1 td1, td2;
56 } var_of_type_myunion2;
62 } var_of_anonymous_union;
64 typedef union myunion1 typedef_of_myunion1;
65 typedef union myunion1 *typedef_of_pointer_myunion1;
66 typedef union { int slot_a; } typedef_of_anonymous_union;
68 enum myenum1 { enum11 = 1, enum12 };
69 enum myenum2 { enum21, enum22 = 2 } var_of_type_myenum2;
70 enum { enum31, enum32 } var_of_anonymous_enum;
72 typedef enum myenum1 typedef_of_myenum1;
73 typedef enum myenum1 *typedef_of_pointer_myenum1;
74 typedef enum { enum_a = 3, enum_b } typedef_of_anonymous_enum;
76 typedef int typedef_of_int;
78 /* Here are some simpler variable types */
84 struct mystruct1 var4;
93 char *varpa1 = "moose";
94 struct mystruct2 vara2 = { 1, 'a', 0.0 };
95 enum myenum1 vara3 = enum11;
97 int vara5 = funcall();
99 int mvar1, mvar2, mvar3;
100 char *mvarp1, *mvarp2, *mvarp3;
101 char *mvarpa1 = 'a', *mvarpa2 = 'b', *mvarpa3 = 'c';
102 char mvaras1[10], mvaras2[12][13], *mvaras3 = 'd';
104 static register const unsigned int tmvar1;
107 #define MACRO2(foo) (1+foo)
109 /* Here are some function prototypes */
111 /* This is legal, but I decided not to support inferred integer
112 * types on functions and variables.
116 char funp2(int arg11);
117 float funp3(char arg21, char arg22);
118 struct mystrct1 funp4(struct mystruct2 arg31, union myunion2 arg32);
119 enum myenum1 funp5(char *arg41, union myunion1 *arg42);
121 char funpp1 __P(char argp1, struct mystruct2 argp2, char *arg4p);
125 /* Here is a function pointer */
126 int (*funcptr)(int a, int b);
128 /* Function Definitions */
130 /* This is legal, but I decided not to support inferred integer
131 * types on functions and variables.
143 char fun2(int arg_11)
148 float fun3(char arg_21, char arg_22)
153 struct mystrct1 fun4(struct mystruct2 arg31, union myunion2 arg32)
158 enum myenum1 fun5(char *arg41, union myunion1 *arg42)
163 /* Functions with K&R syntax. */
164 struct mystrct1 funk1(arg_31, arg_32)
165 struct mystruct2 arg_31;
166 union myunion2 arg32;
171 enum myenum1 *funk2(arg_41, arg_42)
173 union myunion1 *arg_42;
181 int funk3(arg_51, arg_53)
188 enum myenum1 testconst;
190 /* Function argument analysis */
191 funk3(ms1.slot11, arg_53 );
194 /* Slot deref on assignee */
197 /* Enum/const completion */
200 /* Bad var/slot and param */
201 blah.notafunction(moose);
204 int funk4_fixme(arg_61, arg_62)