Skip to content

Commit 2960949

Browse files
committed
rtl-const: add const to rtl-array prototypes
1 parent 7712fdf commit 2960949

File tree

2 files changed

+64
-64
lines changed

2 files changed

+64
-64
lines changed

src/compiler/rtl-array.bas

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
/' function fb_ArrayRedimEx cdecl _
1414
( _
1515
array() as any, _
16-
byval elementlen as uinteger, _
17-
byval doclear as long, _
18-
byval isvarlen as long, _
19-
byval dimensions as uinteger, _
16+
byval elementlen as const uinteger, _
17+
byval doclear as const long, _
18+
byval isvarlen as const long, _
19+
byval dimensions as const uinteger, _
2020
... _
2121
) as long '/ _
2222
( _
@@ -26,20 +26,20 @@
2626
6, _
2727
{ _
2828
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
29-
( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ), _
30-
( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
31-
( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
32-
( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ), _
33-
( FB_DATATYPE_INVALID, FB_PARAMMODE_VARARG, FALSE ) _
29+
( typeSetIsConst( FB_DATATYPE_UINT ), FB_PARAMMODE_BYVAL, FALSE ), _
30+
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ), _
31+
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ), _
32+
( typeSetIsConst( FB_DATATYPE_UINT ), FB_PARAMMODE_BYVAL, FALSE ), _
33+
( typeSetIsConst( FB_DATATYPE_INVALID ), FB_PARAMMODE_VARARG, FALSE ) _
3434
} _
3535
), _
3636
/' function fb_ArrayRedimPresvEx cdecl _
3737
( _
3838
array() as any, _
39-
byval elementlen as uinteger, _
40-
byval doclear as long, _
41-
byval isvarlen as long, _
42-
byval dimensions as uinteger, _
39+
byval elementlen as const uinteger, _
40+
byval doclear as const long, _
41+
byval isvarlen as const long, _
42+
byval dimensions as const uinteger, _
4343
... _
4444
) as integer '/ _
4545
( _
@@ -49,20 +49,20 @@
4949
6, _
5050
{ _
5151
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
52-
( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ), _
53-
( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
54-
( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
55-
( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ), _
56-
( FB_DATATYPE_INVALID, FB_PARAMMODE_VARARG, FALSE ) _
52+
( typeSetIsConst( FB_DATATYPE_UINT ), FB_PARAMMODE_BYVAL, FALSE ), _
53+
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ), _
54+
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ), _
55+
( typeSetIsConst( FB_DATATYPE_UINT ), FB_PARAMMODE_BYVAL, FALSE ), _
56+
( typeSetIsConst( FB_DATATYPE_INVALID ), FB_PARAMMODE_VARARG, FALSE ) _
5757
} _
5858
), _
5959
/' function fb_ArrayRedimObj cdecl _
6060
( _
6161
array() as any, _
62-
byval elementlen as uinteger, _
62+
byval elementlen as const uinteger, _
6363
byval ctor as sub cdecl( byval this_ as any ptr), _
6464
byval dtor as sub cdecl( byval this_ as any ptr), _
65-
byval dimensions as uinteger, _
65+
byval dimensions as const uinteger, _
6666
... _
6767
) as long '/ _
6868
( _
@@ -72,20 +72,20 @@
7272
6, _
7373
{ _
7474
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
75-
( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ), _
75+
( typeSetIsConst( FB_DATATYPE_UINT ), FB_PARAMMODE_BYVAL, FALSE ), _
7676
( typeAddrOf( FB_DATATYPE_VOID ), FB_PARAMMODE_BYVAL, FALSE ), _
7777
( typeAddrOf( FB_DATATYPE_VOID ), FB_PARAMMODE_BYVAL, FALSE ), _
78-
( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ), _
78+
( typeSetIsConst( FB_DATATYPE_UINT ), FB_PARAMMODE_BYVAL, FALSE ), _
7979
( FB_DATATYPE_INVALID, FB_PARAMMODE_VARARG, FALSE ) _
8080
} _
8181
), _
8282
/' function fb_ArrayRedimPresvObj cdecl _
8383
( _
8484
array() as any, _
85-
byval elementlen as uinteger, _
85+
byval elementlen as const uinteger, _
8686
byval ctor as sub cdecl( ), _
8787
byval dtor as sub cdecl( ), _
88-
byval dimensions as uinteger, _
88+
byval dimensions as const uinteger, _
8989
... _
9090
) as long '/ _
9191
( _
@@ -95,18 +95,18 @@
9595
6, _
9696
{ _
9797
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
98-
( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ), _
98+
( typeSetIsConst( FB_DATATYPE_UINT ), FB_PARAMMODE_BYVAL, FALSE ), _
9999
( typeAddrOf( FB_DATATYPE_VOID ), FB_PARAMMODE_BYVAL, FALSE ), _
100100
( typeAddrOf( FB_DATATYPE_VOID ), FB_PARAMMODE_BYVAL, FALSE ), _
101-
( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ), _
101+
( typeSetIsConst( FB_DATATYPE_UINT ), FB_PARAMMODE_BYVAL, FALSE ), _
102102
( FB_DATATYPE_INVALID, FB_PARAMMODE_VARARG, FALSE ) _
103103
} _
104104
), _
105105
/' function fb_ArrayRedimTo _
106106
( _
107107
dest() as any, _
108108
source() as any, _
109-
byval isvarlen as long, _
109+
byval isvarlen as const long, _
110110
byval ctor as sub cdecl( byval this_ as any ptr), _
111111
byval dtor as sub cdecl( byval this_ as any ptr) _
112112
) as long '/ _
@@ -118,7 +118,7 @@
118118
{ _
119119
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
120120
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
121-
( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
121+
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ), _
122122
( typeAddrOf( FB_DATATYPE_VOID ), FB_PARAMMODE_BYVAL, FALSE ), _
123123
( typeAddrOf( FB_DATATYPE_VOID ), FB_PARAMMODE_BYVAL, FALSE ) _
124124
} _
@@ -144,23 +144,23 @@
144144
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ) _
145145
} _
146146
), _
147-
/' function fb_ArrayClear( array() as any, byval isvarlen as long ) as long '/ _
147+
/' function fb_ArrayClear( array() as any, byval isvarlen as const long ) as long '/ _
148148
( _
149149
@FB_RTL_ARRAYCLEAR, NULL, _
150150
FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
151151
NULL, FB_RTL_OPT_NONE, _
152152
2, _
153153
{ _
154154
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
155-
( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
155+
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ) _
156156
} _
157157
), _
158158
/' function fb_ArrayClearObj _
159159
( _
160160
array() as any, _
161161
byval ctor as sub cdecl( ), _
162162
byval dtor as sub cdecl( ), _
163-
byval dofill as long _
163+
byval dofill as const long _
164164
) as long '/ _
165165
( _
166166
@FB_RTL_ARRAYCLEAROBJ, NULL, _
@@ -171,18 +171,18 @@
171171
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
172172
( typeAddrOf( FB_DATATYPE_VOID ), FB_PARAMMODE_BYVAL, FALSE ), _
173173
( typeAddrOf( FB_DATATYPE_VOID ), FB_PARAMMODE_BYVAL, FALSE ), _
174-
( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
174+
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ) _
175175
} _
176176
), _
177-
/' function fb_ArrayErase( array() as any, byval isvarlen as long ) as long '/ _
177+
/' function fb_ArrayErase( array() as any, byval isvarlen as const long ) as long '/ _
178178
( _
179179
@FB_RTL_ARRAYERASE, NULL, _
180180
FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
181181
NULL, FB_RTL_OPT_NONE, _
182182
2, _
183183
{ _
184184
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
185-
( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
185+
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ) _
186186
} _
187187
), _
188188
/' function fb_ArrayEraseObj( array() as any, byval dtor as sub cdecl( ) ) as long '/ _
@@ -206,33 +206,33 @@
206206
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ) _
207207
} _
208208
), _
209-
/' function fb_ArrayLBound( array() as any, byval dimension as integer ) as integer '/ _
209+
/' function fb_ArrayLBound( array() as any, byval dimension as const integer ) as integer '/ _
210210
( _
211211
@FB_RTL_ARRAYLBOUND, NULL, _
212212
FB_DATATYPE_INTEGER, FB_FUNCMODE_FBCALL, _
213213
NULL, FB_RTL_OPT_NONE, _
214214
2, _
215215
{ _
216216
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
217-
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ) _
217+
( typeSetIsConst( FB_DATATYPE_INTEGER ), FB_PARAMMODE_BYVAL, FALSE ) _
218218
} _
219219
), _
220-
/' function fb_ArrayUBound( array() as any, byval dimension as integer ) as integer '/ _
220+
/' function fb_ArrayUBound( array() as any, byval dimension as const integer ) as integer '/ _
221221
( _
222222
@FB_RTL_ARRAYUBOUND, NULL, _
223223
FB_DATATYPE_INTEGER, FB_FUNCMODE_FBCALL, _
224224
NULL, FB_RTL_OPT_NONE, _
225225
2, _
226226
{ _
227227
( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
228-
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ) _
228+
( typeSetIsConst( FB_DATATYPE_INTEGER ), FB_PARAMMODE_BYVAL, FALSE ) _
229229
} _
230230
), _
231231
/' function fb_ArraySngBoundChk _
232232
( _
233-
byval idx as uinteger, _
234-
byval ubound as uinteger, _
235-
byval linenum as long, _
233+
byval idx as const uinteger, _
234+
byval ubound as const uinteger, _
235+
byval linenum as const long, _
236236
byval fname as const zstring ptr _
237237
) as any ptr '/ _
238238
( _
@@ -241,18 +241,18 @@
241241
NULL, FB_RTL_OPT_CANBECLONED, _
242242
4, _
243243
{ _
244-
( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ), _
245-
( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ), _
246-
( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
244+
( typeSetIsConst( FB_DATATYPE_UINT ), FB_PARAMMODE_BYVAL, FALSE ), _
245+
( typeSetIsConst( FB_DATATYPE_UINT ), FB_PARAMMODE_BYVAL, FALSE ), _
246+
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ), _
247247
( typeAddrOf( typeSetIsConst( FB_DATATYPE_CHAR ) ), FB_PARAMMODE_BYVAL, FALSE, 0, TRUE ) _
248248
} _
249249
), _
250250
/' function fb_ArrayBoundChk _
251251
( _
252-
byval idx as integer, _
253-
byval lbound as integer, _
254-
byval ubound as integer, _
255-
byval linenum as long, _
252+
byval idx as const integer, _
253+
byval lbound as const integer, _
254+
byval ubound as const integer, _
255+
byval linenum as const long, _
256256
byval fname as const zstring ptr _
257257
) as any ptr '/ _
258258
( _
@@ -261,10 +261,10 @@
261261
NULL, FB_RTL_OPT_CANBECLONED, _
262262
5, _
263263
{ _
264-
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ), _
265-
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ), _
266-
( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ), _
267-
( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
264+
( typeSetIsConst( FB_DATATYPE_INTEGER ), FB_PARAMMODE_BYVAL, FALSE ), _
265+
( typeSetIsConst( FB_DATATYPE_INTEGER ), FB_PARAMMODE_BYVAL, FALSE ), _
266+
( typeSetIsConst( FB_DATATYPE_INTEGER ), FB_PARAMMODE_BYVAL, FALSE ), _
267+
( typeSetIsConst( FB_DATATYPE_LONG ), FB_PARAMMODE_BYVAL, FALSE ), _
268268
( typeAddrOf( typeSetIsConst( FB_DATATYPE_CHAR ) ), FB_PARAMMODE_BYVAL, FALSE, 0, TRUE ) _
269269
} _
270270
), _

