mirror of https://github.com/ARMmbed/mbed-os.git
Add format checking to Stream methods
parent
51df320614
commit
814d631c55
|
|
@ -20,6 +20,7 @@
|
||||||
#include "platform/FileLike.h"
|
#include "platform/FileLike.h"
|
||||||
#include "platform/FileHandle.h"
|
#include "platform/FileHandle.h"
|
||||||
#include "platform/NonCopyable.h"
|
#include "platform/NonCopyable.h"
|
||||||
|
#include "mbed_toolchain.h"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
|
|
||||||
|
|
@ -47,10 +48,10 @@ public:
|
||||||
int puts(const char *s);
|
int puts(const char *s);
|
||||||
int getc();
|
int getc();
|
||||||
char *gets(char *s, int size);
|
char *gets(char *s, int size);
|
||||||
int printf(const char *format, ...);
|
int printf(const char *format, ...) MBED_PRINTF_METHOD(1, 2);
|
||||||
int scanf(const char *format, ...);
|
int scanf(const char *format, ...) MBED_SCANF_METHOD(1, 2);
|
||||||
int vprintf(const char *format, std::va_list args);
|
int vprintf(const char *format, std::va_list args) MBED_PRINTF_METHOD(1, 0);
|
||||||
int vscanf(const char *format, std::va_list args);
|
int vscanf(const char *format, std::va_list args) MBED_SCANF_METHOD(1, 0);
|
||||||
|
|
||||||
operator std::FILE *()
|
operator std::FILE *()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -356,7 +356,7 @@
|
||||||
|
|
||||||
#ifndef MBED_PRINTF_METHOD
|
#ifndef MBED_PRINTF_METHOD
|
||||||
#if defined(__GNUC__) || defined(__CC_ARM)
|
#if defined(__GNUC__) || defined(__CC_ARM)
|
||||||
#define MBED_PRINTF_METHOD(format_idx, first_param_idx) __attribute__ ((__format__(__printf__, format_idx+1, first_param_idx+1)))
|
#define MBED_PRINTF_METHOD(format_idx, first_param_idx) __attribute__ ((__format__(__printf__, format_idx+1, first_param_idx == 0 ? 0 : first_param_idx+1)))
|
||||||
#else
|
#else
|
||||||
#define MBED_PRINTF_METHOD(format_idx, first_param_idx)
|
#define MBED_PRINTF_METHOD(format_idx, first_param_idx)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -372,7 +372,7 @@
|
||||||
|
|
||||||
#ifndef MBED_SCANF_METHOD
|
#ifndef MBED_SCANF_METHOD
|
||||||
#if defined(__GNUC__) || defined(__CC_ARM)
|
#if defined(__GNUC__) || defined(__CC_ARM)
|
||||||
#define MBED_SCANF_METHOD(format_idx, first_param_idx) __attribute__ ((__format__(__scanf__, format_idx+1, first_param_idx+1)))
|
#define MBED_SCANF_METHOD(format_idx, first_param_idx) __attribute__ ((__format__(__scanf__, format_idx+1, first_param_idx == 0 ? 0 : first_param_idx+1)))
|
||||||
#else
|
#else
|
||||||
#define MBED_SCANF_METHOD(format_idx, first_param_idx)
|
#define MBED_SCANF_METHOD(format_idx, first_param_idx)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue