Skip to content

Commit 337cad1

Browse files
feat: add vcore_debug function
This does the same as core_debug, but (like printf vs vprintf) accepts an already processed va_list to allow other vararg functions to forward their argument lists to this function.
1 parent 30d2e59 commit 337cad1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

cores/arduino/core_debug.c

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
// Ensure inline functions have a definition emitted for when they are
44
// not inlined (needed for C functions only)
55
extern void core_debug(const char *format, ...);
6+
extern void vcore_debug(const char *format, va_list args);

cores/arduino/core_debug.h

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#ifndef _CORE_DEBUG_H
22
#define _CORE_DEBUG_H
3+
4+
#include <stdarg.h>
35
#if !defined(NDEBUG)
46
#include <stdio.h>
5-
#include <stdarg.h>
67
#endif /* NDEBUG */
78

89
#ifdef __cplusplus
@@ -28,6 +29,16 @@ inline void core_debug(const char *format, ...)
2829
#endif /* NDEBUG */
2930
}
3031

32+
inline void vcore_debug(const char *format, va_list args)
33+
{
34+
#if !defined(NDEBUG)
35+
vfprintf(stderr, format, args);
36+
#else
37+
(void)(format);
38+
(void)(args);
39+
#endif /* NDEBUG */
40+
}
41+
3142
#ifdef __cplusplus
3243
}
3344
#endif

0 commit comments

Comments
 (0)