adb: tag fatal, fatal_errno with printf attribute.
Also, fix bugs that this uncovered. In particular, the sysdeps_win32
FATAL macro would only print __FUNCTION__.
Change-Id: I6307ec9749edec21b4fee192e135a86ec445c84b
diff --git a/adb/sysdeps_win32.cpp b/adb/sysdeps_win32.cpp
index 0a2a8f6..c3889b6 100644
--- a/adb/sysdeps_win32.cpp
+++ b/adb/sysdeps_win32.cpp
@@ -88,7 +88,10 @@
_fh_socket_hook
};
-#define assert(cond) do { if (!(cond)) fatal( "assertion failed '%s' on %s:%ld\n", #cond, __FILE__, __LINE__ ); } while (0)
+#define assert(cond) \
+ do { \
+ if (!(cond)) fatal("assertion failed '%s' on %s:%d\n", #cond, __FILE__, __LINE__); \
+ } while (0)
std::string SystemErrorCodeToString(const DWORD error_code) {
const int kErrorMessageBufferSize = 256;
@@ -1589,7 +1592,7 @@
/**************************************************************************/
/**************************************************************************/
-#define FATAL(x...) fatal(__FUNCTION__, x)
+#define FATAL(fmt, ...) fatal("%s: " fmt, __FUNCTION__, ##__VA_ARGS__)
#if DEBUG
static void dump_fde(fdevent *fde, const char *info)