]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fixed some warnings
authorAndrew Tridgell <tridge@samba.org>
Sat, 6 Apr 2002 06:45:31 +0000 (08:45 +0200)
committerAndrew Tridgell <tridge@samba.org>
Sat, 6 Apr 2002 06:45:31 +0000 (08:45 +0200)
ccache.h
cleanup.c
config.h
config.h.in
configure
configure.in
util.c

index 2d52e92dc820b0849a240b4cdce21e0367cc1cb6..eb65dde43ea49552ff2a4bd1975c335d8ec8566e 100644 (file)
--- a/ccache.h
+++ b/ccache.h
@@ -1,4 +1,4 @@
-#define CCACHE_VERSION "1.4"
+#define CCACHE_VERSION "1.5"
 
 #include "config.h"
 
@@ -112,3 +112,8 @@ ARGS *args_init(void);
 void args_add(ARGS *args, const char *s);
 void args_pop(ARGS *args, int n);
 
+#if HAVE_COMPAR_FN_T
+#define COMPAR_FN_T __compar_fn_t
+#else
+typedef int (*COMPAR_FN_T)(const void *, const void *);
+#endif
index a37a71c2ea6d5d446aa364efa84255d55d9ae603..cc4c8a86642f83d51e11fc42f5c6e8a5ca4d9829 100644 (file)
--- a/cleanup.c
+++ b/cleanup.c
@@ -80,7 +80,8 @@ static void sort_and_clean(void)
 
        if (num_files > 1) {
                /* sort in ascending data order */
-               qsort(files, num_files, sizeof(struct files *), files_compare);
+               qsort(files, num_files, sizeof(struct files *), 
+                     (COMPAR_FN_T)files_compare);
        }
        
        /* delete enough files to bring us below the threshold */
index c39507a0768d0dd7356d63c1c1f1be5a8bc53815..d81541feab669af18145cfd314fe904b19d12d2a 100644 (file)
--- a/config.h
+++ b/config.h
@@ -7,6 +7,9 @@
 /* */
 #define HAVE_C99_VSNPRINTF 1
 
+/* */
+#define HAVE_COMPAR_FN_T 1
+
 /* Define if you have the <dirent.h> header file, and it defines `DIR'. */
 #define HAVE_DIRENT_H 1
 
index 8770bdb51f73433cc0a9980b13769b421237eaaf..34726431fe3e9d74d154bc7889e2c62d77568d0f 100644 (file)
@@ -6,6 +6,9 @@
 /* */
 #undef HAVE_C99_VSNPRINTF
 
+/* */
+#undef HAVE_COMPAR_FN_T
+
 /* Define if you have the <dirent.h> header file, and it defines `DIR'. */
 #undef HAVE_DIRENT_H
 
index 7ab02bd538c435102db9aa2a75eaa98e893228f6..6b75d5787b45c80df96b29ee25ce6059d459fcaf 100755 (executable)
--- a/configure
+++ b/configure
@@ -2272,17 +2272,67 @@ EOF
 fi
 done
 
