* pa.h (CPP_SPEC): Add whitespace after -D__STDC_EXT__.
[official-gcc.git] / gcc / libgcc1-test.c
blob67c7639deeac60a5b90f5b693abf5d9d9e3cd1d8
1 /* This small function uses all the arithmetic operators that
2 libgcc1.c can handle. If you can link it, then
3 you have provided replacements for all the libgcc1.c functions that
4 your target machine needs. */
6 #include <stddef.h>
8 int foo ();
9 double dfoo ();
10 void discard (int);
11 void ddiscard (double);
13 /* We don't want __main here because that can drag in atexit (among other
14 things) which won't necessarily exist yet. */
16 int
17 main_without__main ()
19 int a = foo (), b = foo ();
20 unsigned int au = foo (), bu = foo ();
21 float af = dfoo (), bf = dfoo ();
22 double ad = dfoo (), bd = dfoo ();
24 discard (a * b);
25 discard (a / b);
26 discard (a % b);
28 discard (au / bu);
29 discard (au % bu);
31 discard (a >> b);
32 discard (a << b);
34 discard (au >> bu);
35 discard (au << bu);
37 ddiscard (ad + bd);
38 ddiscard (ad - bd);
39 ddiscard (ad * bd);
40 ddiscard (ad / bd);
41 ddiscard (-ad);
43 ddiscard (af + bf);
44 ddiscard (af - bf);
45 ddiscard (af * bf);
46 ddiscard (af / bf);
47 ddiscard (-af);
49 discard ((int) ad);
50 discard ((int) af);
52 ddiscard ((double) a);
53 ddiscard ((float) a);
54 ddiscard ((float) ad);
56 discard (ad == bd);
57 discard (ad < bd);
58 discard (ad > bd);
59 discard (ad != bd);
60 discard (ad <= bd);
61 discard (ad >= bd);
63 discard (af == bf);
64 discard (af < bf);
65 discard (af > bf);
66 discard (af != bf);
67 discard (af <= bf);
68 discard (af >= bf);
70 return 0;
73 void
74 discard (x)
75 int x __attribute__((__unused__));
78 void
79 ddiscard (x)
80 double x __attribute__((__unused__));
83 int
84 foo ()
86 static int table[] = {20, 69, 4, 12};
87 static int idx;
89 return table[idx++];
92 double
93 dfoo ()
95 static double table[] = {20.4, 69.96, 4.4, 202.202};
96 static int idx;
98 return table[idx++];
101 /* Provide functions that some versions of the linker use to default
102 the start address if -e symbol is not used, to avoid the warning
103 message saying the start address is defaulted. */
104 extern void start() __asm__("start");
105 extern void _start() __asm__("_start");
106 extern void __start() __asm__("__start");
108 /* Provide functions that might be needed by soft-float emulation routines. */
109 void *memcpy(void *to,
110 const void *from __attribute__((__unused__)),
111 size_t len __attribute__((__unused__)))
113 return to;
116 void start() {}
117 void _start() {}
118 void __start() {}
119 void mainCRTStartup() {}