mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Instead of testing for __GNUC__, use CHECK_SCANF, like CHECK_PRINTF.
This lets us have the possibility of fine-tuning the check in the tor_sscanf test cases at a later date.
This commit is contained in:
parent
6f5a720d15
commit
7f67becf30
@ -84,13 +84,19 @@
|
|||||||
|
|
||||||
/* ===== Compiler compatibility */
|
/* ===== Compiler compatibility */
|
||||||
|
|
||||||
/* GCC can check printf types on arbitrary functions. */
|
/* GCC can check printf and scanf types on arbitrary functions. */
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define CHECK_PRINTF(formatIdx, firstArg) \
|
#define CHECK_PRINTF(formatIdx, firstArg) \
|
||||||
__attribute__ ((format(printf, formatIdx, firstArg)))
|
__attribute__ ((format(printf, formatIdx, firstArg)))
|
||||||
#else
|
#else
|
||||||
#define CHECK_PRINTF(formatIdx, firstArg)
|
#define CHECK_PRINTF(formatIdx, firstArg)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define CHECK_SCANF(formatIdx, firstArg) \
|
||||||
|
__attribute__ ((format(scanf, formatIdx, firstArg)))
|
||||||
|
#else
|
||||||
|
#define CHECK_SCANF(formatIdx, firstArg)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* inline is __inline on windows. */
|
/* inline is __inline on windows. */
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -233,16 +233,10 @@ const char *escaped(const char *string);
|
|||||||
char *tor_escape_str_for_socks_arg(const char *string);
|
char *tor_escape_str_for_socks_arg(const char *string);
|
||||||
|
|
||||||
struct smartlist_t;
|
struct smartlist_t;
|
||||||
int tor_vsscanf(const char *buf, const char *pattern, va_list ap)
|
int tor_vsscanf(const char *buf, const char *pattern, va_list ap) \
|
||||||
#ifdef __GNUC__
|
CHECK_SCANF(2, 0);
|
||||||
__attribute__((format(scanf, 2, 0)))
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
int tor_sscanf(const char *buf, const char *pattern, ...)
|
int tor_sscanf(const char *buf, const char *pattern, ...)
|
||||||
#ifdef __GNUC__
|
CHECK_SCANF(2, 3);
|
||||||
__attribute__((format(scanf, 2, 3)))
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
void smartlist_add_asprintf(struct smartlist_t *sl, const char *pattern, ...)
|
void smartlist_add_asprintf(struct smartlist_t *sl, const char *pattern, ...)
|
||||||
CHECK_PRINTF(2, 3);
|
CHECK_PRINTF(2, 3);
|
||||||
|
Loading…
Reference in New Issue
Block a user