2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 19:08:59 +00:00

Use -Wold-style-cast for C++ if supported

Also separate C and C++ warning flags.
This commit is contained in:
Jay Berkenbilt 2013-02-24 15:29:17 -05:00
parent a11081085b
commit 7276ab934d
3 changed files with 20 additions and 2 deletions

View File

@ -13,12 +13,13 @@ htmldir=@htmldir@
pdfdir=@pdfdir
CC=@CC@
WFLAGS=@WFLAGS@
CXXWFLAGS=@CXXWFLAGS@
CFLAGS=@CFLAGS@ $(WFLAGS)
LDFLAGS=@LDFLAGS@
LIBS=@LIBS@
CPPFLAGS=@CPPFLAGS@
CXX=@CXX@
CXXFLAGS=@CXXFLAGS@ $(WFLAGS)
CXXFLAGS=@CXXFLAGS@ $(CXXWFLAGS) $(WFLAGS)
AR=@AR@
RANLIB=@RANLIB@
DLLTOOL=@DLLTOOL@

View File

@ -176,6 +176,7 @@ AC_ARG_WITH(buildrules,
AC_MSG_RESULT($BUILDRULES)
AC_SUBST(WFLAGS)
AC_SUBST(CXXWFLAGS)
qpdf_USE_EXTRA_WARNINGS=0
if test "$BUILDRULES" = "msvc"; then
dnl /w14267 makes warning 4267 a level 1 warning. This warning reports
@ -197,6 +198,22 @@ if test "$qpdf_USE_EXTRA_WARNINGS" = "1"; then
else
AC_MSG_RESULT(no)
fi
if test "$BUILDRULES" != "msvc"; then
qpdf_USE_EXTRA_WARNINGS=0
try_flags="-Wold-style-cast"
AC_MSG_CHECKING(for whether $CXX supports $try_flags)
oCXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $try_flags"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int a = 1; int b = a; a = b;]])],
[qpdf_USE_EXTRA_WARNINGS=1],[qpdf_USE_EXTRA_WARNINGS=0])
CXXFLAGS=$oCXXFLAGS
if test "$qpdf_USE_EXTRA_WARNINGS" = "1"; then
AC_MSG_RESULT(yes)
CXXWFLAGS="$try_flags"
else
AC_MSG_RESULT(no)
fi
fi
if test "$BUILDRULES" = "msvc"; then
try_flags="/WX"

View File

@ -73,7 +73,7 @@ endef
# Usage: $(call libcompile,src,includes)
define c_libcompile
$(LIBTOOL) --quiet --mode=compile \
$(CC) $(CXXFLAGS) \
$(CC) $(CFLAGS) \
$(call libdepflags,$(basename $(call c_src_to_obj,$(1)))) \
$(foreach I,$(2),-I$(I)) \
$(CPPFLAGS) \