File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,18 @@ typedef size_t size_t;
7171# define GIT_FORMAT_PRINTF (a ,b ) /* empty */
7272#endif
7373
74- /** Declare that a function's return value must be used. */
74+ /**
75+ * Declare that a function's return value must be used.
76+ *
77+ * Used mostly to guard against potential silent bugs at runtime. This is
78+ * recommended to be added to functions that:
79+ *
80+ * - Allocate / reallocate memory. This prevents memory leaks or errors where
81+ * buffers are expected to have grown to a certain size, but could not be
82+ * resized.
83+ * - Acquire locks. When a lock cannot be acquired, that will almost certainly
84+ * cause a data race / undefined behavior.
85+ */
7586#if defined(__GNUC__ )
7687# define GIT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
7788#else
You can’t perform that action at this time.
0 commit comments