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

Commit 9c67c18

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

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

gcc/d/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2018-02-11 Iain Buclaw <[email protected]>
2+
3+
* runtime.def (DYNAMIC_CAST, INTERFACE_CAST): Set ECF_CONST.
4+
(ARRAYCAST, AAINX, AAGETRVALUEX): Likewise.
5+
(SWITCH_STRING, SWITCH_USTRING, SWITCH_DSTRING): Likewise.
6+
17
2018-02-11 Iain Buclaw <[email protected]>
28

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

gcc/d/runtime.def

Lines changed: 9 additions & 8 deletions
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_CONST | ECF_LEAF)
6868
DEF_D_RUNTIME (INTERFACE_CAST, "_d_interface_cast", RT(OBJECT),
69-
P2(OBJECT, CLASSINFO), ECF_LEAF)
69+
P2(OBJECT, CLASSINFO), ECF_CONST | ECF_LEAF)
7070

7171
/* Used when calling new on a pointer. The `i' variant is for when the
7272
initialiser is non-zero. */
@@ -111,7 +111,7 @@ DEF_D_RUNTIME (ADCMP2, "_adCmp2", RT(INT),
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_CONST | ECF_LEAF)
115115

116116
/* Used for (array.length = n) expressions. The `i' variant is for when the
117117
initialiser is non-zero. */
@@ -179,15 +179,16 @@ DEF_D_RUNTIME (AAEQUAL, "_aaEqual", RT(INT),
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)