summaryrefslogtreecommitdiff
path: root/bcc/patch.file
blob: 20a3174ffbce881019da2a4d82d365c950b2efb0 (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
diff -u5 -r bcc~/declare.c bcc/declare.c
--- bcc~/declare.c	Fri Dec 17 17:51:13 1999
+++ bcc/declare.c	Thu Jun  6 13:27:00 2002
@@ -410,16 +410,17 @@
 }
 
 PRIVATE bool_pt declspec()
 {
     unsigned nsc;
+    unsigned nsigned;
     unsigned ntype;
     unsigned nunsigned;
 
     gvarsc = NULLDECL;
     gvartype = itype;
-    nunsigned = ntype = nsc = 0;
+    nsigned = nunsigned = ntype = nsc = 0;
     while (TRUE)
     {
 	switch (sym)
 	{
 	case AUTODECL:
@@ -482,29 +483,37 @@
 		goto break2;
 	    ++ntype;
 	    gvartype = gsymptr->type;
 	    nextsym();
 	    break;
+	case SIGNDECL:
+	    ++nsigned;
+	    nextsym();
+	    break;
 	case UNSIGNDECL:
 	    ++nunsigned;
 	    nextsym();
 	    break;
 	default:
 	    goto break2;
 	}
     }
+
 break2:
+    if (nsigned > 0)
+    {
+	if (ntype++ == 0)
+	    gvartype = itype;
+	else
+	    gvartype = tosigned(gvartype);
+    }
     if (nunsigned > 0)
     {
-	if (ntype == 0)
-	{
+	if (ntype++ == 0)
 	    gvartype = uitype;
-	    ntype = 1;
-	}
-	gvartype = tounsigned(gvartype);
-	if (nunsigned > 1)
-	    ntype = 2;
+	else
+	    gvartype = tounsigned(gvartype);
     }
     if (nsc > 0)
     {
 	if (ntype == 0)
 	    ntype = 1;
diff -u5 -r bcc~/proto.h bcc/proto.h
--- bcc~/proto.h	Sun Jan 11 12:18:36 1998
+++ bcc/proto.h	Thu Jun  6 00:46:24 2002
@@ -360,8 +360,8 @@
 void outntypechar P((struct typestruct *type));
 struct typestruct *pointype P((struct typestruct *type));
 struct typestruct *prefix P((constr_pt constructor, uoffset_T size,
 			     struct typestruct *type));
 struct typestruct *promote P((struct typestruct *type));
+struct typestruct *tosigned P((struct typestruct *type));
 struct typestruct *tounsigned P((struct typestruct *type));
 void typeinit P((void));
-
diff -u5 -r bcc~/scan.h bcc/scan.h
--- bcc~/scan.h	Sat Jul 24 14:27:42 1999
+++ bcc/scan.h	Thu Jun  6 00:32:20 2002
@@ -134,10 +134,11 @@
 
 #define LASTOP PTRSUBOP
 
     ENUMDECL,
     NULLDECL,
+    SIGNDECL,
     STRUCTDECL,
     TYPEDECL,
     TYPEDEFNAME,
     UNIONDECL,
     UNSIGNDECL,
diff -u5 -r bcc~/table.c bcc/table.c
--- bcc~/table.c	Sun Sep 28 09:57:30 1997
+++ bcc/table.c	Thu Jun  6 00:29:36 2002
@@ -28,11 +28,11 @@
 #define MAXEXPR 125
 #else
 #define MAXEXPR 500
 #endif
 #define MAXLOCAL 100
-#define NKEYWORDS 35
+#define NKEYWORDS 36
 #ifdef NOFLOAT
 #define NSCALTYPES 10
 #else
 #define NSCALTYPES 12
 #endif
@@ -88,11 +88,12 @@
 PRIVATE struct keywordstruct keywords[NKEYWORDS] =
 {
     { "enum", ENUMDECL, },
     { "struct", STRUCTDECL, },
     { "union", UNIONDECL, },
     { "unsigned", UNSIGNDECL, },
+    { "signed", SIGNDECL, },
 
     { "auto", AUTODECL, },
     { "extern", EXTERNDECL, },
     { "register", REGDECL, },
     { "static", STATICDECL, },
diff -u5 -r bcc~/type.c bcc/type.c
--- bcc~/type.c	Sun Jan 11 12:18:37 1998
+++ bcc/type.c	Thu Jun  6 00:49:06 2002
@@ -155,10 +155,29 @@
     if (type->constructor & FUNCTION)
 	return pointype(type);
     return type;
 }
 
+PUBLIC struct typestruct *tosigned(type)
+struct typestruct *type;
+{
+    switch (type->scalar & ~(UNSIGNED | DLONG))
+    {
+    case CHAR:
+	return sctype;
+    case SHORT:
+	return stype;
+    case INT:
+	return itype;
+    case LONG:
+	return ltype;
+    default:
+	error("signed only applies to integral types");
+	return type;
+    }
+}
+
 PUBLIC struct typestruct *tounsigned(type)
 struct typestruct *type;
 {
     switch (type->scalar & ~(UNSIGNED | DLONG))
     {