Apply warnings.diff from debian packaging, fixes spurious compiler warnings with...
authorNick Downing <nick@ndcode.org>
Mon, 5 Nov 2018 22:34:57 +0000 (09:34 +1100)
committerNick Downing <nick@ndcode.org>
Mon, 5 Nov 2018 22:39:06 +0000 (09:39 +1100)
Makefile.am
src/getmaxfsize.c
src/include/_mem.h
src/include/linux/firstinclude.h
src/test/mem_1.c
src/trecrun.c
tools/hashtime.c

index 53f901e..a34f542 100644 (file)
@@ -410,7 +410,7 @@ ACLOCAL_AMFLAGS = -I m4
 
 # Nick (trying to get tests to work)
 AUTOMAKE_OPTIONS = serial-tests
-XFAIL_TESTS = src/test/iobtree_1 src/test/bit_1 src/test/mem_1 src/test/bucket_1 src/test/str_1
+XFAIL_TESTS = src/test/iobtree_1 src/test/bit_1 src/test/bucket_1 src/test/str_1
 DISABLE_HARD_ERRORS = 1
 
 #### THINGS AFTER THIS LINE WILL BE REMOVED PRIOR TO DISTRIBUTION ####
index d3eefd8..aa3a8fb 100644 (file)
@@ -77,19 +77,19 @@ int getmaxfsize(int fd, unsigned int knownlimit, unsigned int *limit) {
                         } else {
                             assert(!CRASH);
                             lseek(fd, pos, SEEK_SET);
-                            ftruncate(fd, fsize);
+                            if (ftruncate(fd, fsize)) {} /* WUR; so pedantic */
                             return 0;
                         }
                     } else if (errno != EFBIG) {
                         assert(!CRASH);
                         lseek(fd, pos, SEEK_SET);
-                        ftruncate(fd, fsize);
+                        if (ftruncate(fd, fsize)) {} /* WUR; so pedantic */
                         return 0;
                     } 
                 } else {
                     assert(!CRASH);
                     lseek(fd, pos, SEEK_SET);
-                    ftruncate(fd, fsize);
+                    if (ftruncate(fd, fsize)) {} /* WUR; so pedantic */
                     return 0;
                 }
             }
@@ -106,7 +106,7 @@ int getmaxfsize(int fd, unsigned int knownlimit, unsigned int *limit) {
     } else if ((fsize < 2147483647)) {
         assert(!CRASH);
         lseek(fd, pos, SEEK_SET);
-        ftruncate(fd, fsize);
+        if (ftruncate(fd, fsize)) {} /* WUR; so pedantic */
         return 0;
     }
  
@@ -135,7 +135,7 @@ int getmaxfsize(int fd, unsigned int knownlimit, unsigned int *limit) {
         } else {
             assert(!CRASH);
             lseek(fd, pos, SEEK_SET);
-            ftruncate(fd, fsize);
+            if (ftruncate(fd, fsize)) {} /* WUR; so pedantic */
             return 0;
         }
     }
index 88f7a56..266c9b6 100644 (file)
@@ -123,7 +123,8 @@ extern "C" {
          char pad;                                                            \
          type align;                                                          \
       } s;                                                                    \
-      return ((unsigned int) &s.align) - ((unsigned int) &s.pad);             \
+      /*return ((unsigned int) &s.align) - ((unsigned int) &s.pad);*/             \
+      return (unsigned int) ((char *) &s.align - &s.pad);                     \
    }
 
 /* this macro returns what should be the maximum alignment on this platform */
index 0767314..83d7669 100644 (file)
@@ -12,8 +12,8 @@
 #ifndef _FILE_OFFSET_BITS
 #define _FILE_OFFSET_BITS 64           /* large file support */
 #endif
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE                    /* for snprintf */
+#ifndef _DEFAULT_SOURCE
+#define _DEFAULT_SOURCE                    /* for snprintf */
 #endif
 #ifndef _POSIX_SOURCE
 #define _POSIX_SOURCE                  /* for lots of stuff */
index a54ce13..18c5bc5 100644 (file)
@@ -20,7 +20,7 @@ int test_file(FILE *fp, int argc, char **argv) {
 
     union {
         unsigned int unum;
-        unsigned char uchar[1];
+        unsigned char uchar[/*1*/sizeof(int)];
     } u;
 
     /* ensure that we aren't testing from a file */
index dd49654..8c9df79 100644 (file)
@@ -1085,7 +1085,7 @@ static int process_topic_file(FILE *fp, struct args *args, FILE *output,
                         fprintf(stderr, "failed to add to treceval results\n");
                         free(results);
                         free(querynum);
-                        free(docno);
+                        /* no; aux_buf shouldn't be freed: free(docno); */
                         free(query);
                         mlparse_wrap_delete(parser);
                         return 0;
index 2d990e4..ce73cd5 100644 (file)
@@ -96,7 +96,7 @@ int main(int argc, char **argv) {
     }
 
     /* read construction file */
-    fread(fstr, construct_len, 1, construct);
+    if (fread(fstr, construct_len, 1, construct)) {} /* WUR; so pedantic */
     replace_endl(fstr, construct_len);
 
     /* construct a hashtable from it */
@@ -123,7 +123,7 @@ int main(int argc, char **argv) {
     printf("%f seconds (%lu microseconds)\n", micros / 1000000.0, micros);
 
     /* now search using search file */
-    fread(fstr, search_len, 1, search);
+    if (fread(fstr, search_len, 1, search)) {} /* WUR; so pedantic */
     replace_endl(fstr, search_len);
 
     /* timings start */