open62541 1.4.15
Open source implementation of OPC UA
Loading...
Searching...
No Matches
mp_printf.h
Go to the documentation of this file.
1
2
3#ifndef MP_PRINTF_H
4#define MP_PRINTF_H
5
6#include <stdarg.h>
7#include <stddef.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#ifdef __GNUC__
14# if ((__GNUC__ == 4 && __GNUC_MINOR__>= 4) || __GNUC__ > 4)
15# define ATTR_PRINTF(one_based_format_index, first_arg) \
16__attribute__((format(gnu_printf, (one_based_format_index), (first_arg))))
17# else
18# define ATTR_PRINTF(one_based_format_index, first_arg) \
19__attribute__((format(printf, (one_based_format_index), (first_arg))))
20# endif
21# define ATTR_VPRINTF(one_based_format_index) ATTR_PRINTF((one_based_format_index), 0)
22#else
23# define ATTR_PRINTF(one_based_format_index, first_arg)
24# define ATTR_VPRINTF(one_based_format_index)
25#endif
26
27
28int mp_snprintf(char* s, size_t count, const char* format, ...) ATTR_PRINTF(3, 4);
29int mp_vsnprintf(char* s, size_t count, const char* format, va_list arg) ATTR_VPRINTF(3);
30
31#ifdef __cplusplus
32} // extern "C"
33#endif
34
35#endif // MP_PRINTF_H
#define ATTR_VPRINTF(one_based_format_index)
Definition mp_printf.h:24
int mp_vsnprintf(char *s, size_t count, const char *format, va_list arg)
int mp_snprintf(char *s, size_t count, const char *format,...)
#define ATTR_PRINTF(one_based_format_index, first_arg)
Definition mp_printf.h:23