-echo "$as_me:2275: checking for C99 vsnprintf" >&5
+echo "$as_me:2275: checking for compar_fn_t in stdlib.h" >&5
+echo $ECHO_N "checking for compar_fn_t in stdlib.h... $ECHO_C" >&6
+if test "${ccache_cv_COMPAR_FN_T+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+    cat >conftest.$ac_ext <<_ACEOF
+#line 2282 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+int
+main ()
+{
+
+void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2296: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:2299: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:2302: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:2305: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ccache_cv_COMPAR_FN_T=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ccache_cv_COMPAR_FN_T=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:2315: result: $ccache_cv_COMPAR_FN_T" >&5
+echo "${ECHO_T}$ccache_cv_COMPAR_FN_T" >&6
+if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then
+
+cat >>confdefs.h <<\EOF
+#define HAVE_COMPAR_FN_T 1
+EOF
+
+fi
+
+echo "$as_me:2325: checking for C99 vsnprintf" >&5
 echo $ECHO_N "checking for C99 vsnprintf... $ECHO_C" >&6
-if test "${rsync_cv_HAVE_C99_VSNPRINTF+set}" = set; then
+if test "${ccache_cv_HAVE_C99_VSNPRINTF+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 if test "$cross_compiling" = yes; then
-  rsync_cv_HAVE_C99_VSNPRINTF=cross
+  ccache_cv_HAVE_C99_VSNPRINTF=cross
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 2285 "configure"
+#line 2335 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -2305,29 +2355,29 @@ main() { foo("hello"); }
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:2308: \"$ac_link\"") >&5
+if { (eval echo "$as_me:2358: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:2311: \$? = $ac_status" >&5
+  echo "$as_me:2361: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:2313: \"$ac_try\"") >&5
+  { (eval echo "$as_me:2363: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2316: \$? = $ac_status" >&5
+  echo "$as_me:2366: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  rsync_cv_HAVE_C99_VSNPRINTF=yes
+  ccache_cv_HAVE_C99_VSNPRINTF=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-rsync_cv_HAVE_C99_VSNPRINTF=no
+ccache_cv_HAVE_C99_VSNPRINTF=no
 fi
 rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
-echo "$as_me:2328: result: $rsync_cv_HAVE_C99_VSNPRINTF" >&5
-echo "${ECHO_T}$rsync_cv_HAVE_C99_VSNPRINTF" >&6
-if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
+echo "$as_me:2378: result: $ccache_cv_HAVE_C99_VSNPRINTF" >&5
+echo "${ECHO_T}$ccache_cv_HAVE_C99_VSNPRINTF" >&6
+if test x"$ccache_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
 
 cat >>confdefs.h <<\EOF
 #define HAVE_C99_VSNPRINTF 1
@@ -2416,7 +2466,7 @@ DEFS=-DHAVE_CONFIG_H
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:2419: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:2469: creating $CONFIG_STATUS" >&5
 echo "$as_me: creating $CONFIG_STATUS" >&6;}
 cat >$CONFIG_STATUS <<_ACEOF
 #! $SHELL
@@ -2589,7 +2639,7 @@ cat >>$CONFIG_STATUS <<\EOF
     echo "$ac_cs_version"; exit 0 ;;
   --he | --h)
     # Conflict between --help and --header
-    { { echo "$as_me:2592: error: ambiguous option: $1
+    { { echo "$as_me:2642: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -2608,7 +2658,7 @@ Try \`$0 --help' for more information." >&2;}
     ac_need_defaults=false;;
 
   # This is an error.
-  -*) { { echo "$as_me:2611: error: unrecognized option: $1
+  -*) { { echo "$as_me:2661: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -2645,7 +2695,7 @@ do
   # Handling of arguments.
   "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
   "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
-  *) { { echo "$as_me:2648: error: invalid argument: $ac_config_target" >&5
+  *) { { echo "$as_me:2698: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
@@ -2851,7 +2901,7 @@ done; }
   esac
 
   if test x"$ac_file" != x-; then
-    { echo "$as_me:2854: creating $ac_file" >&5
+    { echo "$as_me:2904: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
     rm -f "$ac_file"
   fi
@@ -2869,7 +2919,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:2872: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:2922: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -2882,7 +2932,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:2885: error: cannot find input file: $f" >&5
+           { { echo "$as_me:2935: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -2943,7 +2993,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
   * )   ac_file_in=$ac_file.in ;;
   esac
 
-  test x"$ac_file" != x- && { echo "$as_me:2946: creating $ac_file" >&5
+  test x"$ac_file" != x- && { echo "$as_me:2996: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
 
   # First look for the input files in the build tree, otherwise in the
@@ -2954,7 +3004,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:2957: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:3007: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -2967,7 +3017,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:2970: error: cannot find input file: $f" >&5
+           { { echo "$as_me:3020: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -3084,7 +3134,7 @@ cat >>$CONFIG_STATUS <<\EOF
   rm -f $tmp/in
   if test x"$ac_file" != x-; then
     if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
-      { echo "$as_me:3087: $ac_file is unchanged" >&5
+      { echo "$as_me:3137: $ac_file is unchanged" >&5
 echo "$as_me: $ac_file is unchanged" >&6;}
     else
       ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
index 463800b14375aa96db86c5f265fea483c6121a9a..aa3d45c3a6339444c5c5edf96e6bd3230d7f371c 100644 (file)
@@ -33,7 +33,18 @@ AC_HEADER_SYS_WAIT
 
 AC_CHECK_FUNCS(realpath snprintf vsnprintf vasprintf asprintf)
 
-AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[
+AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [
+    AC_TRY_COMPILE(
+[#include <stdlib.h>],
+[
+void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }
+],
+       ccache_cv_COMPAR_FN_T=yes,ccache_cv_COMPAR_FN_T=no)])
+if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then
+   AC_DEFINE(HAVE_COMPAR_FN_T, 1, [ ])
+fi
+
+AC_CACHE_CHECK([for C99 vsnprintf],ccache_cv_HAVE_C99_VSNPRINTF,[
 AC_TRY_RUN([
 #include <sys/types.h>
 #include <stdarg.h>
@@ -53,8 +64,8 @@ void foo(const char *format, ...) {
 }
 main() { foo("hello"); }
 ],
-rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)])
-if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
+ccache_cv_HAVE_C99_VSNPRINTF=yes,ccache_cv_HAVE_C99_VSNPRINTF=no,ccache_cv_HAVE_C99_VSNPRINTF=cross)])
+if test x"$ccache_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
     AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ])
 fi
 
diff --git a/util.c b/util.c
index c50f726610b8a9968df3babf88c9064abe6f58e0..5066f25a6f5b0ab1de18977671964e9b8acd5f99 100644 (file)
--- a/util.c
+++ b/util.c
@@ -249,7 +249,7 @@ int lock_fd(int fd)
 size_t file_size(struct stat *st)
 {
        size_t size = st->st_blocks * 512;
-       if (st->st_size > size) {
+       if ((size_t)st->st_size > size) {
                /* probably a broken stat() call ... */
                size = (st->st_size + 1023) & ~1023;
        }