Merge pull request #141 from mrdeep1/coap-log-syntax

Add in GNU compiler checking of parameter syntax for coap_log() functions
This commit is contained in:
obgm authored and GitHub committed 2018-02-26 17:35:10 +01:00
commit b6f6cb274c
2 files changed
+6 -1

No files matched your search

+5
View File
@@ -57,7 +57,12 @@ const char *coap_package_version(void);
* COAP_DEBUG_FD (for @p level >= @c LOG_WARNING). The text is output only when
* @p level is below or equal to the log level that set by coap_set_log_level().
*/
#if (defined(__GNUC__))
void coap_log_impl(coap_log_t level,
const char *format, ...) __attribute__ ((format(printf, 2, 3)));
#else
void coap_log_impl(coap_log_t level, const char *format, ...);
#endif
#ifndef coap_log
#define coap_log(level, ...) do { if ((level)<=coap_get_log_level()) coap_log_impl((level), __VA_ARGS__); } while(0)
+1 -1
View File
@@ -1168,7 +1168,7 @@ coap_run_once(coap_context_t *ctx, unsigned timeout_ms) {
#else
if (errno != EINTR) {
#endif
coap_log(LOG_DEBUG, coap_socket_strerror());
coap_log(LOG_DEBUG, "%s", coap_socket_strerror());
return -1;
}
}