File: typedef.c

package info (click to toggle)
sdcc 3.8.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 99,212 kB
  • sloc: ansic: 918,594; cpp: 69,526; makefile: 56,790; sh: 29,616; asm: 12,364; perl: 12,136; yacc: 7,179; lisp: 1,672; python: 812; lex: 773; awk: 495; sed: 89
file content (45 lines) | stat: -rw-r--r-- 636 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#ifdef TEST1
typedef union {
  long l;
  float f;
} floatlong;

char func(char floatlong)
{
  return floatlong;
}
#endif

#ifdef TEST2
typedef union {
  long l;
  float f;
} floatlong;

long func(float x)
{
  typedef union {
    float f2;
    long l2;
    char c[4];
  } floatlong;
  floatlong fl;
  
  fl.f2=x;
  return fl.l2;
}
#endif

/* This is no longer an error in C11, so test with earlier standard. */
/* Unfortunately, GCC seems to accept this regardless. */
#ifdef TEST3_C99
typedef int I;		/* IGNORE */
typedef int I;		/* ERROR(SDCC) */
#endif

#ifdef TEST4
typedef int I;		/* IGNORE */
typedef char I;		/* ERROR */
#endif