summaryrefslogtreecommitdiff
path: root/src/common/compat.h
diff options
context:
space:
mode:
authordana koch <dsk@google.com>2013-06-13 22:04:01 +1000
committerNick Mathewson <nickm@torproject.org>2013-06-14 10:52:00 -0400
commit7f67becf307e383eeda94dc4a7dbf5629436ef8c (patch)
tree6ab04215985de8e0e0465f9ca5bda693c1904519 /src/common/compat.h
parent6f5a720d151e8d43d0e76221dee842bc159af710 (diff)
downloadtor-7f67becf307e383eeda94dc4a7dbf5629436ef8c.tar.gz
tor-7f67becf307e383eeda94dc4a7dbf5629436ef8c.zip
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.
Diffstat (limited to 'src/common/compat.h')
-rw-r--r--src/common/compat.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/common/compat.h b/src/common/compat.h
index 8ab7190526..258fc99020 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -84,13 +84,19 @@
/* ===== Compiler compatibility */
-/* GCC can check printf types on arbitrary functions. */
+/* GCC can check printf and scanf types on arbitrary functions. */
#ifdef __GNUC__
#define CHECK_PRINTF(formatIdx, firstArg) \
__attribute__ ((format(printf, formatIdx, firstArg)))
#else
#define CHECK_PRINTF(formatIdx, firstArg)
#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. */
#ifdef _WIN32