[Bf-blender-cvs] [3fa6aacb91f] blender-v3.4-release: Cleanup: add function attributes to BLI_sprintf

Campbell Barton noreply at git.blender.org
Wed Nov 9 02:33:07 CET 2022


Commit: 3fa6aacb91f4a0d04c1ef3c67449df67696cea6b
Author: Campbell Barton
Date:   Wed Nov 9 12:28:34 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rB3fa6aacb91f4a0d04c1ef3c67449df67696cea6b

Cleanup: add function attributes to BLI_sprintf

Quiet warning, suggesting to use attributes with GCC.

===================================================================

M	source/blender/blenlib/BLI_string.h

===================================================================

diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index fb02ea5fb17..ed15e0871b9 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -206,11 +206,12 @@ char *BLI_sprintfN(const char *__restrict format, ...) ATTR_WARN_UNUSED_RESULT
     ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1, 2);
 
 /**
- * A wrapper around ::sprintf() which does not generate security warnings.
+ * A wrapper around `::sprintf()` which does not generate security warnings.
  *
- * \note Use BLI_snprintf for cases when the string size is known.
+ * \note Use #BLI_snprintf for cases when the string size is known.
  */
-int BLI_sprintf(char *__restrict str, const char *__restrict format, ...);
+int BLI_sprintf(char *__restrict str, const char *__restrict format, ...) ATTR_NONNULL(1, 2)
+    ATTR_PRINTF_FORMAT(2, 3);
 
 /**
  * This roughly matches C and Python's string escaping with double quotes - `"`.



More information about the Bf-blender-cvs mailing list