7#ifndef ZEPHYR_INCLUDE_SYS_CBPRINTF_CXX_H_
8#define ZEPHYR_INCLUDE_SYS_CBPRINTF_CXX_H_
12static inline int z_cbprintf_cxx_is_pchar(
char *,
bool const_as_fixed)
14 ARG_UNUSED(const_as_fixed);
18static inline int z_cbprintf_cxx_is_pchar(
const char *,
bool const_as_fixed)
20 return const_as_fixed ? 0 : 1;
23static inline int z_cbprintf_cxx_is_pchar(
volatile char *,
bool const_as_fixed)
25 ARG_UNUSED(const_as_fixed);
29static inline int z_cbprintf_cxx_is_pchar(
const volatile char *,
bool const_as_fixed)
31 ARG_UNUSED(const_as_fixed);
35static inline int z_cbprintf_cxx_is_pchar(
unsigned char *,
bool const_as_fixed)
37 ARG_UNUSED(const_as_fixed);
41static inline int z_cbprintf_cxx_is_pchar(
const unsigned char *,
bool const_as_fixed)
43 return const_as_fixed ? 0 : 1;
46static inline int z_cbprintf_cxx_is_pchar(
volatile unsigned char *,
bool const_as_fixed)
48 ARG_UNUSED(const_as_fixed);
52static inline int z_cbprintf_cxx_is_pchar(
const volatile unsigned char *,
bool const_as_fixed)
54 ARG_UNUSED(const_as_fixed);
57static inline int z_cbprintf_cxx_is_pchar(
wchar_t *,
bool const_as_fixed)
59 ARG_UNUSED(const_as_fixed);
63static inline int z_cbprintf_cxx_is_pchar(
const wchar_t *,
bool const_as_fixed)
65 return const_as_fixed ? 0 : 1;
68static inline int z_cbprintf_cxx_is_pchar(
volatile wchar_t *,
bool const_as_fixed)
70 ARG_UNUSED(const_as_fixed);
74static inline int z_cbprintf_cxx_is_pchar(
const volatile wchar_t *,
bool const_as_fixed)
76 ARG_UNUSED(const_as_fixed);
80template <
typename T >
81static inline int z_cbprintf_cxx_is_pchar(T arg,
bool const_as_fixed)
84 _Pragma(
"GCC diagnostic push")
85 _Pragma("GCC diagnostic ignored \"-Wpointer-arith\"")
86 ARG_UNUSED(const_as_fixed);
88 _Pragma("GCC diagnostic pop")
92static inline
int z_cbprintf_cxx_is_word_num(
char)
97static inline int z_cbprintf_cxx_is_word_num(
unsigned char)
102static inline int z_cbprintf_cxx_is_word_num(
short)
107static inline int z_cbprintf_cxx_is_word_num(
unsigned short)
112static inline int z_cbprintf_cxx_is_word_num(
int)
117static inline int z_cbprintf_cxx_is_word_num(
unsigned int)
122static inline int z_cbprintf_cxx_is_word_num(
long)
124 return (
sizeof(
long) <=
sizeof(
uint32_t)) ? 1 : 0;
127static inline int z_cbprintf_cxx_is_word_num(
unsigned long)
129 return (
sizeof(
long) <=
sizeof(
uint32_t)) ? 1 : 0;
132template <
typename T >
133static inline int z_cbprintf_cxx_is_word_num(T arg)
136 _Pragma(
"GCC diagnostic push")
137 _Pragma("GCC diagnostic ignored \"-Wpointer-arith\"")
139 _Pragma("GCC diagnostic pop")
143static inline
int z_cbprintf_cxx_is_none_char_ptr(
char)
148static inline int z_cbprintf_cxx_is_none_char_ptr(
unsigned char)
153static inline int z_cbprintf_cxx_is_none_char_ptr(
short)
158static inline int z_cbprintf_cxx_is_none_char_ptr(
unsigned short)
163static inline int z_cbprintf_cxx_is_none_char_ptr(
int)
168static inline int z_cbprintf_cxx_is_none_char_ptr(
unsigned int)
173static inline int z_cbprintf_cxx_is_none_char_ptr(
long)
178static inline int z_cbprintf_cxx_is_none_char_ptr(
unsigned long)
183static inline int z_cbprintf_cxx_is_none_char_ptr(
long long)
188static inline int z_cbprintf_cxx_is_none_char_ptr(
unsigned long long)
193static inline int z_cbprintf_cxx_is_none_char_ptr(
float)
198static inline int z_cbprintf_cxx_is_none_char_ptr(
double)
203static inline int z_cbprintf_cxx_is_none_char_ptr(
char *)
208static inline int z_cbprintf_cxx_is_none_char_ptr(
volatile char *)
213static inline int z_cbprintf_cxx_is_none_char_ptr(
const char *)
218static inline int z_cbprintf_cxx_is_none_char_ptr(
const volatile char *)
223static inline int z_cbprintf_cxx_is_none_char_ptr(
unsigned char *)
228static inline int z_cbprintf_cxx_is_none_char_ptr(
volatile unsigned char *)
233static inline int z_cbprintf_cxx_is_none_char_ptr(
const unsigned char *)
238static inline int z_cbprintf_cxx_is_none_char_ptr(
const volatile unsigned char *)
243template <
typename T >
244static inline int z_cbprintf_cxx_is_none_char_ptr(T arg)
252static inline size_t z_cbprintf_cxx_arg_size(
float f)
256 return sizeof(double);
259template <
typename T >
260static inline size_t z_cbprintf_cxx_arg_size(T arg)
264 return MAX(
sizeof(T),
sizeof(
int));
268static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
float arg)
270 double d = (double)arg;
273 z_cbprintf_wcpy((
int *)dst, (
int *)p,
sizeof(
d) /
sizeof(
int));
276static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
void *p)
278 z_cbprintf_wcpy((
int *)dst, (
int *)&p,
sizeof(p) /
sizeof(
int));
281static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
char arg)
285 z_cbprintf_wcpy((
int *)dst, &tmp, 1);
288static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
unsigned char arg)
292 z_cbprintf_wcpy((
int *)dst, &tmp, 1);
295static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
signed char arg)
299 z_cbprintf_wcpy((
int *)dst, &tmp, 1);
302static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
short arg)
306 z_cbprintf_wcpy((
int *)dst, &tmp, 1);
309static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
unsigned short arg)
313 z_cbprintf_wcpy((
int *)dst, &tmp, 1);
316template <
typename T >
317static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst, T arg)
319 size_t wlen = z_cbprintf_cxx_arg_size(arg) /
sizeof(int);
322 z_cbprintf_wcpy((
int *)dst, (
int *)p, wlen);
326static inline int z_cbprintf_cxx_is_longdouble(
long double arg)
332template <
typename T >
333static inline int z_cbprintf_cxx_is_longdouble(T arg)
341static inline size_t z_cbprintf_cxx_alignment(
float arg)
348static inline size_t z_cbprintf_cxx_alignment(
double arg)
355static inline size_t z_cbprintf_cxx_alignment(
long double arg)
362static inline size_t z_cbprintf_cxx_alignment(
long long arg)
369static inline size_t z_cbprintf_cxx_alignment(
unsigned long long arg)
376template <
typename T >
377static inline size_t z_cbprintf_cxx_alignment(T arg)
383template <
typename T1,
typename T2 >
384struct z_cbprintf_cxx_is_same_type {
390template <
typename T >
391struct z_cbprintf_cxx_is_same_type < T, T > {
397template <
typename T >
398struct z_cbprintf_cxx_remove_reference {
402template <
typename T >
403struct z_cbprintf_cxx_remove_reference < T & > {
407#if __cplusplus >= 201103L
408template <
typename T >
409struct z_cbprintf_cxx_remove_reference < T && > {
414template <
typename T >
415struct z_cbprintf_cxx_remove_cv {
419template <
typename T >
420struct z_cbprintf_cxx_remove_cv < const T > {
424template <
typename T >
425struct z_cbprintf_cxx_remove_cv < volatile T > {
429template <
typename T >
430struct z_cbprintf_cxx_remove_cv < const volatile T > {
435template <
typename T >
436struct z_cbprintf_cxx_is_array {
442template <
typename T >
443struct z_cbprintf_cxx_is_array < T[] > {
449template <
typename T,
size_t N >
450struct z_cbprintf_cxx_is_array < T[N] > {
457template <
typename T >
458struct z_cbprintf_cxx_remove_extent {
462template <
typename T >
463struct z_cbprintf_cxx_remove_extent < T[] > {
467template <
typename T,
size_t N >
468struct z_cbprintf_cxx_remove_extent < T[N] > {
irp nz macro MOVR cc d
Definition asm-macro-32-bit-gnu.h:11
#define VA_STACK_MIN_ALIGN
Definition cbprintf_internal.h:48
#define VA_STACK_ALIGN(type)
Definition cbprintf_internal.h:52
#define MAX(a, b)
Obtain the maximum of two values.
Definition util.h:386
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88