From 35274aded90aef21a670accdb3af1ec57f2c6cfa Mon Sep 17 00:00:00 2001 From: Guido Draheim Date: Sun, 16 Aug 2009 18:35:38 +0000 Subject: [PATCH] re-enabled extra gcc-warnings --- ChangeLog | 3 + configure | 488 +++++++++++++++++++++++++++++++++---------------- configure.ac | 10 +- zzip/fseeko.c | 14 +- zzip/memdisk.c | 1 + zzip/mmapped.c | 6 +- zzip/mmapped.h | 2 +- 7 files changed, 359 insertions(+), 165 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58d8517..692445b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2009-08-16 guidod + * configure.ac: reorder ax_gcc_flags as the extra options were + disabled (do not know why) and add -Wstrict-aliasing to the set. + Then fix issues in source files (mostly signed-comparision warnings) * zzip/file.c (zzip_file_open): ZZIP_CASELESS will include a mapping of "\" into "/" to get away with windows-orientied programs. The backslash however is only active for those diff --git a/configure b/configure index 0a1c2ce..edce447 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 1.13 . +# From configure.ac Revision: 1.14 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63. # @@ -15933,7 +15933,7 @@ fi { $as_echo "$as_me:$LINENO: checking whether system differentiates 64bit off_t by defines" >&5 $as_echo_n "checking whether system differentiates 64bit off_t by defines... " >&6; } ac_cv_sys_largefile_sensitive="no" -if test ".$ac_cv_sys_file_offset_bits$ac_cv_sys_large_files" != ".nono" +if test ".${ac_cv_sys_file_offset_bits-no}${ac_cv_sys_large_files-no}" != ".nono" then ac_cv_sys_largefile_sensitive="yes" cat >>confdefs.h <<\_ACEOF @@ -16177,7 +16177,7 @@ case "$host_os" in ;; *) - if ".$can_build_shared" = .no + if test ".$can_build_shared" = .no then ZZIPLIB_LDFLAGS="" else ZZIPLIB_LDFLAGS="--export-dynamic" fi @@ -16322,12 +16322,12 @@ case ".$ac_cv_cflags_warn_all" in ;; esac -{ $as_echo "$as_me:$LINENO: checking CFLAGS making strings readonly" >&5 -$as_echo_n "checking CFLAGS making strings readonly... " >&6; } -if test "${ac_cv_cflags_no_writable_strings+set}" = set; then +{ $as_echo "$as_me:$LINENO: checking CFLAGS for gcc -Wpointer-arith" >&5 +$as_echo_n "checking CFLAGS for gcc -Wpointer-arith... " >&6; } +if test "${ac_cv_cflags_gcc_option__Wpointer_arith+set}" = set; then $as_echo_n "(cached) " >&6 else - ac_cv_cflags_no_writable_strings="no, unknown" + ac_cv_cflags_gcc_option__Wpointer_arith="no, unknown" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -16336,12 +16336,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" -# IRIX C compiler: -# -use_readonly_const is the default for IRIX C, -# puts them into .rodata, but they are copied later. -# need to be "-G0 -rdatashared" for strictmode but -# I am not sure what effect that has really. - guidod -for ac_arg in "-pedantic % -fno-writable-strings -Wwrite-strings" "-pedantic % -fconst-strings -Wwrite-strings" "-v -Xc % -xstrconst" "+w1 -Aa % +ESlit" "-w0 -std1 % -readonly_strings" "-fullwarn -use_readonly_const %% ok, its the default" # +for ac_arg in "-pedantic -Werror % -Wpointer-arith" "-pedantic % -Wpointer-arith %% no, obsolete" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -16376,7 +16371,7 @@ $as_echo "$ac_try_echo") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_cflags_no_writable_strings=`echo $ac_arg | sed -e 's,.*% *,,'` ; break + ac_cv_cflags_gcc_option__Wpointer_arith=`echo $ac_arg | sed -e 's,.*% *,,'` ; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -16386,23 +16381,64 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done -case ".$ac_cv_cflags_no_writable_strings" in - .|.no|.no,*) ;; - *) # sanity check - testing strcpy() from string.h - cp config.log config.tmp - cat >conftest.$ac_ext <<_ACEOF + CFLAGS="$ac_save_CFLAGS" + 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 + + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Wpointer_arith" >&5 +$as_echo "$ac_cv_cflags_gcc_option__Wpointer_arith" >&6; } +case ".$ac_cv_cflags_gcc_option__Wpointer_arith" in + .ok|.ok,*) ;; + .|.no|.no,*) ;; + *) + if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Wpointer_arith " 2>&1 >/dev/null + then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Wpointer_arith") >&5 + (: CFLAGS does contain $ac_cv_cflags_gcc_option__Wpointer_arith) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Wpointer_arith\"") >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wpointer_arith") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wpointer_arith" + fi + ;; +esac + +{ $as_echo "$as_me:$LINENO: checking CFLAGS for gcc -Wsign-compare" >&5 +$as_echo_n "checking CFLAGS for gcc -Wsign-compare... " >&6; } +if test "${ac_cv_cflags_gcc_option__Wsign_compare+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_cflags_gcc_option__Wsign_compare="no, unknown" + + 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_save_CFLAGS="$CFLAGS" +for ac_arg in "-pedantic -Werror % -Wsign-compare" "-pedantic % -Wsign-compare %% no, obsolete" # +do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + int main () { - - char test[16]; - if (strcpy (test, "test")) return 1; +return 0; ; return 0; } @@ -16425,21 +16461,18 @@ $as_echo "$ac_try_echo") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - if test `diff config.log config.tmp | grep -i warning | wc -l` != 0 - then ac_cv_cflags_no_writable_strings="no, suppressed, string.h," ; fi + ac_cv_cflags_gcc_option__Wsign_compare=`echo $ac_arg | sed -e 's,.*% *,,'` ; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_cflags_no_writable_strings="no, suppressed, string.h" + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - rm config.tmp - ;; -esac - CFLAGS="$ac_save_CFLAGS" - ac_ext=c +done + CFLAGS="$ac_save_CFLAGS" + 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' @@ -16447,35 +16480,34 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_no_writable_strings" >&5 -$as_echo "$ac_cv_cflags_no_writable_strings" >&6; } -case ".$ac_cv_cflags_no_writable_strings" in +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Wsign_compare" >&5 +$as_echo "$ac_cv_cflags_gcc_option__Wsign_compare" >&6; } +case ".$ac_cv_cflags_gcc_option__Wsign_compare" in .ok|.ok,*) ;; - .|.no|.no,*) - ;; + .|.no|.no,*) ;; *) - if echo " $CFLAGS " | grep " $ac_cv_cflags_no_writable_strings " 2>&1 >/dev/null - then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_no_writable_strings") >&5 - (: CFLAGS does contain $ac_cv_cflags_no_writable_strings) 2>&5 + if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Wsign_compare " 2>&1 >/dev/null + then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Wsign_compare") >&5 + (: CFLAGS does contain $ac_cv_cflags_gcc_option__Wsign_compare) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_no_writable_strings\"") >&5 - (: CFLAGS="$CFLAGS $ac_cv_cflags_no_writable_strings") 2>&5 + else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Wsign_compare\"") >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wsign_compare") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - CFLAGS="$CFLAGS $ac_cv_cflags_no_writable_strings" + CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wsign_compare" fi ;; esac -{ $as_echo "$as_me:$LINENO: checking CFLAGS for strict prototypes" >&5 -$as_echo_n "checking CFLAGS for strict prototypes... " >&6; } -if test "${ac_cv_cflags_strict_prototypes+set}" = set; then +{ $as_echo "$as_me:$LINENO: checking CFLAGS for gcc -Wmissing-declarations" >&5 +$as_echo_n "checking CFLAGS for gcc -Wmissing-declarations... " >&6; } +if test "${ac_cv_cflags_gcc_option__Wmissing_declarations+set}" = set; then $as_echo_n "(cached) " >&6 else - ac_cv_cflags_strict_prototypes="no, unknown" + ac_cv_cflags_gcc_option__Wmissing_declarations="no, unknown" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -16484,7 +16516,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" -for ac_arg in "-pedantic % -fstrict-prototypes -Wstrict-prototypes" "-pedantic % -Wstrict-prototypes" "-pedantic % -Wmissing-prototypes" "-pedantic % -Werror-implicit-function-declaration" "-pedantic % -Wimplicit-function-declaration" # +for ac_arg in "-pedantic -Werror % -Wmissing-declarations" "-pedantic % -Wmissing-declarations %% no, obsolete" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -16519,7 +16551,7 @@ $as_echo "$ac_try_echo") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_cflags_strict_prototypes=`echo $ac_arg | sed -e 's,.*% *,,'` ; break + ac_cv_cflags_gcc_option__Wmissing_declarations=`echo $ac_arg | sed -e 's,.*% *,,'` ; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -16529,23 +16561,64 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done -case ".$ac_cv_cflags_strict_prototypes" in - .|.no|.no,*) ;; - *) # sanity check with signal() from sys/signal.h - cp config.log config.tmp - cat >conftest.$ac_ext <<_ACEOF + CFLAGS="$ac_save_CFLAGS" + 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 + + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Wmissing_declarations" >&5 +$as_echo "$ac_cv_cflags_gcc_option__Wmissing_declarations" >&6; } +case ".$ac_cv_cflags_gcc_option__Wmissing_declarations" in + .ok|.ok,*) ;; + .|.no|.no,*) ;; + *) + if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Wmissing_declarations " 2>&1 >/dev/null + then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Wmissing_declarations") >&5 + (: CFLAGS does contain $ac_cv_cflags_gcc_option__Wmissing_declarations) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Wmissing_declarations\"") >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wmissing_declarations") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wmissing_declarations" + fi + ;; +esac + +{ $as_echo "$as_me:$LINENO: checking CFLAGS for gcc -Wdeclaration-after-statement" >&5 +$as_echo_n "checking CFLAGS for gcc -Wdeclaration-after-statement... " >&6; } +if test "${ac_cv_cflags_gcc_option__Wdeclaration_after_statement+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_cflags_gcc_option__Wdeclaration_after_statement="no, unknown" + + 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_save_CFLAGS="$CFLAGS" +for ac_arg in "-pedantic -Werror % -Wdeclaration-after-statement" "-pedantic % -Wdeclaration-after-statement %% no, obsolete" # +do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + int main () { - - if (signal (SIGINT, SIG_IGN) == SIG_DFL) return 1; - if (signal (SIGINT, SIG_IGN) != SIG_DFL) return 2; +return 0; ; return 0; } @@ -16568,20 +16641,16 @@ $as_echo "$ac_try_echo") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - if test `diff config.log config.tmp | grep -i warning | wc -l` != 0 -then if test `diff config.log config.tmp | grep -i warning | wc -l` != 1 -then ac_cv_cflags_strict_prototypes="no, suppressed, signal.h," ; fi ; fi + ac_cv_cflags_gcc_option__Wdeclaration_after_statement=`echo $ac_arg | sed -e 's,.*% *,,'` ; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_cflags_strict_prototypes="no, suppressed, signal.h" + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - rm config.tmp - ;; -esac +done CFLAGS="$ac_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -16591,35 +16660,34 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_strict_prototypes" >&5 -$as_echo "$ac_cv_cflags_strict_prototypes" >&6; } -case ".$ac_cv_cflags_strict_prototypes" in +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Wdeclaration_after_statement" >&5 +$as_echo "$ac_cv_cflags_gcc_option__Wdeclaration_after_statement" >&6; } +case ".$ac_cv_cflags_gcc_option__Wdeclaration_after_statement" in .ok|.ok,*) ;; - .|.no|.no,*) - ;; + .|.no|.no,*) ;; *) - if echo " $CFLAGS " | grep " $ac_cv_cflags_strict_prototypes " 2>&1 >/dev/null - then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_strict_prototypes") >&5 - (: CFLAGS does contain $ac_cv_cflags_strict_prototypes) 2>&5 + if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Wdeclaration_after_statement " 2>&1 >/dev/null + then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Wdeclaration_after_statement") >&5 + (: CFLAGS does contain $ac_cv_cflags_gcc_option__Wdeclaration_after_statement) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_strict_prototypes\"") >&5 - (: CFLAGS="$CFLAGS $ac_cv_cflags_strict_prototypes") 2>&5 + else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Wdeclaration_after_statement\"") >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wdeclaration_after_statement") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - CFLAGS="$CFLAGS $ac_cv_cflags_strict_prototypes" + CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wdeclaration_after_statement" fi ;; esac -{ $as_echo "$as_me:$LINENO: checking CFLAGS for gcc -Wpointer-arith" >&5 -$as_echo_n "checking CFLAGS for gcc -Wpointer-arith... " >&6; } -if test "${ac_cv_cflags_gcc_option__Wpointer_arith+set}" = set; then +{ $as_echo "$as_me:$LINENO: checking CFLAGS for gcc -Werror-implicit-function-declaration" >&5 +$as_echo_n "checking CFLAGS for gcc -Werror-implicit-function-declaration... " >&6; } +if test "${ac_cv_cflags_gcc_option__Werror_implicit_function_declaration+set}" = set; then $as_echo_n "(cached) " >&6 else - ac_cv_cflags_gcc_option__Wpointer_arith="no, unknown" + ac_cv_cflags_gcc_option__Werror_implicit_function_declaration="no, unknown" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -16628,7 +16696,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" -for ac_arg in "-pedantic -Werror % -Wpointer-arith" "-pedantic % -Wpointer-arith %% no, obsolete" # +for ac_arg in "-pedantic -Werror % -Werror-implicit-function-declaration" "-pedantic % -Werror-implicit-function-declaration %% no, obsolete" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -16663,7 +16731,7 @@ $as_echo "$ac_try_echo") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_cflags_gcc_option__Wpointer_arith=`echo $ac_arg | sed -e 's,.*% *,,'` ; break + ac_cv_cflags_gcc_option__Werror_implicit_function_declaration=`echo $ac_arg | sed -e 's,.*% *,,'` ; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -16682,34 +16750,34 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Wpointer_arith" >&5 -$as_echo "$ac_cv_cflags_gcc_option__Wpointer_arith" >&6; } -case ".$ac_cv_cflags_gcc_option__Wpointer_arith" in +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration" >&5 +$as_echo "$ac_cv_cflags_gcc_option__Werror_implicit_function_declaration" >&6; } +case ".$ac_cv_cflags_gcc_option__Werror_implicit_function_declaration" in .ok|.ok,*) ;; .|.no|.no,*) ;; *) - if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Wpointer_arith " 2>&1 >/dev/null - then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Wpointer_arith") >&5 - (: CFLAGS does contain $ac_cv_cflags_gcc_option__Wpointer_arith) 2>&5 + if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration " 2>&1 >/dev/null + then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Werror_implicit_function_declaration") >&5 + (: CFLAGS does contain $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Wpointer_arith\"") >&5 - (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wpointer_arith") 2>&5 + else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Werror_implicit_function_declaration\"") >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wpointer_arith" + CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration" fi ;; esac -{ $as_echo "$as_me:$LINENO: checking CFLAGS for gcc -Wsign-compare" >&5 -$as_echo_n "checking CFLAGS for gcc -Wsign-compare... " >&6; } -if test "${ac_cv_cflags_gcc_option__Wsign_compare+set}" = set; then +{ $as_echo "$as_me:$LINENO: checking CFLAGS for gcc -Wstrict-aliasing" >&5 +$as_echo_n "checking CFLAGS for gcc -Wstrict-aliasing... " >&6; } +if test "${ac_cv_cflags_gcc_option__Wstrict_aliasing+set}" = set; then $as_echo_n "(cached) " >&6 else - ac_cv_cflags_gcc_option__Wsign_compare="no, unknown" + ac_cv_cflags_gcc_option__Wstrict_aliasing="no, unknown" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -16718,7 +16786,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" -for ac_arg in "-pedantic -Werror % -Wsign-compare" "-pedantic % -Wsign-compare %% no, obsolete" # +for ac_arg in "-pedantic -Werror % -Wstrict-aliasing" "-pedantic % -Wstrict-aliasing %% no, obsolete" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -16753,7 +16821,7 @@ $as_echo "$ac_try_echo") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_cflags_gcc_option__Wsign_compare=`echo $ac_arg | sed -e 's,.*% *,,'` ; break + ac_cv_cflags_gcc_option__Wstrict_aliasing=`echo $ac_arg | sed -e 's,.*% *,,'` ; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -16772,34 +16840,34 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Wsign_compare" >&5 -$as_echo "$ac_cv_cflags_gcc_option__Wsign_compare" >&6; } -case ".$ac_cv_cflags_gcc_option__Wsign_compare" in +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Wstrict_aliasing" >&5 +$as_echo "$ac_cv_cflags_gcc_option__Wstrict_aliasing" >&6; } +case ".$ac_cv_cflags_gcc_option__Wstrict_aliasing" in .ok|.ok,*) ;; .|.no|.no,*) ;; *) - if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Wsign_compare " 2>&1 >/dev/null - then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Wsign_compare") >&5 - (: CFLAGS does contain $ac_cv_cflags_gcc_option__Wsign_compare) 2>&5 + if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Wstrict_aliasing " 2>&1 >/dev/null + then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Wstrict_aliasing") >&5 + (: CFLAGS does contain $ac_cv_cflags_gcc_option__Wstrict_aliasing) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Wsign_compare\"") >&5 - (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wsign_compare") 2>&5 + else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Wstrict_aliasing\"") >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wstrict_aliasing") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wsign_compare" + CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wstrict_aliasing" fi ;; esac -{ $as_echo "$as_me:$LINENO: checking CFLAGS for gcc -Wmissing-declarations" >&5 -$as_echo_n "checking CFLAGS for gcc -Wmissing-declarations... " >&6; } -if test "${ac_cv_cflags_gcc_option__Wmissing_declarations+set}" = set; then +{ $as_echo "$as_me:$LINENO: checking CFLAGS for gcc -Warray-bounds" >&5 +$as_echo_n "checking CFLAGS for gcc -Warray-bounds... " >&6; } +if test "${ac_cv_cflags_gcc_option__Warray_bounds+set}" = set; then $as_echo_n "(cached) " >&6 else - ac_cv_cflags_gcc_option__Wmissing_declarations="no, unknown" + ac_cv_cflags_gcc_option__Warray_bounds="no, unknown" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -16808,7 +16876,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" -for ac_arg in "-pedantic -Werror % -Wmissing-declarations" "-pedantic % -Wmissing-declarations %% no, obsolete" # +for ac_arg in "-pedantic -Werror % -Warray-bounds" "-pedantic % -Warray-bounds %% no, obsolete" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -16843,7 +16911,7 @@ $as_echo "$ac_try_echo") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_cflags_gcc_option__Wmissing_declarations=`echo $ac_arg | sed -e 's,.*% *,,'` ; break + ac_cv_cflags_gcc_option__Warray_bounds=`echo $ac_arg | sed -e 's,.*% *,,'` ; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -16862,34 +16930,34 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Wmissing_declarations" >&5 -$as_echo "$ac_cv_cflags_gcc_option__Wmissing_declarations" >&6; } -case ".$ac_cv_cflags_gcc_option__Wmissing_declarations" in +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Warray_bounds" >&5 +$as_echo "$ac_cv_cflags_gcc_option__Warray_bounds" >&6; } +case ".$ac_cv_cflags_gcc_option__Warray_bounds" in .ok|.ok,*) ;; .|.no|.no,*) ;; *) - if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Wmissing_declarations " 2>&1 >/dev/null - then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Wmissing_declarations") >&5 - (: CFLAGS does contain $ac_cv_cflags_gcc_option__Wmissing_declarations) 2>&5 + if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Warray_bounds " 2>&1 >/dev/null + then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Warray_bounds") >&5 + (: CFLAGS does contain $ac_cv_cflags_gcc_option__Warray_bounds) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Wmissing_declarations\"") >&5 - (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wmissing_declarations") 2>&5 + else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Warray_bounds\"") >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Warray_bounds") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wmissing_declarations" + CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Warray_bounds" fi ;; esac -{ $as_echo "$as_me:$LINENO: checking CFLAGS for gcc -Wdeclaration-after-statement" >&5 -$as_echo_n "checking CFLAGS for gcc -Wdeclaration-after-statement... " >&6; } -if test "${ac_cv_cflags_gcc_option__Wdeclaration_after_statement+set}" = set; then +{ $as_echo "$as_me:$LINENO: checking CFLAGS making strings readonly" >&5 +$as_echo_n "checking CFLAGS making strings readonly... " >&6; } +if test "${ac_cv_cflags_no_writable_strings+set}" = set; then $as_echo_n "(cached) " >&6 else - ac_cv_cflags_gcc_option__Wdeclaration_after_statement="no, unknown" + ac_cv_cflags_no_writable_strings="no, unknown" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -16898,7 +16966,12 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" -for ac_arg in "-pedantic -Werror % -Wdeclaration-after-statement" "-pedantic % -Wdeclaration-after-statement %% no, obsolete" # +# IRIX C compiler: +# -use_readonly_const is the default for IRIX C, +# puts them into .rodata, but they are copied later. +# need to be "-G0 -rdatashared" for strictmode but +# I am not sure what effect that has really. - guidod +for ac_arg in "-pedantic % -fno-writable-strings -Wwrite-strings" "-pedantic % -fconst-strings -Wwrite-strings" "-v -Xc % -xstrconst" "+w1 -Aa % +ESlit" "-w0 -std1 % -readonly_strings" "-fullwarn -use_readonly_const %% ok, its the default" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -16933,7 +17006,7 @@ $as_echo "$ac_try_echo") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_cflags_gcc_option__Wdeclaration_after_statement=`echo $ac_arg | sed -e 's,.*% *,,'` ; break + ac_cv_cflags_no_writable_strings=`echo $ac_arg | sed -e 's,.*% *,,'` ; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -16943,8 +17016,60 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done - CFLAGS="$ac_save_CFLAGS" - ac_ext=c +case ".$ac_cv_cflags_no_writable_strings" in + .|.no|.no,*) ;; + *) # sanity check - testing strcpy() from string.h + cp config.log config.tmp + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + char test[16]; + if (strcpy (test, "test")) return 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + if test `diff config.log config.tmp | grep -i warning | wc -l` != 0 + then ac_cv_cflags_no_writable_strings="no, suppressed, string.h," ; fi +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_cflags_no_writable_strings="no, suppressed, string.h" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + rm config.tmp + ;; +esac + CFLAGS="$ac_save_CFLAGS" + 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' @@ -16952,34 +17077,35 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Wdeclaration_after_statement" >&5 -$as_echo "$ac_cv_cflags_gcc_option__Wdeclaration_after_statement" >&6; } -case ".$ac_cv_cflags_gcc_option__Wdeclaration_after_statement" in +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_no_writable_strings" >&5 +$as_echo "$ac_cv_cflags_no_writable_strings" >&6; } +case ".$ac_cv_cflags_no_writable_strings" in .ok|.ok,*) ;; - .|.no|.no,*) ;; + .|.no|.no,*) + ;; *) - if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Wdeclaration_after_statement " 2>&1 >/dev/null - then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Wdeclaration_after_statement") >&5 - (: CFLAGS does contain $ac_cv_cflags_gcc_option__Wdeclaration_after_statement) 2>&5 + if echo " $CFLAGS " | grep " $ac_cv_cflags_no_writable_strings " 2>&1 >/dev/null + then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_no_writable_strings") >&5 + (: CFLAGS does contain $ac_cv_cflags_no_writable_strings) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Wdeclaration_after_statement\"") >&5 - (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wdeclaration_after_statement") 2>&5 + else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_no_writable_strings\"") >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_no_writable_strings") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wdeclaration_after_statement" + CFLAGS="$CFLAGS $ac_cv_cflags_no_writable_strings" fi ;; esac -{ $as_echo "$as_me:$LINENO: checking CFLAGS for gcc -Werror-implicit-function-declaration" >&5 -$as_echo_n "checking CFLAGS for gcc -Werror-implicit-function-declaration... " >&6; } -if test "${ac_cv_cflags_gcc_option__Werror_implicit_function_declaration+set}" = set; then +{ $as_echo "$as_me:$LINENO: checking CFLAGS for strict prototypes" >&5 +$as_echo_n "checking CFLAGS for strict prototypes... " >&6; } +if test "${ac_cv_cflags_strict_prototypes+set}" = set; then $as_echo_n "(cached) " >&6 else - ac_cv_cflags_gcc_option__Werror_implicit_function_declaration="no, unknown" + ac_cv_cflags_strict_prototypes="no, unknown" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -16988,7 +17114,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" -for ac_arg in "-pedantic -Werror % -Werror-implicit-function-declaration" "-pedantic % -Werror-implicit-function-declaration %% no, obsolete" # +for ac_arg in "-pedantic % -fstrict-prototypes -Wstrict-prototypes" "-pedantic % -Wstrict-prototypes" "-pedantic % -Wmissing-prototypes" "-pedantic % -Werror-implicit-function-declaration" "-pedantic % -Wimplicit-function-declaration" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -17023,7 +17149,7 @@ $as_echo "$ac_try_echo") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_cflags_gcc_option__Werror_implicit_function_declaration=`echo $ac_arg | sed -e 's,.*% *,,'` ; break + ac_cv_cflags_strict_prototypes=`echo $ac_arg | sed -e 's,.*% *,,'` ; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -17033,6 +17159,59 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done +case ".$ac_cv_cflags_strict_prototypes" in + .|.no|.no,*) ;; + *) # sanity check with signal() from sys/signal.h + cp config.log config.tmp + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + if (signal (SIGINT, SIG_IGN) == SIG_DFL) return 1; + if (signal (SIGINT, SIG_IGN) != SIG_DFL) return 2; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + if test `diff config.log config.tmp | grep -i warning | wc -l` != 0 +then if test `diff config.log config.tmp | grep -i warning | wc -l` != 1 +then ac_cv_cflags_strict_prototypes="no, suppressed, signal.h," ; fi ; fi +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_cflags_strict_prototypes="no, suppressed, signal.h" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + rm config.tmp + ;; +esac CFLAGS="$ac_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -17042,24 +17221,25 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration" >&5 -$as_echo "$ac_cv_cflags_gcc_option__Werror_implicit_function_declaration" >&6; } -case ".$ac_cv_cflags_gcc_option__Werror_implicit_function_declaration" in +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cflags_strict_prototypes" >&5 +$as_echo "$ac_cv_cflags_strict_prototypes" >&6; } +case ".$ac_cv_cflags_strict_prototypes" in .ok|.ok,*) ;; - .|.no|.no,*) ;; + .|.no|.no,*) + ;; *) - if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration " 2>&1 >/dev/null - then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Werror_implicit_function_declaration") >&5 - (: CFLAGS does contain $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration) 2>&5 + if echo " $CFLAGS " | grep " $ac_cv_cflags_strict_prototypes " 2>&1 >/dev/null + then { ($as_echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_strict_prototypes") >&5 + (: CFLAGS does contain $ac_cv_cflags_strict_prototypes) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Werror_implicit_function_declaration\"") >&5 - (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration") 2>&5 + else { ($as_echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_strict_prototypes\"") >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_strict_prototypes") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } - CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration" + CFLAGS="$CFLAGS $ac_cv_cflags_strict_prototypes" fi ;; esac diff --git a/configure.ac b/configure.ac index 43dc21b..6148679 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_INIT([zziplib.spec]) AC_PREREQ(2.49) AC_COPYRIGHT([Guido Draheim for ZZipLib.SF.net]) -AC_REVISION($Revision: 1.14 $) +AC_REVISION($Revision: 1.15 $) AC_CONFIG_AUX_DIR([uses]) AC_CONFIG_MACRO_DIR([m4]) # ======================================================================= @@ -286,7 +286,7 @@ case "$host_os" in ;; *) - if ".$can_build_shared" = .no + if test ".$can_build_shared" = .no then ZZIPLIB_LDFLAGS="" else ZZIPLIB_LDFLAGS="--export-dynamic" fi @@ -300,13 +300,15 @@ AC_SUBST([RESOLVES]) AX_MAINTAINER_MODE_AUTO_SILENT AX_NOT_ENABLE_FRAME_POINTER AX_CFLAGS_WARN_ALL -AX_CFLAGS_NO_WRITABLE_STRINGS -AX_CFLAGS_STRICT_PROTOTYPES AX_CFLAGS_GCC_OPTION(-Wpointer-arith) AX_CFLAGS_GCC_OPTION(-Wsign-compare) AX_CFLAGS_GCC_OPTION(-Wmissing-declarations) AX_CFLAGS_GCC_OPTION(-Wdeclaration-after-statement) AX_CFLAGS_GCC_OPTION(-Werror-implicit-function-declaration) +AX_CFLAGS_GCC_OPTION(-Wstrict-aliasing) +AX_CFLAGS_GCC_OPTION(-Warray-bounds) +AX_CFLAGS_NO_WRITABLE_STRINGS +AX_CFLAGS_STRICT_PROTOTYPES # --------------------------------------------------------------- AX_ENABLE_DEFAULT_PKGCONFIGDIR AX_ENABLE_DEFAULT_ACLOCALDIR diff --git a/zzip/fseeko.c b/zzip/fseeko.c index 0f9ce8d..d99067a 100644 --- a/zzip/fseeko.c +++ b/zzip/fseeko.c @@ -51,6 +51,10 @@ #include #endif +#if defined ZZIP_HAVE_STDINT_H +#include +#endif + #if __STDC_VERSION__+0 > 199900L #define ___ #define ____ @@ -188,9 +192,12 @@ prescan_entry(ZZIP_ENTRY * entry) entry->tail = newtail; entry->tailalloc = tailsize + 1; } - ___ zzip_size_t n = fread(entry->tail, 1, tailsize, entry->diskfile); +# ifdef SIZE_MAX /* from stdint.h */ + if (tailsize > (zzip_off_t)(SIZE_MAX)) { return EFBIG; } +# endif + ___ zzip_size_t readsize = fread(entry->tail, 1, tailsize, entry->diskfile); /* name + comment + extras */ - if (n != tailsize) { + if ((zzip_off_t)readsize != tailsize) { return errno; } else { return 0; @@ -265,11 +272,12 @@ zzip_entry_findfirst(FILE * disk) mapoffs -= pagesize / 2; mapsize += pagesize / 2; } + assert(mapsize < 3*8192); while (1) { if (fseeko(disk, mapoffs, SEEK_SET) == -1) goto error; - if (fread(buffer, 1, mapsize, disk) != mapsize) + if (fread(buffer, 1, mapsize, disk) != (zzip_size_t)mapsize) goto error; ___ unsigned char *p = buffer + mapsize - sizeof(struct zzip_disk_trailer); diff --git a/zzip/memdisk.c b/zzip/memdisk.c index 9d3d38a..dc00ea8 100644 --- a/zzip/memdisk.c +++ b/zzip/memdisk.c @@ -50,6 +50,7 @@ static const char *error[] = { "zzip_mem_disk_fdopen: zzip_disk_mmap did fail" # define _zzip_mem_disk_buffer_fail 3 "zzip_mem_disk_buffer: zzip_disk_buffer did fail", + 0 }; #define ZZIP_EXTRA_zip64 0x0001 diff --git a/zzip/mmapped.c b/zzip/mmapped.c index 25c63cc..3cdd6fc 100644 --- a/zzip/mmapped.c +++ b/zzip/mmapped.c @@ -181,12 +181,12 @@ zzip_disk_open(char *filename) * own the buffer, it will neither be written nor free()d. */ zzip__new__ ZZIP_DISK * -zzip_disk_buffer(char *buffer, size_t buflen) { +zzip_disk_buffer(void *buffer, size_t buflen) { ZZIP_DISK *disk = zzip_disk_new(); if (disk) { - disk->buffer = buffer; - disk->endbuf = buffer + buflen; + disk->buffer = (zzip_byte_t *) buffer; + disk->endbuf = (zzip_byte_t *) buffer + buflen; disk->mapped = -1; } return disk; diff --git a/zzip/mmapped.h b/zzip/mmapped.h index fcc402f..ee2ba5a 100644 --- a/zzip/mmapped.h +++ b/zzip/mmapped.h @@ -72,7 +72,7 @@ zzip_disk_extern zzip__new__ ZZIP_DISK* zzip_disk_open(char* filename); zzip_disk_extern zzip__new__ ZZIP_DISK * -zzip_disk_buffer(char *buffer, size_t buflen); +zzip_disk_buffer(void *buffer, size_t buflen); zzip_disk_extern int zzip_disk_close(ZZIP_DISK* disk); -- 2.40.0