1 /* { dg-message "undeclared identifier is reported only once" "reminder for mmu_base" { target *-*-* } 0 } */
2 typedef BYTE unsigned char; /* { dg-error "expected" } */
3 /* { dg-warning "useless type name in empty declaration" "" { target *-*-* } .-1 } */
4 typedef int item_n;
5 typedef int perm_set;
6 struct PENT { caddr_t v_addr; };/* { dg-error "unknown type name" } */
7 typedef struct PENT prec;
8 typedef struct PENT *prec_t;
9 prec_t mem_hash;
10 BYTE *mem_base; /* { dg-error "unknown type name" } */
11 struct PTE {
12 BYTE *p_page; /* { dg-error "unknown type name" } */
13 perm_set p_perms;
14 };
15 typedef struct PTE pte;
16 struct PTP {
17 union {
18 struct *PTP p_tablep; /* { dg-error "expected" } */
19 struct *PTE p_entry;
20 } u;
21 int valid;
22 };
23 typedef struct PTP (u.p_tablep);/* { dg-error "expected" } */
24 int pfree=0;
25 int pcount=0;
26 int Level1 ();
27 int Level2 ();
28 void enlarge_hash_table ();
29 int fill_item_entry ();
30 int __eprintf ();
31 void build_ptables ();
32
33 void
mmu_walk_find(va)34 mmu_walk_find(va)
35 caddr_t va; /* { dg-error "unknown type name" } */
36 {
37 BYTE *page_addr; /* { dg-error "unknown type name" } */
38 if (mmu_base[Level1(va)]->valid==0x0) { /* { dg-error "undeclared" } */
39 l1_base = mmu_base[Level1(va)]->(u.p_tablep) = p_alloc(); /* { dg-error "expected|undeclared" } */
40 mmu_base[Level1(va)]->valid = 0x3;
41 for (idx=0; idx<LEVEL1_ENTRIES; idx++) /* { dg-error "undeclared" } */
42 l1_base[idx]->valid = 0x0;
43 goto build_level2;
44 } else
45 l1_base = mmu_base[Level1(va)]->(u.p_tablep); /* { dg-error "expected" } */
46
47 if (l1_base[Level2(va)]->valid==0x0) {
48 build_level2:
49 l2_base = l1_base[Level2(va)]->(u.p_tablep) = p_alloc(); /* { dg-error "expected|undeclared" } */
50 l1_base[Level2(va)]->valid = 0x3;
51 for (idx=0; idx<LEVEL2_ENTRIES; idx++) /* { dg-error "undeclared" } */
52 l2_base[idx]->valid=0x0;
53 goto build_page; /* { dg-error "used but not defined" } */
54 } else
55 l2_base = mmu_base[Level2(va)]->(u.p_tablep); /* { dg-error "expected" } */
56
57 page_addr = l2_base[Level2(va)]->valid;
58 }
59
60 void *
a_translate(va_op,v_addr)61 a_translate(va_op, v_addr)
62 int va_op;
63 caddr_t v_addr; /* { dg-error "unknown type name" } */
64 {
65 register prec_t bucket;
66 register caddr_t p_addr; /* { dg-error "unknown type name" } */
67 bucket = mem_hash+((((v_addr)>>ITEMBITS))&hash_mask); /* { dg-error "undeclared" } */
68 do {
69 if (bucket->v_addr == ((v_addr)>>ITEMBITS) { /* { dg-error "expected|undeclared|no member" } */
70 if(!(bucket->perm_set&va_op))
71 goto prot_fault;
72 return mem_base + v_addr;
73 }
74 } while((bucket++)->v_addr != ((caddr_t)0)); /* { dg-error "expected|undeclared|no member" } */
75
76 page_miss:
77 p_addr = (--bucket)->p_addr; /* { dg-error "no member" } */
78 page_type:
79 switch (p_addr) {
80 case BUCKET_FULL: /* { dg-error "undeclared" } */
81 enlarge_hash_table(mem_hash);
82 case((caddr_t)0): /* { dg-error "expected" } */
83 p_addr = fill_item_entry(va_op, v_addr);
84 goto page_type;
85 case((caddr_t)1): /* { dg-error "expected" } */
86 default:
87 ((void)(((0))?0:(__eprintf("Failed assertion`%s'at line%d of`%s'.\n",
88 "FALSE", 327, "b.c"), 0)));
89 }
90 }
91
92 void
93 flush_hash(hasht, hash_size)
94 prec_t hasht;
95 int hash_size;
96 {
97 register prec_t bucket;
98 register int idx;
99 bucket = hasht;
100 for(idx=(hash_size*3)-1; idx>=0; idx--) {
101 bucket->v_addr = ((caddr_t)0);/* { dg-error "undeclared|expected|no member" } */
102 bucket->p_addr = ((caddr_t)0);/* { dg-error "no member|expected" } */
103 bucket->perm_set = VA_EMPTY; /* { dg-error "undeclared|no member" } */
104 }
105 }
106
107 extern void *calloc(__SIZE_TYPE__, __SIZE_TYPE__);
108
109 void
110 init_mem()
111 {
112 mem_base = (BYTE *) calloc(1024, (1<<13)); /* { dg-error "undeclared|expected" } */
113 ((void)((mem_base != (BYTE *)0) /* { dg-error "expected" } */
114 ? 0
115 : (__eprintf("Failed assertion`%s'at line%d of`%s'.\n",
116 "mem_base != (BYTE *)0", 366, "b.c"),
117 0)));
118 hash_num = INIT_NUM_ENTRIES * 3; /* { dg-error "undeclared" } */
119 mem_hash = (prec_t) calloc(hash_num, sizeof(prec));
120 ((void)((mem_hash != (prec_t)0)
121 ? 0
122 : (__eprintf("Failed assertion`%s'at line%d of`%s'.\n",
123 "mem_hash != (prec_t)0", 370, "b.c"),
124 0)));
125 flush_hash(mem_hash, 32);
126 build_ptables(mem_base, 1024*(1<<13)); /* { dg-bogus "integer overflow" "int smaller than 32 bits" { xfail int16 } } */
127 }
128
129 struct tm {
130 int tm_sec; int tm_min; int tm_hour;
131 int tm_mday;int tm_mon; int tm_year;
132 int tm_wday;int tm_yday;int tm_isdst;
133 char*tm_zone; long tm_gmtoff;
134 };
135