Fixed a bunch of Clang warnings.
Unfortunately a few of the Clang warnings did not have easy fixes:
../../../../ext/google/protobuf_c/ruby-upb.c: In function ‘fastdecode_err’:
../../../../ext/google/protobuf_c/ruby-upb.c:353:13: warning: function might be candidate for attribute ‘noreturn’ [-Wsuggest-attribute=noreturn]
353 | const char *fastdecode_err(upb_decstate *d) {
| ^~~~~~~~~~~~~~
../../../../ext/google/protobuf_c/ruby-upb.c: In function ‘_upb_decode’:
../../../../ext/google/protobuf_c/ruby-upb.c:867:30: warning: argument ‘buf’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
867 | bool _upb_decode(const char *buf, size_t size, void *msg,
I even tried to suppress the first error, but it still shows up.
diff --git a/upb/json_encode.c b/upb/json_encode.c
index 9217c65..7bdda51 100644
--- a/upb/json_encode.c
+++ b/upb/json_encode.c
@@ -40,6 +40,7 @@
longjmp(e->err, 1);
}
+UPB_PRINTF(2, 3)
UPB_NORETURN static void jsonenc_errf(jsonenc *e, const char *fmt, ...) {
va_list argp;
va_start(argp, fmt);
@@ -72,6 +73,7 @@
jsonenc_putbytes(e, str, strlen(str));
}
+UPB_PRINTF(2, 3)
static void jsonenc_printf(jsonenc *e, const char *fmt, ...) {
size_t n;
size_t have = e->end - e->ptr;
@@ -102,7 +104,7 @@
digits -= 3;
}
- jsonenc_printf(e, ".%0.*" PRId32, digits, nanos);
+ jsonenc_printf(e, ".%.*" PRId32, digits, nanos);
}
static void jsonenc_timestamp(jsonenc *e, const upb_msg *msg,