]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
ggml : mark ggml_format_name as a printf-like function (#508)
authorCebtenzzre <redacted>
Fri, 8 Sep 2023 14:58:01 +0000 (10:58 -0400)
committerGitHub <redacted>
Fri, 8 Sep 2023 14:58:01 +0000 (17:58 +0300)
include/ggml/ggml.h

index f0d44220f17d365c8995e36c5919a0424f331acc..eff6090eb1f41797cd8fc7835838d953f742b3c8 100644 (file)
 #    define GGML_DEPRECATED(func, hint) func
 #endif
 
+#ifndef __GNUC__
+#    define GGML_ATTRIBUTE_FORMAT(...)
+#elif defined(__MINGW32__)
+#    define GGML_ATTRIBUTE_FORMAT(...) __attribute__((format(gnu_printf, __VA_ARGS__)))
+#else
+#    define GGML_ATTRIBUTE_FORMAT(...) __attribute__((format(printf, __VA_ARGS__)))
+#endif
+
 #include <stdint.h>
 #include <stddef.h>
 #include <stdbool.h>
@@ -685,6 +693,7 @@ extern "C" {
 
     GGML_API const char *         ggml_get_name   (const struct ggml_tensor * tensor);
     GGML_API struct ggml_tensor * ggml_set_name   (      struct ggml_tensor * tensor, const char * name);
+    GGML_ATTRIBUTE_FORMAT(2, 3)
     GGML_API struct ggml_tensor * ggml_format_name(      struct ggml_tensor * tensor, const char * fmt, ...);
 
     //