[gflags] Use void (*)() for ValidateFnProto Change ValidateFnProto from bool (*)() to void (*)(). In C++, bool (*)() is a function taking zero arguments, which triggers -Wcast-function-type-mismatch when casting to and from 2-argument validator function pointers. void (*)() is treated as a generic function pointer by Clang and GCC, allowing opaque storage without compiler warnings. Bug: 330769701 Change-Id: I38c4f710b83bcd98dcac147433f68602a33d8e70 Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/gflags/+/1788820 Reviewed-by: Francois Rousseau <frousseau@google.com>
diff --git a/src/gflags.cc b/src/gflags.cc index 921b4f9..bbd6cc8 100644 --- a/src/gflags.cc +++ b/src/gflags.cc
@@ -164,7 +164,7 @@ // ValidateFn(uint64). However, for easier storage, we strip off this // argument and then restore it when actually calling the function on // a flag value. -typedef bool (*ValidateFnProto)(); +typedef void (*ValidateFnProto)(); // Whether we should die when reporting an error. enum DieWhenReporting { DIE, DO_NOT_DIE };