tests/warnings/rtl-prototypes.bas

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,31 @@
1111

1212
ID( function fb_ArrayRedimEx )
1313
scope
14-
dim chk as function cdecl ( bydesc as any, byval as uinteger, byval as long, byval as long, byval as uinteger, ... ) as long
14+
dim chk as function cdecl ( bydesc as any, byval as const uinteger, byval as const long, byval as const long, byval as const uinteger, ... ) as long
1515
chk = procptr( fb_ArrayRedimEx )
1616
end scope
1717

1818
ID( function fb_ArrayRedimPresvEx )
1919
scope
20-
dim chk as function cdecl ( bydesc as any, byval as uinteger, byval as long, byval as long, byval as uinteger, ... ) as long
20+
dim chk as function cdecl ( bydesc as any, byval as const uinteger, byval as const long, byval as const long, byval as const uinteger, ... ) as long
2121
chk = procptr( fb_ArrayRedimPresvEx )
2222
end scope
2323

2424
ID( function fb_ArrayRedimObj )
2525
scope
26-
dim chk as function cdecl ( bydesc as any, byval as uinteger, byval as any ptr, byval as any ptr, byval as uinteger, ... ) as long
26+
dim chk as function cdecl ( bydesc as any, byval as const uinteger, byval as any ptr, byval as any ptr, byval as const uinteger, ... ) as long
2727
chk = procptr( fb_ArrayRedimObj )
2828
end scope
2929

