[CDRIVER-3320] Mark public functions that return a handle that must be freed with BSON_GNUC_WARN_UNUSED_RESULT Created: 14/Aug/19  Updated: 28/Oct/23  Resolved: 30/Aug/21

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: 1.20.0

Type: Improvement Priority: Trivial - P5
Reporter: Kevin Albertson Assignee: Ezra Chung
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Some of our public functions, like mongoc_collection_create_bulk_operation, are marked with the attribute BSON_GNUC_WARN_UNUSED_RESULT, which gives a compiler warning if the caller does not inspect the returned value (which in that case, because they should at the very least destroy the mongoc_bulk_operation_t returned).

Not all functions that return handles that must be cleaned up have this attribute, (e.g. mongoc_collection_watch and possibly others).



 Comments   
Comment by Githook User [ 30/Aug/21 ]

Author:

{'name': 'Ezra Chung', 'email': '88335979+eramongodb@users.noreply.github.com', 'username': 'eramongodb'}

Message: CDRIVER-3320 Add BSON_GNUC_WARN_UNUSED_RESULT to exported functions (#855)
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5258e23f8108262b61ec771da0ef260aa3304540

Generated at Wed Feb 07 21:17:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.