diff options
author | 2016-06-10 11:19:51 -0700 | |
---|---|---|
committer | 2016-06-10 11:19:51 -0700 | |
commit | 64c0e8d4bcf5f6822cdef368ee84074c3ea234c7 (patch) | |
tree | 6f16adc57086737989c9367c59964adabbb1438e /include | |
parent | 1bc2976a0f51e14d3525aecbf4b3450445ed2d1b (diff) |
Add format check for gpr_log and gpr_asprintf
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc/impl/codegen/log.h | 4 | ||||
-rw-r--r-- | include/grpc/support/string_util.h | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/include/grpc/impl/codegen/log.h b/include/grpc/impl/codegen/log.h index aa86fc4c17..9090a34cd5 100644 --- a/include/grpc/impl/codegen/log.h +++ b/include/grpc/impl/codegen/log.h @@ -34,6 +34,7 @@ #ifndef GRPC_IMPL_CODEGEN_LOG_H #define GRPC_IMPL_CODEGEN_LOG_H +#include <inttypes.h> #include <stdarg.h> #include <stdlib.h> /* for abort() */ @@ -74,7 +75,8 @@ const char *gpr_log_severity_string(gpr_log_severity severity); /* Log a message. It's advised to use GPR_xxx above to generate the context * for each message */ GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, - const char *format, ...); + const char *format, ...) + __attribute__((format(printf, 4, 5))); GPRAPI void gpr_log_message(const char *file, int line, gpr_log_severity severity, const char *message); diff --git a/include/grpc/support/string_util.h b/include/grpc/support/string_util.h index f981bc0db0..c68577b626 100644 --- a/include/grpc/support/string_util.h +++ b/include/grpc/support/string_util.h @@ -54,7 +54,8 @@ GPRAPI char *gpr_strdup(const char *src); On error, returns -1 and sets *strp to NULL. If the format string is bad, the result is undefined. */ -GPRAPI int gpr_asprintf(char **strp, const char *format, ...); +GPRAPI int gpr_asprintf(char **strp, const char *format, ...) + __attribute__((format(printf, 2, 3))); #ifdef __cplusplus } |