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

Commit

Permalink
Mark library functions whose return value depends solely on its argum…
Browse files Browse the repository at this point in the history
…ents ECF_CONST.
  • Loading branch information
ibuclaw committed Feb 12, 2018
1 parent 6e28e5a commit 9c67c18
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
6 changes: 6 additions & 0 deletions gcc/d/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2018-02-11 Iain Buclaw <[email protected]>

* runtime.def (DYNAMIC_CAST, INTERFACE_CAST): Set ECF_CONST.
(ARRAYCAST, AAINX, AAGETRVALUEX): Likewise.
(SWITCH_STRING, SWITCH_USTRING, SWITCH_DSTRING): Likewise.

2018-02-11 Iain Buclaw <[email protected]>

* runtime.def (BEGIN_CATCH): Set ECF_NOTHROW.
Expand Down
17 changes: 9 additions & 8 deletions gcc/d/runtime.def
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ DEF_D_RUNTIME (CALLINTERFACEFINALIZER, "_d_callinterfacefinalizer", RT(VOID),

/* Used for casting to a class or interface. */
DEF_D_RUNTIME (DYNAMIC_CAST, "_d_dynamic_cast", RT(OBJECT),
P2(OBJECT, CLASSINFO), ECF_LEAF)
P2(OBJECT, CLASSINFO), ECF_CONST | ECF_LEAF)
DEF_D_RUNTIME (INTERFACE_CAST, "_d_interface_cast", RT(OBJECT),
P2(OBJECT, CLASSINFO), ECF_LEAF)
P2(OBJECT, CLASSINFO), ECF_CONST | ECF_LEAF)

/* Used when calling new on a pointer. The `i' variant is for when the
initialiser is non-zero. */
Expand Down Expand Up @@ -111,7 +111,7 @@ DEF_D_RUNTIME (ADCMP2, "_adCmp2", RT(INT),
/* Used when casting from one array type to another where the index type
sizes differ. Such as from int[] to short[]. */
DEF_D_RUNTIME (ARRAYCAST, "_d_arraycast", RT(ARRAY_VOID),
P3(SIZE_T, SIZE_T, ARRAY_VOID), ECF_LEAF)
P3(SIZE_T, SIZE_T, ARRAY_VOID), ECF_CONST | ECF_LEAF)

/* Used for (array.length = n) expressions. The `i' variant is for when the
initialiser is non-zero. */
Expand Down Expand Up @@ -179,15 +179,16 @@ DEF_D_RUNTIME (AAEQUAL, "_aaEqual", RT(INT),

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

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

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

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

0 comments on commit 9c67c18

Please sign in to comment.