From ffe0571cfeed11aff6873c2a6337b678f06cac11 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 2 Sep 2015 07:02:00 +0000 Subject: luaTeX: Remove all g++ warnings git-svn-id: svn://tug.org/texlive/trunk@38274 c570f23f-e606-0410-a88d-b1316a301751 --- .../libs/poppler/poppler-0.35.0-PATCHES/ChangeLog | 5 +++ .../patch-03-Object-functions | 43 +++++++++++++++++++++ .../libs/poppler/poppler-0.35.0/poppler/Object.h | 10 ++--- Build/source/texk/web2c/ChangeLog | 4 ++ Build/source/texk/web2c/c-auto.in | 3 ++ Build/source/texk/web2c/configure | 45 ++++++++++++++++++++++ Build/source/texk/web2c/configure.ac | 16 ++++++++ Build/source/texk/web2c/luatexdir/ChangeLog | 5 +++ Build/source/texk/web2c/luatexdir/lua/lepdflib.cc | 24 ++++++++---- 9 files changed, 143 insertions(+), 12 deletions(-) create mode 100644 Build/source/libs/poppler/poppler-0.35.0-PATCHES/patch-03-Object-functions (limited to 'Build/source') diff --git a/Build/source/libs/poppler/poppler-0.35.0-PATCHES/ChangeLog b/Build/source/libs/poppler/poppler-0.35.0-PATCHES/ChangeLog index 041ef5aacd8..59065cd60ea 100644 --- a/Build/source/libs/poppler/poppler-0.35.0-PATCHES/ChangeLog +++ b/Build/source/libs/poppler/poppler-0.35.0-PATCHES/ChangeLog @@ -1,3 +1,8 @@ +2015-09-01 Peter Breitenlohner + + * patch-03-Object-functions (new): Declare parameter of Object + member functions initCmd, isStream, and streamIs as const. + 2015-08-10 Peter Breitenlohner Imported poppler-0.35.0 source tree from: diff --git a/Build/source/libs/poppler/poppler-0.35.0-PATCHES/patch-03-Object-functions b/Build/source/libs/poppler/poppler-0.35.0-PATCHES/patch-03-Object-functions new file mode 100644 index 00000000000..cc76a16cd22 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.35.0-PATCHES/patch-03-Object-functions @@ -0,0 +1,43 @@ +diff -ur poppler-0.35.0.orig/poppler/Object.h poppler-0.35.0/poppler/Object.h +--- poppler-0.35.0.orig/poppler/Object.h 2014-02-09 16:10:32.000000000 +0100 ++++ poppler-0.35.0/poppler/Object.h 2015-09-01 10:16:06.000000000 +0200 +@@ -140,7 +140,7 @@ + Object *initStream(Stream *streamA); + Object *initRef(int numA, int genA) + { initObj(objRef); ref.num = numA; ref.gen = genA; return this; } +- Object *initCmd(char *cmdA) ++ Object *initCmd(const char *cmdA) + { initObj(objCmd); cmd = copyString(cmdA); return this; } + Object *initError() + { initObj(objError); return this; } +@@ -186,7 +186,7 @@ + GBool isName(const char *nameA) + { return type == objName && !strcmp(name, nameA); } + GBool isDict(const char *dictType); +- GBool isStream(char *dictType); ++ GBool isStream(const char *dictType); + GBool isCmd(const char *cmdA) + { return type == objCmd && !strcmp(cmd, cmdA); } + +@@ -233,7 +233,7 @@ + Object *dictGetValNF(int i, Object *obj); + + // Stream accessors. +- GBool streamIs(char *dictType); ++ GBool streamIs(const char *dictType); + void streamReset(); + void streamClose(); + int streamGetChar(); +@@ -337,10 +337,10 @@ + + #include "Stream.h" + +-inline GBool Object::streamIs(char *dictType) ++inline GBool Object::streamIs(const char *dictType) + { OBJECT_TYPE_CHECK(objStream); return stream->getDict()->is(dictType); } + +-inline GBool Object::isStream(char *dictType) ++inline GBool Object::isStream(const char *dictType) + { return type == objStream && streamIs(dictType); } + + inline void Object::streamReset() diff --git a/Build/source/libs/poppler/poppler-0.35.0/poppler/Object.h b/Build/source/libs/poppler/poppler-0.35.0/poppler/Object.h index 15bea159857..a4a4930ea9d 100644 --- a/Build/source/libs/poppler/poppler-0.35.0/poppler/Object.h +++ b/Build/source/libs/poppler/poppler-0.35.0/poppler/Object.h @@ -140,7 +140,7 @@ public: Object *initStream(Stream *streamA); Object *initRef(int numA, int genA) { initObj(objRef); ref.num = numA; ref.gen = genA; return this; } - Object *initCmd(char *cmdA) + Object *initCmd(const char *cmdA) { initObj(objCmd); cmd = copyString(cmdA); return this; } Object *initError() { initObj(objError); return this; } @@ -186,7 +186,7 @@ public: GBool isName(const char *nameA) { return type == objName && !strcmp(name, nameA); } GBool isDict(const char *dictType); - GBool isStream(char *dictType); + GBool isStream(const char *dictType); GBool isCmd(const char *cmdA) { return type == objCmd && !strcmp(cmd, cmdA); } @@ -233,7 +233,7 @@ public: Object *dictGetValNF(int i, Object *obj); // Stream accessors. - GBool streamIs(char *dictType); + GBool streamIs(const char *dictType); void streamReset(); void streamClose(); int streamGetChar(); @@ -337,10 +337,10 @@ inline Object *Object::dictGetValNF(int i, Object *obj) #include "Stream.h" -inline GBool Object::streamIs(char *dictType) +inline GBool Object::streamIs(const char *dictType) { OBJECT_TYPE_CHECK(objStream); return stream->getDict()->is(dictType); } -inline GBool Object::isStream(char *dictType) +inline GBool Object::isStream(const char *dictType) { return type == objStream && streamIs(dictType); } inline void Object::streamReset() diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index a44c8ecbd8f..8aaf0ba33b5 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,7 @@ +2015-09-01 Peter Breitenlohner + + * configure.ac: Check poppler for Object::initCmd(const char*). + 2015-08-29 Peter Breitenlohner * configure.ac: Drop check for , we now diff --git a/Build/source/texk/web2c/c-auto.in b/Build/source/texk/web2c/c-auto.in index 8166e0e43af..ce18d89e49b 100644 --- a/Build/source/texk/web2c/c-auto.in +++ b/Build/source/texk/web2c/c-auto.in @@ -139,6 +139,9 @@ /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H +/* Define to 1 if you have the `Object::initCmd(const char*)' function. */ +#undef HAVE_OBJECT_INITCMD_CONST_CHARP + /* Define to 1 if you have the `putenv' function. */ #undef HAVE_PUTENV diff --git a/Build/source/texk/web2c/configure b/Build/source/texk/web2c/configure index c2bd3d449fa..e8b1a612345 100755 --- a/Build/source/texk/web2c/configure +++ b/Build/source/texk/web2c/configure @@ -24457,6 +24457,51 @@ else KPATHSEA_PATHS_H='${top_builddir}/..' fi + +eval CPPFLAGS=\"$POPPLER_INCLUDES \$CPPFLAGS\" +eval LIBS=\"$POPPLER_LIBS \$LIBS\" + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +ac_link="./libtool --mode=link --tag=CXX $ac_link" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Object::initCmd(const char*) etc" >&5 +$as_echo_n "checking for Object::initCmd(const char*) etc... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +Object *obj; const char *name; +obj->initCmd(name)->isStream(name); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + kpse_cv_have_Object_initCmd_const_charp=yes +else + kpse_cv_have_Object_initCmd_const_charp=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $kpse_cv_have_Object_initCmd_const_charp" >&5 +$as_echo "$kpse_cv_have_Object_initCmd_const_charp" >&6; } +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_link="./libtool --mode=link --tag=CC $ac_link" + +if test "x$kpse_cv_have_Object_initCmd_const_charp" = xyes; then + +$as_echo "#define HAVE_OBJECT_INITCMD_CONST_CHARP 1" >>confdefs.h + +fi CPPFLAGS=$kpse_save_CPPFLAGS LIBS=$kpse_save_LIBS diff --git a/Build/source/texk/web2c/configure.ac b/Build/source/texk/web2c/configure.ac index cc52b7cc7ff..c6cd65893fe 100644 --- a/Build/source/texk/web2c/configure.ac +++ b/Build/source/texk/web2c/configure.ac @@ -283,6 +283,22 @@ else KPATHSEA_PATHS_H='${top_builddir}/..' fi AC_SUBST([KPATHSEA_PATHS_H]) + +dnl Check for Object::initCmd(const char *) etc +KPSE_ADD_FLAGS([poppler]) +AC_LANG_PUSH([C++]) +AC_MSG_CHECKING([for Object::[initCmd(const char*)] etc]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[Object *obj; const char *name; +obj->initCmd(name)->isStream(name);]])], + [kpse_cv_have_Object_initCmd_const_charp=yes], + [kpse_cv_have_Object_initCmd_const_charp=no]) +AC_MSG_RESULT([$kpse_cv_have_Object_initCmd_const_charp]) +AC_LANG_POP([C++]) +if test "x$kpse_cv_have_Object_initCmd_const_charp" = xyes; then + AC_DEFINE([HAVE_OBJECT_INITCMD_CONST_CHARP], 1, + [Define to 1 if you have the `Object::initCmd(const char*)' function.]) +fi KPSE_RESTORE_FLAGS dnl Write output here, instead of putting a zillion -D's on the command line. diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index 18badf6c886..6aabd31036b 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,8 @@ +2015-09-01 Peter Breitenlohner + + * lua/lepdflib.cc: Drop useless casts 'const char *' -> 'char *' + when poppler has Object::initCmd(const char*). + 2015-08-31 Peter Breitenlohner * lua/lepdflib.cc: Bugfix: m_Object_dictAdd() must use a copy of diff --git a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc index cb1795bdf38..b05e44a4d6b 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc +++ b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc @@ -1279,8 +1279,16 @@ static const struct luaL_Reg Links_m[] = { //********************************************************************** // Object +#ifdef HAVE_OBJECT_INITCMD_CONST_CHARP +#define CHARP_CAST +#else +// must cast arg of Object::initCmd, Object::isStream, and Object::streamIs +// from 'const char *' to 'char *', although they are not modified. +#define CHARP_CAST (char *) +#endif + // Special type checking. -#define m_Object_isType(function, cast) \ +#define m_Object_isType_(function, cast) \ static int m_Object_##function(lua_State * L) \ { \ udstruct *uin; \ @@ -1301,6 +1309,8 @@ static int m_Object_##function(lua_State * L) \ } \ return 1; \ } +#define m_Object_isType(function) m_Object_isType_(function, ) +#define m_Object_isType_nonconst(function) m_Object_isType_(function, CHARP_CAST) static int m_Object_initBool(lua_State * L) { @@ -1444,7 +1454,7 @@ static int m_Object_initCmd(lua_State * L) if (uin->pd != NULL && uin->pd->pc != uin->pc) pdfdoc_changed_error(L); s = luaL_checkstring(L, 2); - ((Object *) uin->d)->initCmd((char *) s); + ((Object *) uin->d)->initCmd(CHARP_CAST s); return 0; } @@ -1514,13 +1524,13 @@ m_poppler_get_BOOL(Object, isInt); m_poppler_get_BOOL(Object, isReal); m_poppler_get_BOOL(Object, isNum); m_poppler_get_BOOL(Object, isString); -m_Object_isType(isName, ); +m_Object_isType(isName); m_poppler_get_BOOL(Object, isNull); m_poppler_get_BOOL(Object, isArray); -m_Object_isType(isDict, ); -m_Object_isType(isStream, (char *)); +m_Object_isType(isDict); +m_Object_isType_nonconst(isStream); m_poppler_get_BOOL(Object, isRef); -m_Object_isType(isCmd, ); +m_Object_isType(isCmd); m_poppler_get_BOOL(Object, isError); m_poppler_get_BOOL(Object, isEOF); m_poppler_get_BOOL(Object, isNone); @@ -1964,7 +1974,7 @@ static int m_Object_streamIs(lua_State * L) pdfdoc_changed_error(L); s = luaL_checkstring(L, 2); if (((Object *) uin->d)->isStream()) { - if (((Object *) uin->d)->streamIs((char *) s)) + if (((Object *) uin->d)->streamIs(CHARP_CAST s)) lua_pushboolean(L, 1); else lua_pushboolean(L, 0); -- cgit v1.2.3