[FL-2870] Printf function attributes (#1841)

* Furi strings: printf attribute
* Logs: printf attribute
* Plugins: adapt
* Plugins: accommodate
* Unit tests: accommodate

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Sergey Gavrilov
2022-10-07 23:35:15 +10:00
committed by GitHub
parent 1f742b611a
commit 4000f0cac5
78 changed files with 187 additions and 156 deletions

View File

@@ -34,6 +34,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
@@ -54,7 +55,7 @@ void _putchar(char character);
* \param format A string that specifies the format of the output
* \return The number of characters that are written into the array, not counting the terminating null character
*/
int printf_(const char* format, ...);
int printf_(const char* format, ...) _ATTRIBUTE((__format__(__printf__, 1, 2)));
/**
* Tiny sprintf implementation
@@ -63,7 +64,7 @@ int printf_(const char* format, ...);
* \param format A string that specifies the format of the output
* \return The number of characters that are WRITTEN into the buffer, not counting the terminating null character
*/
int sprintf_(char* buffer, const char* format, ...);
int sprintf_(char* buffer, const char* format, ...) _ATTRIBUTE((__format__(__printf__, 2, 3)));
/**
* Tiny snprintf/vsnprintf implementation
@@ -75,7 +76,8 @@ int sprintf_(char* buffer, const char* format, ...);
* null character. A value equal or larger than count indicates truncation. Only when the returned value
* is non-negative and less than count, the string has been completely written.
*/
int snprintf_(char* buffer, size_t count, const char* format, ...);
int snprintf_(char* buffer, size_t count, const char* format, ...)
_ATTRIBUTE((__format__(__printf__, 3, 4)));
int vsnprintf_(char* buffer, size_t count, const char* format, va_list va);
/**
@@ -94,7 +96,8 @@ int vprintf_(const char* format, va_list va);
* \param format A string that specifies the format of the output
* \return The number of characters that are sent to the output function, not counting the terminating null character
*/
int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...);
int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...)
_ATTRIBUTE((__format__(__printf__, 3, 4)));
#ifdef __cplusplus
}