fix lots of errors calling debug() with incorrect argument patterns.

This commit is contained in:
Mike Brady
2025-12-30 14:59:27 +00:00
parent b5f1157c1c
commit 3aa34cd712
12 changed files with 85 additions and 71 deletions
+12 -6
View File
@@ -51,13 +51,19 @@ EXTERNC void set_show_relative_time(int setting);
EXTERNC int get_show_file_and_line();
EXTERNC void set_show_file_and_line(int setting);
EXTERNC void _die(const char *filename, const int linenumber, const char *format, ...);
EXTERNC void _warn(const char *filename, const int linenumber, const char *format, ...);
EXTERNC void _inform(const char *filename, const int linenumber, const char *format, ...);
EXTERNC void _debug(const char *filename, const int linenumber, int level, const char *format, ...);
EXTERNC void _debug_print_buffer(const char *thefilename, const int linenumber, int level,
void *buf, size_t buf_len);
#if defined(__GNUC__) || defined(__clang__)
#define PRINTF_LIKE(fmt, args) __attribute__((format(printf, fmt, args)))
#else
#define PRINTF_LIKE(fmt, args)
#endif
// Function declarations with printf-style format checking
EXTERNC void _die(const char *filename, const int linenumber, const char *format, ...) PRINTF_LIKE(3,4);
EXTERNC void _warn(const char *filename, const int linenumber, const char *format, ...) PRINTF_LIKE(3,4);
EXTERNC void _inform(const char *filename, const int linenumber, const char *format, ...) PRINTF_LIKE(3,4);
EXTERNC void _debug(const char *filename, const int linenumber, int level, const char *format, ...) PRINTF_LIKE(4,5);
EXTERNC void _debug_print_buffer(const char *thefilename, const int linenumber, int level, void *buf,
size_t buf_len); // not printf-style, no change needed
#define die(...) _die(__FILE__, __LINE__, __VA_ARGS__)
#define debug(...) _debug(__FILE__, __LINE__, __VA_ARGS__)
#define warn(...) _warn(__FILE__, __LINE__, __VA_ARGS__)
+1 -1
View File
@@ -38,7 +38,7 @@ int eintr_checked_accept(int sockfd, struct sockaddr *addr,
char errorstring[1024];
strerror_r(errno, (char *)errorstring, sizeof(errorstring));
debug(1,
"error %d accept()ing a socketin ap2_event_receiver %d: \"%s\". Error %d is ignored.",
"error %d accept()ing a socketin ap2_event_receiver: \"%s\". (Note: error %d will be ignored.)",
errno, errorstring, EINTR);
}