Skip to content

Commit

Permalink
only add -Wno-potentially-evaluated-expression if compiler understand…
Browse files Browse the repository at this point in the history
…s it
  • Loading branch information
farindk committed Jul 17, 2019
1 parent 504c726 commit c7e62e2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 4 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ if eval "test x$enable_multithreading != xno"; then
fi
AC_SUBST(ENABLE_PARALLEL_TILE_DECODING)

CXXFLAGS="$CXXFLAGS -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -Wno-error=unused-parameter -Wno-potentially-evaluated-expression"
CFLAGS="$CFLAGS -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -Wno-error=unused-parameter -Wno-potentially-evaluated-expression"
AC_C_CXX_COMPILE_FLAGS([-Wno-potentially-evaluated-expression])

CXXFLAGS="$CXXFLAGS -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -Wno-error=unused-parameter"
CFLAGS="$CFLAGS -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -Wno-error=unused-parameter"

AC_MSG_NOTICE([---------------------------------------])
AC_MSG_NOTICE([Multithreading: $enable_multithreading])
Expand Down
16 changes: 16 additions & 0 deletions m4/ac_c_cxx_compile_flags.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
AC_DEFUN([AC_C_CXX_COMPILE_FLAGS],[
NEW_CFLAGS="$CFLAGS"
for ac_flag in $1
do
AC_MSG_CHECKING(whether compiler supports $ac_flag)
CFLAGS="$NEW_CFLAGS $ac_flag"
AC_TRY_COMPILE(,[
void f() {};
],[
NEW_CFLAGS="$CFLAGS"
AC_MSG_RESULT(yes)
],AC_MSG_RESULT(no))
done
CFLAGS="$NEW_CFLAGS"
CXXFLAGS="$NEW_CFLAGS"
])

0 comments on commit c7e62e2

Please sign in to comment.