mirror of https://github.com/nirenjan/pinelog.git
Add check for __attribute__((format))
parent
091dd29d3b
commit
490a2e3faa
|
@ -6,6 +6,9 @@
|
|||
/* Define to 1 if the system has the `constructor' function attribute */
|
||||
#undef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR
|
||||
|
||||
/* Define to 1 if the system has the `format' function attribute */
|
||||
#undef HAVE_FUNC_ATTRIBUTE_FORMAT
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ LT_INIT
|
|||
PKG_PROG_PKG_CONFIG
|
||||
PKG_INSTALLDIR
|
||||
AX_COMPILER_FLAGS
|
||||
AX_GCC_FUNC_ATTRIBUTE(constructor)
|
||||
AX_GCC_FUNC_ATTRIBUTE([constructor])
|
||||
AX_GCC_FUNC_ATTRIBUTE([format])
|
||||
|
||||
AC_SUBST([PINELOG_CFLAGS])
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef PINELOG_DEFAULT_LEVEL
|
||||
#define PINELOG_DEFAULT_LEVEL LOG_LVL_ERROR
|
||||
#define PINELOG_DEFAULT_LEVEL PINELOG_LVL_ERROR
|
||||
#endif
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -126,7 +126,7 @@ int pinelog_get_level(void)
|
|||
|
||||
int pinelog_set_level(int level)
|
||||
{
|
||||
if (level < LOG_LVL_NONE || level > LOG_LVL_TRACE) {
|
||||
if (level < PINELOG_LVL_NONE || level > PINELOG_LVL_TRACE) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
|
@ -147,8 +147,8 @@ void pinelog_log_message(int level, const char *file, int line, const char *fmt,
|
|||
}
|
||||
|
||||
/* Cap the log level */
|
||||
if (level > LOG_LVL_TRACE) {
|
||||
level = LOG_LVL_TRACE;
|
||||
if (level > PINELOG_LVL_TRACE) {
|
||||
level = PINELOG_LVL_TRACE;
|
||||
}
|
||||
|
||||
/* Validate and set output stream */
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#ifndef LOGGING_H
|
||||
#define LOGGING_H
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -106,6 +107,10 @@ int pinelog_get_level(void);
|
|||
*
|
||||
* @returns None
|
||||
*/
|
||||
#if HAVE_FUNC_ATTRIBUTE_FORMAT
|
||||
__attribute__((format(printf, 4, 5)))
|
||||
#endif
|
||||
|
||||
void pinelog_log_message(int level, const char *file, int line, const char *fmt, ...);
|
||||
|
||||
#define PINELOG_FATAL(fmt, ...) do { \
|
||||
|
|
Loading…
Reference in New Issue