From 7c35ea6ba10967b120abfdb0e9c8543ea4a4df3d Mon Sep 17 00:00:00 2001 From: Joel Armstrong Date: Thu, 24 May 2018 16:37:11 -0700 Subject: [PATCH] Fix use of bool in va_start causing undefined behavior The version of clang included in Apple LLVM 9.1.0 complains about passing the bool parameter `is_error` to va_start, which causes make to fail: fdbrpc/TLSConnection.actor.cpp:370:16: error: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Werror,-Wvarargs] va_start( ap, is_error ); ^ This just switches is_error back to the type it gets promoted to (int). --- fdbrpc/ITLSPlugin.h | 2 +- fdbrpc/TLSConnection.actor.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fdbrpc/ITLSPlugin.h b/fdbrpc/ITLSPlugin.h index cb656db85e..5bc87a7158 100644 --- a/fdbrpc/ITLSPlugin.h +++ b/fdbrpc/ITLSPlugin.h @@ -131,7 +131,7 @@ struct ITLSPolicy { // remaining arguments must be pairs of (const char*); the first of // each pair must be a valid XML attribute name, and the second a // valid XML attribute value. The final parameter must be NULL. -typedef void(*ITLSLogFunc)(const char* event, void* uid, bool is_error, ...); +typedef void(*ITLSLogFunc)(const char* event, void* uid, int is_error, ...); struct ITLSPlugin { virtual void addref() = 0; diff --git a/fdbrpc/TLSConnection.actor.cpp b/fdbrpc/TLSConnection.actor.cpp index 3c09128101..087d6ce641 100644 --- a/fdbrpc/TLSConnection.actor.cpp +++ b/fdbrpc/TLSConnection.actor.cpp @@ -347,7 +347,7 @@ Reference TLSOptions::get_policy(PolicyType type) { return policy; } -static void TLSConnectionLogFunc( const char* event, void* uid_ptr, bool is_error, ... ) { +static void TLSConnectionLogFunc( const char* event, void* uid_ptr, int is_error, ... ) { UID uid; if ( uid_ptr )