summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-06-18 11:23:09 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2009-06-18 11:23:09 +0000
commit0e25424e916ff5f7efb794888583ecf51e908cae (patch)
treed00804fc00800f7897e1dc379b54b229fa303021 /Build
parent2c9611093f83facc8843572a8dccff85083073f6 (diff)
enable compiler warnings
git-svn-id: svn://tug.org/texlive/trunk@13812 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/m4/kpse-warnings.m46
-rw-r--r--Build/source/texk/musixflx/ChangeLog7
-rw-r--r--Build/source/texk/musixflx/Makefile.am2
-rw-r--r--Build/source/texk/musixflx/Makefile.in5
-rw-r--r--Build/source/texk/musixflx/aclocal.m41
-rwxr-xr-xBuild/source/texk/musixflx/configure56
-rw-r--r--Build/source/texk/musixflx/configure.ac1
-rw-r--r--Build/source/texk/musixflx/musixflx.c88
8 files changed, 129 insertions, 37 deletions
diff --git a/Build/source/m4/kpse-warnings.m4 b/Build/source/m4/kpse-warnings.m4
index fdc8d4bc2dc..7c3a490b707 100644
--- a/Build/source/m4/kpse-warnings.m4
+++ b/Build/source/m4/kpse-warnings.m4
@@ -36,11 +36,11 @@ if test "x$enable_compiler_warnings" = xno; then
kpse_cv_warning_cflags=
elif test "x$GCC" = xyes; then
kpse_cv_warning_cflags="-Wall -Wunused"
+ AS_CASE([`$CC -dumpversion`],
+ [3.4.* | 4.*],
+ [kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wdeclaration-after-statement"])
if test "x$enable_compiler_warnings" != xmin; then
kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wmissing-prototypes -Wmissing-declarations"
- AS_CASE([`$CC -dumpversion`],
- [3.4.* | 4.*],
- [kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wdeclaration-after-statement"])
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"
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 <peb@mppmu.mpg.de>
+
+ * 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 <peb@mppmu.mpg.de>
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<eff_linewidth){
+ while (x<eff_linewidth)
+ {
if (detect_end) break;
++i;
@@ -726,7 +726,8 @@ int main(argc, argv)
else if (line_in_section==lines){detect_end=FALSE; x=0;}
hardlength += hardbarlength[i];
- softlength += softbarlength[i];}
+ softlength += softbarlength[i];
+ }
/************************************************
If the overhang is less than half the barlength,
@@ -734,7 +735,8 @@ int main(argc, argv)
and shrink the line accordingly.
*************************************************/
- if ((x-eff_linewidth)<(lastbar/2)){
+ if ((x-eff_linewidth)<(lastbar/2))
+ {
barsinline=i-mark;
mark=i;
lastbarno=barno[mark];
@@ -745,9 +747,11 @@ int main(argc, argv)
the amount of afterruleskip
*********************************************/
- if (zbar[mark]){
+ if (zbar[mark])
+ {
softbarlength[i+1] += afterrule;
- eff_softlength[section] += afterrule;}
+ eff_softlength[section] += afterrule;
+ }
/********************************************
last bar in line a leftrightrepeat?
@@ -756,7 +760,8 @@ int main(argc, argv)
advance the softwidth of next bar
*********************************************/
- if (lr_repeat[mark]){
+ if (lr_repeat[mark])
+ {
/* printf("mark=%d\n",mark);
printf("width_leftright=%f\n",width_leftrightrepeat[i]);
printf("width_left=%f\n",width_leftrepeat[i]); */
@@ -767,7 +772,7 @@ int main(argc, argv)
softbarlength[i+1] += afterrule/2;
eff_softlength[section] += afterrule/2;
- }
+ }
/********************************************
last bar in line a leftrepeat?
@@ -776,13 +781,16 @@ int main(argc, argv)
advance the softwidth of next bar
*********************************************/
- if (l_repeat[mark]){
+ if (l_repeat[mark])
+ {
hardlength -= (width_leftrepeat[i]-lthick);
hardbarlength[i+1] += width_leftrepeat[i];
softbarlength[i+1] += afterrule/2;
- eff_softlength[section] += afterrule/2;}
+ eff_softlength[section] += afterrule/2;
+ }
- if (signchange[sign+1]==mark+1){ /* s.b. */
+ if (signchange[sign+1]==mark+1) /* s.b. */
+ {
++sign;
/* Because the bar is staying here in the line, we look ahead
to see if the upcoming bar is a sign change, and adjust space
@@ -791,15 +799,20 @@ int main(argc, argv)
sign change bar is really a bar+xbar set, where the sign change
is buried in the xbar, then we don't do the move because the
change notice really won't be posted in this line. jh-1 */
- if (xbar[mark+1]<2){ /* okay to do the move. jh-1 */
- hardlength += oldsignskip[sign];
- hardbarlength[mark+1] -= oldsignskip[sign];}}}
+ if (xbar[mark+1]<2) /* okay to do the move. jh-1 */
+ {
+ hardlength += oldsignskip[sign];
+ hardbarlength[mark+1] -= oldsignskip[sign];
+ }
+ }
+ }
/*********************************************
Exclude the latest bar, and stretch the line.
**********************************************/
- else{
+ else
+ {
barsinline=i-1-mark;
if (barsinline<1) error_exit(2);
@@ -810,19 +823,23 @@ int main(argc, argv)
if (zbar[mark]) softbarlength[i] += afterrule;
- if (lr_repeat[mark]){
+ if (lr_repeat[mark])
+ {
hardlength -= (width_leftrightrepeat[i-1]-width_leftrepeat[i-1]);
eff_hardlength[section] +=
(width_leftrightrepeat[i-1]-width_leftrepeat[i-1]);
hardbarlength[i] += width_leftrepeat[i-1];
softbarlength[i] += afterrule/2;
- eff_softlength[section] += afterrule/2;}
+ eff_softlength[section] += afterrule/2;
+ }
- if (l_repeat[mark]){
+ if (l_repeat[mark])
+ {
hardlength -= (width_leftrepeat[i-1]-lthick);
hardbarlength[i] += width_leftrepeat[i-1];
softbarlength[i] += afterrule/2;
- eff_softlength[section] += afterrule/2;}
+ eff_softlength[section] += afterrule/2;
+ }
/*********************************************************************
Error (o/u-hbox) occurs only when signature change start in next line
@@ -831,13 +848,18 @@ int main(argc, argv)
reduce next hard barlength by signature change
**********************************************************************/
- if (signchange[sign]==mark+1){
+ if (signchange[sign]==mark+1)
+ {
/* However, if the next bar is a bar+xbar set where the
sign change comes from the xbar, then don't do this
move, because the extra skip is not really there! jh-1 */
- if (xbar[mark+1]<2) { /* alright, do the move. jh-1 */
- hardlength += oldsignskip[sign];
- hardbarlength[mark+1] -= oldsignskip[sign];}}}
+ if (xbar[mark+1]<2) /* alright, do the move. jh-1 */
+ {
+ hardlength += oldsignskip[sign];
+ hardbarlength[mark+1] -= oldsignskip[sign];
+ }
+ }
+ }
/***********************************************
Define a flex factor for this line as the ratio