Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Commit 14d376d

Browse files
committed
Mark library functions whose return value depends solely on its arguments ECF_CONST.
1 parent 6e28e5a commit 14d376d

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

Diff for: gcc/d/ChangeLog

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2018-02-11 Iain Buclaw <[email protected]>
2+
3+
* runtime.def (DYNAMIC_CAST, INTERFACE_CAST): Set ECF_CONST.
4+
(ADEQ2, ADCMP2, ARRAYCAST): Likewise.
5+
(AAEQUAL, AAINX, AAGETRVALUEX): Likewise.
6+
(SWITCH_STRING, SWITCH_USTRING, SWITCH_DSTRING): Likewise.
7+
18
2018-02-11 Iain Buclaw <[email protected]>
29

310
* runtime.def (BEGIN_CATCH): Set ECF_NOTHROW.

Diff for: gcc/d/runtime.def

+12-11
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ DEF_D_RUNTIME (CALLINTERFACEFINALIZER, "_d_callinterfacefinalizer", RT(VOID),
6464

6565
/* Used for casting to a class or interface. */
6666
DEF_D_RUNTIME (DYNAMIC_CAST, "_d_dynamic_cast", RT(OBJECT),
67-
P2(OBJECT, CLASSINFO), ECF_LEAF)
67+
P2(OBJECT, CLASSINFO), ECF_LEAF | ECF_CONST)
6868
DEF_D_RUNTIME (INTERFACE_CAST, "_d_interface_cast", RT(OBJECT),
69-
P2(OBJECT, CLASSINFO), ECF_LEAF)
69+
P2(OBJECT, CLASSINFO), ECF_LEAF | ECF_CONST)
7070

7171
/* Used when calling new on a pointer. The `i' variant is for when the
7272
initialiser is non-zero. */
@@ -104,14 +104,14 @@ DEF_D_RUNTIME (DELARRAYT, "_d_delarray_t", RT(VOID),
104104
/* Used for value equality (x == y) and comparisons (x < y) of non-trivial
105105
arrays. Such as an array of structs or classes. */
106106
DEF_D_RUNTIME (ADEQ2, "_adEq2", RT(INT),
107-
P3(ARRAY_VOID, ARRAY_VOID, CONST_TYPEINFO), 0)
107+
P3(ARRAY_VOID, ARRAY_VOID, CONST_TYPEINFO), ECF_CONST)
108108
DEF_D_RUNTIME (ADCMP2, "_adCmp2", RT(INT),
109-
P3(ARRAY_VOID, ARRAY_VOID, CONST_TYPEINFO), 0)
109+
P3(ARRAY_VOID, ARRAY_VOID, CONST_TYPEINFO), ECF_CONST)
110110

111111
/* Used when casting from one array type to another where the index type
112112
sizes differ. Such as from int[] to short[]. */
113113
DEF_D_RUNTIME (ARRAYCAST, "_d_arraycast", RT(ARRAY_VOID),
114-
P3(SIZE_T, SIZE_T, ARRAY_VOID), ECF_LEAF)
114+
P3(SIZE_T, SIZE_T, ARRAY_VOID), ECF_LEAF | ECF_CONST)
115115

116116
/* Used for (array.length = n) expressions. The `i' variant is for when the
117117
initialiser is non-zero. */
@@ -175,19 +175,20 @@ DEF_D_RUNTIME (ASSOCARRAYLITERALTX, "_d_assocarrayliteralTX", RT(VOIDPTR),
175175

176176
/* Used for value equality of two associative arrays. */
177177
DEF_D_RUNTIME (AAEQUAL, "_aaEqual", RT(INT),
178-
P3(CONST_TYPEINFO, ASSOCARRAY, ASSOCARRAY), 0)
178+
P3(CONST_TYPEINFO, ASSOCARRAY, ASSOCARRAY), ECF_CONST)
179179

180180
/* Used to determine is a key exists in an associative array. */
181181
DEF_D_RUNTIME (AAINX, "_aaInX", RT(VOIDPTR),
182-
P3(ASSOCARRAY, CONST_TYPEINFO, VOIDPTR), ECF_LEAF)
182+
P3(ASSOCARRAY, CONST_TYPEINFO, VOIDPTR), ECF_CONST | ECF_LEAF)
183183

184184
/* Used to retrieve a value from an associative array index by a key. The
185185
`Rvalue' variant returns null if the key is not found, where as aaGetY
186186
will create new key entry for assignment. */
187187
DEF_D_RUNTIME (AAGETY, "_aaGetY", RT(VOIDPTR),
188188
P4(POINTER_ASSOCARRAY, CONST_TYPEINFO, SIZE_T, VOIDPTR), 0)
189189
DEF_D_RUNTIME (AAGETRVALUEX, "_aaGetRvalueX", RT(VOIDPTR),
190-
P4(ASSOCARRAY, CONST_TYPEINFO, SIZE_T, VOIDPTR), ECF_LEAF)
190+
P4(ASSOCARRAY, CONST_TYPEINFO, SIZE_T, VOIDPTR),
191+
ECF_CONST | ECF_LEAF)
191192

192193
/* Used when calling delete on a key entry in an associative array. */
193194
DEF_D_RUNTIME (AADELX, "_aaDelX", RT(BOOL),
@@ -211,11 +212,11 @@ DEF_D_RUNTIME (INVARIANT, "_D9invariant12_d_invariantFC6ObjectZv", RT(VOID),
211212
/* Used when performing a switch/cases on a string. The `u' and `d' variants
212213
are for UTF-16 and UTF-32 strings respectively. */
213214
DEF_D_RUNTIME (SWITCH_STRING, "_d_switch_string", RT(INT),
214-
P2(ARRAY_STRING, STRING), ECF_LEAF)
215+
P2(ARRAY_STRING, STRING), ECF_CONST | ECF_LEAF)
215216
DEF_D_RUNTIME (SWITCH_USTRING, "_d_switch_ustring", RT(INT),
216-
P2(ARRAY_WSTRING, WSTRING), ECF_LEAF)
217+
P2(ARRAY_WSTRING, WSTRING), ECF_CONST | ECF_LEAF)
217218
DEF_D_RUNTIME (SWITCH_DSTRING, "_d_switch_dstring", RT(INT),
218-
P2(ARRAY_DSTRING, DSTRING), ECF_LEAF)
219+
P2(ARRAY_DSTRING, DSTRING), ECF_CONST | ECF_LEAF)
219220

220221
/* Used when throwing an error that a switch statement has no default case,
221222
and yet none of the existing cases matched. */

0 commit comments

Comments
 (0)