From b23af8b47f2312bbf132cd554b3fbf9c366a4f81 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 24 Jun 2009 06:59:52 +0000 Subject: enable compiler warnings git-svn-id: svn://tug.org/texlive/trunk@13936 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/utils/ps2eps/ChangeLog | 6 ++++ Build/source/utils/ps2eps/Makefile.am | 4 +++ Build/source/utils/ps2eps/Makefile.in | 6 +++- Build/source/utils/ps2eps/aclocal.m4 | 1 + Build/source/utils/ps2eps/bbox.c | 14 +++++--- Build/source/utils/ps2eps/configure | 62 ++++++++++++++++++++++++++++++++++ Build/source/utils/ps2eps/configure.ac | 3 ++ 7 files changed, 90 insertions(+), 6 deletions(-) diff --git a/Build/source/utils/ps2eps/ChangeLog b/Build/source/utils/ps2eps/ChangeLog index 77fb5e3d9d2..72445b15302 100644 --- a/Build/source/utils/ps2eps/ChangeLog +++ b/Build/source/utils/ps2eps/ChangeLog @@ -1,3 +1,9 @@ +2009-06-23 Peter Breitenlohner + + * Makefile.am (AM_CFLAGS), configure.ac: enable compiler warnings. + * bbox.c (minus_one, plus_one): declare as static. + (readppm_and_calcbb): static, avoid uninitialized warning. + 2009-05-06 Peter Breitenlohner Adapt to TL2009 build system. diff --git a/Build/source/utils/ps2eps/Makefile.am b/Build/source/utils/ps2eps/Makefile.am index 5c6fa5ae348..3be009166d8 100644 --- a/Build/source/utils/ps2eps/Makefile.am +++ b/Build/source/utils/ps2eps/Makefile.am @@ -3,6 +3,10 @@ ## Copyright (C) 2009 Peter Breitenlohner ## You may freely use, modify and/or distribute this file. ## +ACLOCAL_AMFLAGS = -I ../../m4 + +AM_CFLAGS = $(WARNING_CFLAGS) + bin_PROGRAMS = bbox bbox_SOURCES = bbox.c diff --git a/Build/source/utils/ps2eps/Makefile.in b/Build/source/utils/ps2eps/Makefile.in index 812e2437288..db51d1ebb72 100644 --- a/Build/source/utils/ps2eps/Makefile.in +++ b/Build/source/utils/ps2eps/Makefile.in @@ -47,7 +47,8 @@ DIST_COMMON = $(am__configure_deps) $(dist_bin_SCRIPTS) \ ../../build-aux/mkinstalldirs ../../build-aux/texinfo.tex \ ../../build-aux/ylwrap ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-warnings.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -150,6 +151,7 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -192,6 +194,8 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +ACLOCAL_AMFLAGS = -I ../../m4 +AM_CFLAGS = $(WARNING_CFLAGS) bbox_SOURCES = bbox.c dist_bin_SCRIPTS = ps2eps dist_man1_MANS = bbox.1 ps2eps.1 diff --git a/Build/source/utils/ps2eps/aclocal.m4 b/Build/source/utils/ps2eps/aclocal.m4 index d360465f230..a6397fb2452 100644 --- a/Build/source/utils/ps2eps/aclocal.m4 +++ b/Build/source/utils/ps2eps/aclocal.m4 @@ -989,3 +989,4 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR +m4_include([../../m4/kpse-warnings.m4]) diff --git a/Build/source/utils/ps2eps/bbox.c b/Build/source/utils/ps2eps/bbox.c index 4a7f87a6dbc..cc3c492ac40 100644 --- a/Build/source/utils/ps2eps/bbox.c +++ b/Build/source/utils/ps2eps/bbox.c @@ -55,12 +55,14 @@ unsigned char bitval[8]= 1 }; -unsigned int minus_one(const unsigned x) +static unsigned int +minus_one(const unsigned x) { return (x == 0) ? x : x-1; } -unsigned int plus_one(const unsigned x) +static unsigned int +plus_one(const unsigned x) { return (x == (unsigned int) ~0U) ? x : x+1; } @@ -81,9 +83,10 @@ unsigned int plus_one(const unsigned x) * and printed to stdout * ************************************************************************/ /* calculate the bounding box in postscript points, given a resolution in dpi */ -void readppm_and_calcbb(const char *name, - const unsigned int resolution, - const unsigned char tight) +static void +readppm_and_calcbb(const char *name, + const unsigned int resolution, + const unsigned char tight) { FILE *inputfile; char inputline[1024]; @@ -166,6 +169,7 @@ void readppm_and_calcbb(const char *name, #ifdef DEBUG fprintf(stderr,"\nreading picture: %s X: %u Y: %u\n",name,xmax,ymax); #endif + x = 0; /* avoid uninitialized warning */ x_min= xmax; x_max= 0; y_min= ymax; diff --git a/Build/source/utils/ps2eps/configure b/Build/source/utils/ps2eps/configure index 8f9d3732d22..195e68e7e74 100755 --- a/Build/source/utils/ps2eps/configure +++ b/Build/source/utils/ps2eps/configure @@ -605,6 +605,7 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +WARNING_CFLAGS am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE @@ -689,6 +690,7 @@ ac_user_opts=' enable_option_checking enable_maintainer_mode enable_dependency_tracking +enable_compiler_warnings ' ac_precious_vars='build_alias host_alias @@ -1329,6 +1331,9 @@ Optional Features: (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors + --enable-compiler-warnings=[no|min|yes|max] + Turn on compiler warnings [default: yes if + maintainer-mode, min otherwise] Some influential environment variables: CC C compiler command @@ -1821,6 +1826,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + am__api_version='1.11' # Find a good install program. We prefer a C program (faster), @@ -3458,6 +3464,62 @@ fi +# Check whether --enable-compiler-warnings was given. +if test "${enable_compiler_warnings+set}" = set; then + enableval=$enable_compiler_warnings; +fi +case $enable_compiler_warnings in + no | min | yes | max) : ;; + *) if test "x$enable_maintainer_mode" = xyes; then + enable_compiler_warnings=yes +else + enable_compiler_warnings=min +fi + ;; +esac + + +{ $as_echo "$as_me:$LINENO: checking what warning flags to pass to the C compiler" >&5 +$as_echo_n "checking what warning flags to pass to the C compiler... " >&6; } +if test "${kpse_cv_warning_cflags+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "x$enable_compiler_warnings" = xno; then + kpse_cv_warning_cflags= +elif test "x$GCC" = xyes; then + kpse_cv_warning_cflags="-Wall -Wunused" + case `$CC -dumpversion` in + 3.4.* | 4.*) kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wdeclaration-after-statement" ;; +esac + + case `$CC -dumpversion` in + 3.[234].* | 4.*) kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wno-unknown-pragmas" ;; +esac + + if test "x$enable_compiler_warnings" != xmin; then + kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wmissing-prototypes -Wmissing-declarations" + if test "x$enable_compiler_warnings" != xyes; then + kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wimplicit -Wparentheses -Wreturn-type" + kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wswitch -Wtrigraphs -Wshadow -Wpointer-arith" + kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wcast-qual -Wcast-align -Wwrite-strings" + case `$CC -dumpversion` in + 3.4.* | 4.*) kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wold-style-definition" ;; +esac + + fi + fi +else + : # FIXME: warning flags for non-gcc compilers +fi +fi +{ $as_echo "$as_me:$LINENO: result: $kpse_cv_warning_cflags" >&5 +$as_echo "$kpse_cv_warning_cflags" >&6; } +WARNING_CFLAGS=$kpse_cv_warning_cflags + + + + + ac_config_files="$ac_config_files Makefile" diff --git a/Build/source/utils/ps2eps/configure.ac b/Build/source/utils/ps2eps/configure.ac index 9c346150baf..7d3ca9391e0 100644 --- a/Build/source/utils/ps2eps/configure.ac +++ b/Build/source/utils/ps2eps/configure.ac @@ -10,12 +10,15 @@ AC_INIT([ps2eps for TeX Live], [1.64], [tex-k@tug.org]) AC_PREREQ([2.63]) AC_CONFIG_SRCDIR([ps2eps]) AC_CONFIG_AUX_DIR([../../build-aux]) +AC_CONFIG_MACRO_DIR([../../m4]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE AC_PROG_CC +KPSE_COMPILER_WARNINGS + AC_CONFIG_FILES([Makefile]) AC_OUTPUT -- cgit v1.2.3