Skip to content

Commit

Permalink
Merge pull request #102 from kronosnet/clang
Browse files Browse the repository at this point in the history
Clang
  • Loading branch information
fabbione committed Dec 15, 2017
2 parents 0bbf73a + 0a92792 commit 9deffd5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ case "$host_os" in
;;
esac

AM_CONDITIONAL([KNET_LINUX], [echo $host_os | grep -q linux])
AM_CONDITIONAL([KNET_BSD], [echo $host_os | grep -q bsd])

# Checks for header files.
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([stdlib.h])
Expand Down
5 changes: 5 additions & 0 deletions libknet/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ endif
if BUILD_COMPRESS_LZO2
pkglib_LTLIBRARIES += compress_lzo2.la
compress_lzo2_la_LDFLAGS = -module -avoid-version
if KNET_LINUX
compress_lzo2_la_CFLAGS = $(lzo2_CFLAGS)
endif
if KNET_BSD
compress_lzo2_la_CFLAGS = $(lzo2_CFLAGS) -I/usr/local/include
endif
compress_lzo2_la_LIBADD = $(lzo2_LIBS)
endif

Expand Down
7 changes: 7 additions & 0 deletions libknet/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,14 @@ void log_msg(knet_handle_t knet_h, uint8_t subsystem, uint8_t msglevel,
msg.msglevel = msglevel;

va_start(ap, fmt);
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-nonliteral"
#endif
vsnprintf(msg.msg, sizeof(msg.msg) - 2, fmt, ap);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
va_end(ap);

len = strlen(msg.msg);
Expand Down

0 comments on commit 9deffd5

Please sign in to comment.