3030
ID( function fb_ArrayRedimPresvObj )
3131
scope
32-
dim chk as function cdecl ( bydesc as any, byval as uinteger, byval as any ptr, byval as any ptr, byval as uinteger, ... ) as long
32+
dim chk as function cdecl ( bydesc as any, byval as const uinteger, byval as any ptr, byval as any ptr, byval as const uinteger, ... ) as long
3333
chk = procptr( fb_ArrayRedimPresvObj )
3434
end scope
3535

3636
ID( function fb_ArrayRedimTo )
3737
scope
38-
dim chk as function fbcall ( bydesc as any, bydesc as any, byval as long, byval as any ptr, byval as any ptr ) as long
38+
dim chk as function fbcall ( bydesc as any, bydesc as any, byval as const long, byval as any ptr, byval as any ptr ) as long
3939
chk = procptr( fb_ArrayRedimTo )
4040
end scope
4141

@@ -53,19 +53,19 @@
5353

5454
ID( function fb_ArrayClear )
5555
scope
56-
dim chk as function fbcall ( bydesc as any, byval as long ) as long
56+
dim chk as function fbcall ( bydesc as any, byval as const long ) as long
5757
chk = procptr( fb_ArrayClear )
5858
end scope
5959

6060
ID( function fb_ArrayClearObj )
6161
scope
62-
dim chk as function fbcall ( bydesc as any, byval as any ptr, byval as any ptr, byval as long ) as long
62+
dim chk as function fbcall ( bydesc as any, byval as any ptr, byval as any ptr, byval as const long ) as long
6363
chk = procptr( fb_ArrayClearObj )
6464
end scope
6565

