From 0e25424e916ff5f7efb794888583ecf51e908cae Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Thu, 18 Jun 2009 11:23:09 +0000 Subject: enable compiler warnings git-svn-id: svn://tug.org/texlive/trunk@13812 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/musixflx/ChangeLog | 7 +++ Build/source/texk/musixflx/Makefile.am | 2 + Build/source/texk/musixflx/Makefile.in | 5 +- Build/source/texk/musixflx/aclocal.m4 | 1 + Build/source/texk/musixflx/configure | 56 +++++++++++++++++++++ Build/source/texk/musixflx/configure.ac | 1 + Build/source/texk/musixflx/musixflx.c | 88 ++++++++++++++++++++------------- 7 files changed, 126 insertions(+), 34 deletions(-) (limited to 'Build/source/texk/musixflx') diff --git a/Build/source/texk/musixflx/ChangeLog b/Build/source/texk/musixflx/ChangeLog index 8464641037a..2e1da38bf7c 100644 --- a/Build/source/texk/musixflx/ChangeLog +++ b/Build/source/texk/musixflx/ChangeLog @@ -1,3 +1,10 @@ +2009-06-18 Peter Breitenlohner + + * Makefile.am, configure.ac: enable compiler warnings. + * musixflx.c: use ANSI C function declarations. + avoid uninitialized use of 'lastbar'. + declare error_exit as static. + 2009-05-07 Peter Breitenlohner Adapt to TL2009 build system. diff --git a/Build/source/texk/musixflx/Makefile.am b/Build/source/texk/musixflx/Makefile.am index 4f1a2b295be..01430d99f68 100644 --- a/Build/source/texk/musixflx/Makefile.am +++ b/Build/source/texk/musixflx/Makefile.am @@ -5,5 +5,7 @@ ## ACLOCAL_AMFLAGS = -I ../../m4 +AM_CFLAGS = $(WARNING_CFLAGS) + bin_PROGRAMS = musixflx diff --git a/Build/source/texk/musixflx/Makefile.in b/Build/source/texk/musixflx/Makefile.in index 422ad83282f..a2e5cfae453 100644 --- a/Build/source/texk/musixflx/Makefile.in +++ b/Build/source/texk/musixflx/Makefile.in @@ -45,7 +45,8 @@ DIST_COMMON = $(am__configure_deps) $(srcdir)/../../build-aux/depcomp \ ../../build-aux/missing ../../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 \ @@ -123,6 +124,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@ @@ -166,6 +168,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I ../../m4 +AM_CFLAGS = $(WARNING_CFLAGS) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am diff --git a/Build/source/texk/musixflx/aclocal.m4 b/Build/source/texk/musixflx/aclocal.m4 index d360465f230..a6397fb2452 100644 --- a/Build/source/texk/musixflx/aclocal.m4 +++ b/Build/source/texk/musixflx/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/texk/musixflx/configure b/Build/source/texk/musixflx/configure index a73d794f779..4534f68e6e2 100755 --- a/Build/source/texk/musixflx/configure +++ b/Build/source/texk/musixflx/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 @@ -3458,6 +3463,57 @@ else 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 + + 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_headers="$ac_config_headers config.h" diff --git a/Build/source/texk/musixflx/configure.ac b/Build/source/texk/musixflx/configure.ac index 911444a8c17..8b076f56f16 100644 --- a/Build/source/texk/musixflx/configure.ac +++ b/Build/source/texk/musixflx/configure.ac @@ -16,6 +16,7 @@ AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE AC_PROG_CC +KPSE_COMPILER_WARNINGS dnl Not used, but avoids zillions of defines on commandline AC_CONFIG_HEADERS([config.h]) diff --git a/Build/source/texk/musixflx/musixflx.c b/Build/source/texk/musixflx/musixflx.c index 7db76c5a83a..39a80d6297b 100644 --- a/Build/source/texk/musixflx/musixflx.c +++ b/Build/source/texk/musixflx/musixflx.c @@ -68,9 +68,6 @@ #define GETLINE fgets(linebuf, (int) sizeof(linebuf), infile) -/* ! If next line causes trouble, comment it out ! */ -void error_exit(int error_number); - int zbar[MAX_BARS], lr_repeat[MAX_BARS], raggedline[MAX_BARS], l_repeat[MAX_BARS], barno[MAX_BARS], autolines[MAX_SECTIONS], bars[MAX_SECTIONS], mulooseness[MAX_SECTIONS], signchange[MAX_SIGNS], @@ -87,8 +84,8 @@ double hardbarlength[MAX_BARS], softbarlength[MAX_BARS], FILE *infile, *outfile, *logfile; char linebuf[128]; -void error_exit(error_number) - int error_number; +static void +error_exit(int error_number) { switch (error_number){ @@ -108,9 +105,8 @@ void error_exit(error_number) default: printf("!!! Can't go on !!!\n"); exit(3);}} -int main(argc, argv) - int argc; - char **argv; +int +main(int argc, char **argv) { register int i, j, bar; @@ -662,7 +658,8 @@ int main(argc, argv) added correct computing of fill_length ****************************************************************/ - for (j=1; j<=lines; ++j, ++line_in_section){ + for (j=1; j<=lines; ++j, ++line_in_section) + { ++line_number; fill_length=(lines-j+1)*(linewidth-(clefskip+signskip[sign])); @@ -678,8 +675,9 @@ int main(argc, argv) if (!eff_softlength[section]) error_exit(5); spc_factor=(fill_length-eff_hardlength[section])/eff_softlength[section]; - if ((xbar[mark+1]>1) && (mark>0)){ - /* The bar is an bar+xbar with a sign change. jh-1 */ + if ((xbar[mark+1]>1) && (mark>0)) + { + /* The bar is an bar+xbar with a sign change. jh-1 */ eff_linewidth=linewidth-(clefskip+signskip[sign-1])-parindent; } else { /* This is a normal bar. jh-1 */ eff_linewidth=linewidth-(clefskip+signskip[sign])-parindent; @@ -697,9 +695,11 @@ int main(argc, argv) hardlength= 0; softlength = 0; x = 0; + lastbar = 0.0; detect_end= FALSE; - while (x