Skip to content

Commit d59f89b

Browse files
petterreinholdtsenSebKuzminsky
authored andcommitted
Drop unsupported -Wno-stringop-truncation when building with clang.
(cherry picked from commit 2ac77e1)
1 parent 897454f commit d59f89b

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ INCLUDE += $(LIBTIRPC_CFLAGS)
252252
# Compilation options. Perhaps some of these should come from Makefile.inc? (CXXFLAGS now does)
253253
INTEGER_OVERFLOW_FLAGS := -fwrapv
254254
OPT := -Os $(INTEGER_OVERFLOW_FLAGS)
255-
DEBUG := $(DEBUG) -g -Wall -Wno-stringop-truncation -D_FORTIFY_SOURCE=2
255+
DEBUG := $(DEBUG) -g -Wall -D_FORTIFY_SOURCE=2
256256
CFLAGS := $(INCLUDE) $(OPT) $(DEBUG) $(EXTRA_DEBUG) -DULAPI -std=gnu11 -Werror=implicit-function-declaration $(CFLAGS) $(CPPFLAGS)
257257
CXXFLAGS := $(INCLUDE) $(EXTRA_DEBUG) -DULAPI $(DEBUG) $(OPT) -Werror=overloaded-virtual $(CXXFLAGS) $(CPPFLAGS)
258258
CXXFLAGS += -std=gnu++17

src/configure.ac

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,14 @@ elif ! test `$CC -dumpversion | cut -d '.' -f 1` -gt 2 ; then
408408
AC_MSG_ERROR([Compilers older than gcc 3.x are no longer supported])
409409
fi
410410

411+
# Set flags for C and C++ if supported
412+
for commonflag in -Wno-stringop-truncation ; do
413+
if echo "int main() { return 0;}" | $CC -Werror $commonflag -E - > /dev/null; then
414+
CFLAGS="$CFLAGS $flag"
415+
CXXFLAGS="$CXXFLAGS $flag"
416+
fi
417+
done
418+
411419
AC_MSG_CHECKING([for usability of linux/hidraw.h])
412420
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
413421
#include <sys/ioctl.h>

0 commit comments

Comments
 (0)