6666
ID( function fb_ArrayErase )
6767
scope
68-
dim chk as function fbcall ( bydesc as any, byval as long ) as long
68+
dim chk as function fbcall ( bydesc as any, byval as const long ) as long
6969
chk = procptr( fb_ArrayErase )
7070
end scope
7171

@@ -83,25 +83,25 @@
8383

8484
ID( function fb_ArrayLBound )
8585
scope
86-
dim chk as function fbcall ( bydesc as any, byval as integer ) as integer
86+
dim chk as function fbcall ( bydesc as any, byval as const integer ) as integer
8787
chk = procptr( fb_ArrayLBound )
8888
end scope
8989

9090
ID( function fb_ArrayUBound )
9191
scope
92-
dim chk as function fbcall ( bydesc as any, byval as integer ) as integer
92+
dim chk as function fbcall ( bydesc as any, byval as const integer ) as integer
9393
chk = procptr( fb_ArrayUBound )
9494
end scope
9595

9696
ID( function fb_ArraySngBoundChk )
9797
scope
98-
dim chk as function fbcall ( byval as uinteger, byval as uinteger, byval as long, byval as const zstring ptr ) as any ptr
98+
dim chk as function fbcall ( byval as const uinteger, byval as const uinteger, byval as const long, byval as const zstring ptr ) as any ptr
9999
chk = procptr( fb_ArraySngBoundChk )
100100
end scope
101101

102102
ID( function fb_ArrayBoundChk )
103103
scope
104-
dim chk as function fbcall ( byval as integer, byval as integer, byval as integer, byval as long, byval as const zstring ptr ) as any ptr
104+
dim chk as function fbcall ( byval as const integer, byval as const integer, byval as const integer, byval as const long, byval as const zstring ptr ) as any ptr
105105
chk = procptr( fb_ArrayBoundChk )
106106
end scope
107107

0 commit comments

Comments
 (0)