Warn about changing collections during iteration (#2950)

Resolves #92
This commit is contained in:
mattjala 2023-05-14 22:09:58 -05:00 committed by GitHub
parent 364145f144
commit 17750ea9c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 15 deletions

View File

@ -664,6 +664,9 @@ H5_DLL hid_t H5Aget_type(hid_t attr_id);
*
* \note This function is also available through the H5Aiterate() macro.
*
* \warning Adding or removing attributes to the object during iteration
* will lead to undefined behavior.
*
* \since 1.8.0
*
*/
@ -721,6 +724,9 @@ H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t ord
* information regarding the properties of links required to access
* the object, \p obj_name.
*
* \warning Adding or removing attributes to the object during iteration
* will lead to undefined behavior.
*
* \since 1.8.0
*
*/
@ -1188,6 +1194,9 @@ H5_DLL int H5Aget_num_attrs(hid_t loc_id);
* \p op, is returned in \p idx. If \p idx is the null pointer,
* then all attributes are processed.
*
* \warning Adding or removing attributes to the object during iteration
* will lead to undefined behavior.
*
* \version 1.8.0 The function \p H5Aiterate was renamed to H5Aiterate1()
* and deprecated in this release.
* \since 1.0.0

View File

@ -1286,6 +1286,8 @@ H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset,
* be restarted at the point of exit; a second H5Diterate()
* call will always restart at the beginning.
*
* \warning Modifying the selection of \p space_id during iteration
* will lead to undefined behavior.
*
* \since 1.10.2
*

View File

@ -1002,7 +1002,10 @@ H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *
* examine the members of \c subgroup_a. When recursive iteration is
* required, the application must handle the recursion, explicitly
* calling H5Giterate() on discovered subgroups.
*
* \warning Adding or removing members to the group during iteration
* will lead to undefined behavior.
*
* \version 1.8.0 Function deprecated in this release.
*
*/

View File

@ -588,6 +588,9 @@ H5_DLL void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key);
* to continue, as long as there are other identifiers remaining in
* type.
*
* \warning Adding or removing members of the identifier type during iteration
* will lead to undefined behavior.
*
* \since 1.12.0
*
*/

View File

@ -980,6 +980,12 @@ H5_DLL herr_t H5Literate_async(hid_t group_id, H5_index_t idx_type, H5_iter_orde
* passed in by the application with a starting point and returned by
* the library with the point at which the iteration stopped.
*
* \warning H5Literate_by_name2() assumes that the membership of the group being
* iterated over remains unchanged through the iteration; if any of the
* links in the group change during the iteration, the functions
* behavior is undefined. Note, however, that objects pointed to by the
* links can be modified.
*
* \note H5Literate_by_name2() is not recursive. In particular, if a member of
* \p group_name is found to be a group, call it \c subgroup_a,
* H5Literate_by_name2() does not examine the members of \c subgroup_a.
@ -987,12 +993,6 @@ H5_DLL herr_t H5Literate_async(hid_t group_id, H5_index_t idx_type, H5_iter_orde
* recursion, explicitly calling H5Literate_by_name2() on discovered
* subgroups.
*
* \note H5Literate_by_name2() assumes that the membership of the group being
* iterated over remains unchanged through the iteration; if any of the
* links in the group change during the iteration, the functions
* behavior is undefined. Note, however, that objects pointed to by the
* links can be modified.
*
* \note H5Literate_by_name2() is the same as H5Literate2(), except that
* H5Literate2() always proceeds in alphanumeric order.
*
@ -1670,7 +1670,6 @@ H5_DLL herr_t H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index
* This does not limit the ability to change link destinations
* while iterating, but caution is advised.
*
*
* \version 1.12.0 Function was deprecated in this release.
* \since 1.8.0
*
@ -1727,6 +1726,12 @@ H5_DLL herr_t H5Literate1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t ord
* passed in by the application with a starting point and returned by
* the library with the point at which the iteration stopped.
*
* \warning H5Literate_by_name1() assumes that the membership of the group being
* iterated over remains unchanged through the iteration; if any of the
* links in the group change during the iteration, the functions
* behavior is undefined. Note, however, that objects pointed to by the
* links can be modified.
*
* \note H5Literate_by_name1() is not recursive. In particular, if a member of
* \p group_name is found to be a group, call it \c subgroup_a,
* H5Literate_by_name1() does not examine the members of \c subgroup_a.
@ -1734,12 +1739,6 @@ H5_DLL herr_t H5Literate1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t ord
* recursion, explicitly calling H5Literate_by_name1() on discovered
* subgroups.
*
* \note H5Literate_by_name1() assumes that the membership of the group being
* iterated over remains unchanged through the iteration; if any of the
* links in the group change during the iteration, the functions
* behavior is undefined. Note, however, that objects pointed to by the
* links can be modified.
*
* \note H5Literate_by_name1() is the same as H5Giterate(), except that
* H5Giterate() always proceeds in lexicographic order.
*

View File

@ -542,6 +542,9 @@ H5_DLL herr_t H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hb
*
* Any further options can be specified through the property list \p dxpl_id.
*
* \warning Adding or removing key-value pairs to the map during iteration
* will lead to undefined behavior.
*
* \since 1.12.0
*
*/
@ -583,6 +586,9 @@ H5_DLL herr_t H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_
*
* Any further options can be specified through the property list \p dxpl_id.
*
* \warning Adding or removing key-value pairs to the map during iteration
* will lead to undefined behavior.
*
* \since 1.12.0
*
*/

View File

@ -1459,7 +1459,7 @@ H5_DLL htri_t H5Pisa_class(hid_t plist_id, hid_t pclass_id);
* and the pointer to the operator data passed in to H5Piterate(),
* \p iter_data.
*
* H5Piterate() assumes that the properties in the object
* \warning H5Piterate() assumes that the properties in the object
* identified by \p id remain unchanged through the iteration.
* If the membership changes during the iteration, the function's
* behavior is undefined.