]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Get rid of all "make check" compile warnings, except for the ones from
authorNicholas Nethercote <njn@valgrind.org>
Mon, 23 Feb 2009 06:44:51 +0000 (06:44 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Mon, 23 Feb 2009 06:44:51 +0000 (06:44 +0000)
fxtract.c.

Also, gets rid of some of the warnings that -Wextra finds in Massif.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9237

drd/tests/pth_barrier_race.c
exp-ptrcheck/tests/Makefile.am
exp-ptrcheck/tests/stackerr.c
exp-ptrcheck/tests/tricky.c
massif/ms_main.c
memcheck/tests/Makefile.am
none/tests/coolo_sigaction.cpp
none/tests/fdleak_cmsg.c
perf/Makefile.am
perf/tinycc.c

index 0c09a7bb7590a17bd3b5243b055411517c041bcc..8aee90ebfdacc6805890b24c27f497171ee2b3cb 100644 (file)
@@ -12,7 +12,7 @@
 
 #include <pthread.h>
 #include <stdlib.h>
-
+#include <unistd.h>
 
 static pthread_barrier_t* barrier;
 
index 089c95f3b7afcc993426323e98bc1604fa708288..862819bda3cc85e63272fab00cd776b7a4e90c51 100644 (file)
@@ -80,7 +80,7 @@ AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
 
 # To make it a bit more realistic, build hackedbz2.c with at 
 # least some optimisation.
-hackedbz2_CFLAGS       = $(AM_CFLAGS) -O
+hackedbz2_CFLAGS       = $(AM_CFLAGS) -O -Wno-inline
 
 # C ones
 pth_create_LDADD       = -lpthread
index 9d6e35cd520dbddd534d38045cd5f17b8aa30be0..36b8e67259aa75f333039dccdd56d0c0bf889ac0 100644 (file)
@@ -43,10 +43,11 @@ int main ( void )
   for (i = 0; i < 7+1; i++) {
      a[i] = 0;
   }
 char beforebuf[8];
{char beforebuf[8];
   char buf[8];
   char afterbuf[8];
   sprintf(buf, "%d", 123456789);
   return 1 & ((a[4] + beforea[1] + aftera[1] + beforebuf[1] 
                     + buf[2] + afterbuf[3]) / 100000) ;
+ }
 }
index 1ac8ad6c69c93aae2107030fa9a31889c9f9cdf7..624f9e4a7c637e4ec4c2753159689a4538e6e61f 100644 (file)
@@ -8,10 +8,12 @@ int main(void)
    // to zero.
    int  u[20];
    int* p = malloc(sizeof(int) * 100);
-
+   int* n;
+   int* x;
+   
    p[0] = 0;                           // ok
-   int* n = (int*)((long)p + (long)u); // result is n, because near zero!
-   int* x = (int*)((long)n - (long)u); // x == p
+   n = (int*)((long)p + (long)u);      // result is n, because near zero!
+   x = (int*)((long)n - (long)u);      // x == p
    x[0] = 0;                           // ok, originally caused false pos.
 
    return 0;
index bd8cad9a64585768d81fc7cb1ca571d250fc4544..32b6eeca782b855e1b1246e06f5d9ba26d78ada4 100644 (file)
@@ -220,8 +220,6 @@ Number of snapshots: 50
       VG_(message)(Vg_DebugMsg, "Massif: " format, ##args); \
    }
 
-
-
 //------------------------------------------------------------//
 //--- Statistics                                           ---//
 //------------------------------------------------------------//
@@ -358,7 +356,7 @@ static Bool clo_heap            = True;
    // a UInt, but this caused problems on 64-bit machines when it was
    // multiplied by a small negative number and then promoted to a
    // word-sized type -- it ended up with a value of 4.2 billion.  Sigh.
-static SizeT  clo_heap_admin      = 8;
+static SSizeT clo_heap_admin      = 8;
 static Bool   clo_stacks          = False;
 static UInt   clo_depth           = 30;
 static double clo_threshold       = 1.0;  // percentage
@@ -1262,7 +1260,7 @@ static Time get_time(void)
 // snapshot, or what kind of snapshot, are made elsewhere.
 static void
 take_snapshot(Snapshot* snapshot, SnapshotKind kind, Time time,
-              Bool is_detailed, Char* what)
+              Bool is_detailed)
 {
    tl_assert(!is_snapshot_in_use(snapshot));
    tl_assert(have_started_executing_code);
@@ -1348,7 +1346,7 @@ maybe_take_snapshot(SnapshotKind kind, Char* what)
 
    // Take the snapshot.
    snapshot = & snapshots[next_snapshot_i];
-   take_snapshot(snapshot, kind, time, is_detailed, what);
+   take_snapshot(snapshot, kind, time, is_detailed);
 
    // Record if it was detailed.
    if (is_detailed) {
@@ -1465,7 +1463,7 @@ void* new_block ( ThreadId tid, void* p, SizeT req_szB, SizeT req_alignB,
    Bool is_custom_alloc = (NULL != p);
    SizeT actual_szB, slop_szB;
 
-   if (req_szB < 0) return NULL;
+   if ((SSizeT)req_szB < 0) return NULL;
 
    // Allocate and zero if necessary
    if (!p) {
@@ -1667,7 +1665,7 @@ static void *ms_memalign ( ThreadId tid, SizeT alignB, SizeT szB )
    return new_block( tid, NULL, szB, alignB, False );
 }
 
-static void ms_free ( ThreadId tid, void* p )
+static void ms_free ( ThreadId tid __attribute__((unused)), void* p )
 {
    die_block( p, /*custom_free*/False );
 }
@@ -1687,7 +1685,7 @@ static void* ms_realloc ( ThreadId tid, void* p_old, SizeT new_szB )
    return renew_block(tid, p_old, new_szB);
 }
 
-static SizeT ms_malloc_usable_size ( ThreadId tid, void* p )                    
+static SizeT ms_malloc_usable_size ( ThreadId tid, void* p )
 {                                                            
    HP_Chunk* hc = VG_(HT_lookup)( malloc_list, (UWord)p );
 
@@ -1709,7 +1707,7 @@ static void update_stack_stats(SSizeT stack_szB_delta)
    update_alloc_stats(stack_szB_delta);
 }
 
-static INLINE void new_mem_stack_2(Addr a, SizeT len, Char* what)
+static INLINE void new_mem_stack_2(SizeT len, Char* what)
 {
    if (have_started_executing_code) {
       VERB(3, "<<< new_mem_stack (%ld)", len);
@@ -1720,7 +1718,7 @@ static INLINE void new_mem_stack_2(Addr a, SizeT len, Char* what)
    }
 }
 
-static INLINE void die_mem_stack_2(Addr a, SizeT len, Char* what)
+static INLINE void die_mem_stack_2(SizeT len, Char* what)
 {
    if (have_started_executing_code) {
       VERB(3, "<<< die_mem_stack (%ld)", -len);
@@ -1734,22 +1732,22 @@ static INLINE void die_mem_stack_2(Addr a, SizeT len, Char* what)
 
 static void new_mem_stack(Addr a, SizeT len)
 {
-   new_mem_stack_2(a, len, "stk-new");
+   new_mem_stack_2(len, "stk-new");
 }
 
 static void die_mem_stack(Addr a, SizeT len)
 {
-   die_mem_stack_2(a, len, "stk-die");
+   die_mem_stack_2(len, "stk-die");
 }
 
 static void new_mem_stack_signal(Addr a, SizeT len, ThreadId tid)
 {
-   new_mem_stack_2(a, len, "sig-new");
+   new_mem_stack_2(len, "sig-new");
 }
 
 static void die_mem_stack_signal(Addr a, SizeT len)
 {
-   die_mem_stack_2(a, len, "sig-die");
+   die_mem_stack_2(len, "sig-die");
 }
 
 
index 8d916251bb871d33aeaca48ae3160172ffe2bac1..0e6f5eb0a6e1830752c5daa5f58c026ac5b651e3 100644 (file)
@@ -226,23 +226,44 @@ check_PROGRAMS = \
        wrap1 wrap2 wrap3 wrap4 wrap5 wrap6 wrap7 wrap7so.so wrap8 \
        writev zeropage
 
+
 AM_CFLAGS   += $(AM_FLAG_M3264_PRI)
 AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
 
-# Extra stuff for C tests
+deep_templates_SOURCES = deep_templates.cpp
+deep_templates_CXXFLAGS        = $(AM_CFLAGS) -O -gstabs
+
+long_namespace_xml_SOURCES = long_namespace_xml.cpp
+
 memcmptest_CFLAGS      = $(AM_CFLAGS) -fno-builtin-memcmp
-vcpu_bz2_CFLAGS                = $(AM_CFLAGS) -O2
-vcpu_fbench_CFLAGS     = $(AM_CFLAGS) -O2
-vcpu_fnfns_CFLAGS      = $(AM_CFLAGS) -O2
-vcpu_fnfns_LDADD       = -lm
-wrap6_CFLAGS           = $(AM_CFLAGS) -O2
+
+mismatches_SOURCES     = mismatches.cpp
+
+new_nothrow_SOURCES    = new_nothrow.cpp
+new_override_SOURCES   = new_override.cpp
+
+# This requires optimisation in order to get just one resulting error.
+origin4_many_CFLAGS    = $(AM_CFLAGS) -O
+
+# Apply -O so as to run in reasonable time.
+origin5_bz2_CFLAGS     = $(AM_CFLAGS) -O -Wno-inline
+origin6_fp_CFLAGS      = $(AM_CFLAGS) -O
 
 # Don't allow GCC to inline memcpy(), because then we can't intercept it
 overlap_CFLAGS         = $(AM_CFLAGS) -fno-builtin-memcpy
+
 str_tester_CFLAGS      = $(AM_CFLAGS) -Wno-shadow
+
 supp_unknown_SOURCES   = badjump.c
 supp1_SOURCES          = supp.c
 supp2_SOURCES          = supp.c
+
+vcpu_bz2_CFLAGS                = $(AM_CFLAGS) -O2
+vcpu_fbench_CFLAGS     = $(AM_CFLAGS) -O2
+vcpu_fnfns_CFLAGS      = $(AM_CFLAGS) -O2
+vcpu_fnfns_LDADD       = -lm
+wrap6_CFLAGS           = $(AM_CFLAGS) -O2
+
 # To make it a bit more realistic, have some optimisation enabled
 # for the varinfo tests.  We still expect sane results.
 varinfo1_CFLAGS                = $(AM_CFLAGS) -O
@@ -251,19 +272,6 @@ varinfo3_CFLAGS            = $(AM_CFLAGS) -O
 varinfo4_CFLAGS                = $(AM_CFLAGS) -O
 varinfo5_CFLAGS                = $(AM_CFLAGS) -O
 varinfo6_CFLAGS                = $(AM_CFLAGS) -O
-# This requires optimisation in order to get just one resulting error.
-origin4_many_CFLAGS    = $(AM_CFLAGS) -O
-# Apply -O so as to run in reasonable time.
-origin5_bz2_CFLAGS     = $(AM_CFLAGS) -O
-origin6_fp_CFLAGS      = $(AM_CFLAGS) -O
-
-# C++ tests
-mismatches_SOURCES     = mismatches.cpp
-new_nothrow_SOURCES    = new_nothrow.cpp
-new_override_SOURCES   = new_override.cpp
-deep_templates_SOURCES = deep_templates.cpp
-long_namespace_xml_SOURCES = long_namespace_xml.cpp
-deep_templates_CXXFLAGS        = $(AM_CFLAGS) -O -gstabs
 
 if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
 if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
@@ -282,6 +290,36 @@ else
 endif
 endif
 
+# Build shared object for varinfo5
+varinfo5_SOURCES        = varinfo5.c
+varinfo5_DEPENDENCIES   = varinfo5so.so
+if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5 
+ varinfo5_LDADD         = `pwd`/varinfo5so.so
+ varinfo5_LDFLAGS       = $(AM_FLAG_M3264_PRI)
+else
+if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
+ varinfo5_LDADD         = `pwd`/varinfo5so.so
+ varinfo5_LDFLAGS       = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
+else
+ varinfo5_LDADD         = varinfo5so.so
+ varinfo5_LDFLAGS       = $(AM_FLAG_M3264_PRI) \
+                               -Wl,-rpath,$(top_builddir)/memcheck/tests
+endif
+endif
+
+varinfo5so_so_SOURCES   = varinfo5so.c
+varinfo5so_so_CFLAGS    = $(AM_CFLAGS) -fpic -O -Wno-shadow
+if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
+ varinfo5so_so_LDFLAGS  = -fpic $(AM_FLAG_M3264_PRI) -shared
+else
+if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
+ varinfo5so_so_LDFLAGS  = -fpic $(AM_FLAG_M3264_PRI) -shared \
+                               -Wl,-G -Wl,-bnogc
+else
+ varinfo5so_so_LDFLAGS  = -fpic $(AM_FLAG_M3264_PRI) -shared \
+                               -Wl,-soname -Wl,varinfo5so.so
+endif
+endif
 # Build shared object for wrap7
 wrap7_SOURCES           = wrap7.c
 wrap7_DEPENDENCIES      = wrap7so.so
@@ -300,8 +338,6 @@ endif
 endif
 
 wrap7so_so_SOURCES      = wrap7so.c
-wrap7so_so_LDADD        = 
-wrap7so_so_DEPENDENCIES = 
 wrap7so_so_CFLAGS       = $(AM_CFLAGS) -fpic
 if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
  wrap7so_so_LDFLAGS     = -fpic $(AM_FLAG_M3264_PRI) -shared
@@ -315,36 +351,4 @@ else
 endif
 endif
 
-# Build shared object for varinfo5
-varinfo5_SOURCES        = varinfo5.c
-varinfo5_DEPENDENCIES   = varinfo5so.so
-if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5 
- varinfo5_LDADD         = `pwd`/varinfo5so.so
- varinfo5_LDFLAGS       = $(AM_FLAG_M3264_PRI)
-else
-if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
- varinfo5_LDADD         = `pwd`/varinfo5so.so
- varinfo5_LDFLAGS       = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
-else
- varinfo5_LDADD         = varinfo5so.so
- varinfo5_LDFLAGS       = $(AM_FLAG_M3264_PRI) \
-                               -Wl,-rpath,$(top_builddir)/memcheck/tests
-endif
-endif
-
-varinfo5so_so_SOURCES   = varinfo5so.c
-varinfo5so_so_LDADD     = 
-varinfo5so_so_DEPENDENCIES = 
-varinfo5so_so_CFLAGS    = $(AM_CFLAGS) -fpic -O
-if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
- varinfo5so_so_LDFLAGS  = -fpic $(AM_FLAG_M3264_PRI) -shared
-else
-if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
- varinfo5so_so_LDFLAGS  = -fpic $(AM_FLAG_M3264_PRI) -shared \
-                               -Wl,-G -Wl,-bnogc
-else
- varinfo5so_so_LDFLAGS  = -fpic $(AM_FLAG_M3264_PRI) -shared \
-                               -Wl,-soname -Wl,varinfo5so.so
-endif
-endif
 
index b41938b0613189c03843397db874bde09e066602..7baa4aef4289ed46bf5533a02c25d427365947ce 100644 (file)
@@ -42,11 +42,12 @@ int main()
 {
     int i;
     char buffer[200];
+    size_t dummy_size_t;
     setupHandlers();
     FILE *p = popen("echo Hallo World", "r");
     while (!feof(p)) {
         int n = fread(buffer, 200, 1, p);
-        write(2, buffer, n);
+        dummy_size_t = write(2, buffer, n);
     }
     fclose(p);
     for (i = 0; i < 1000000; i++) ;
index 3c7db64cff152e59fa2ae32ab58e1861586c353c..a061b23fdad1755440b2a8fd0e8c00e88bf3a1ad 100644 (file)
@@ -59,7 +59,7 @@ server (void)
 
    memset(&addr, 0, sizeof(addr));
    addr.sun_family = AF_UNIX;
-   sprintf(addr.sun_path, sock);
+   sprintf(addr.sun_path, "%s", sock);
 
    unlink(addr.sun_path);
    if(bind(s, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
@@ -135,7 +135,7 @@ client (void)
    }
 
    addr.sun_family = AF_UNIX;
-   sprintf(addr.sun_path, sock);
+   sprintf(addr.sun_path, "%s", sock);
 
    do {
      count++;
index b9e2e816706b78d55818b9726fdd9282f95ee39c..9ea7d942c79aabd23f511a6e8d49ad5b35f32858 100644 (file)
@@ -23,7 +23,9 @@ AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g -O $(AM_FLAG_M3264_PRI)
 AM_CXXFLAGS = $(AM_CFLAGS)
 
 # Extra stuff
-fbench_CFLAGS   = $(AM_FLAG_M3264_PRI) -g -O2
+bz2_CFLAGS     = $(AM_CFLAGS) -Wno-inline
+
+fbench_CFLAGS   = $(AM_CFLAGS) -O2
 ffbench_LDADD  = -lm
 
-tinycc_CFLAGS  = $(AM_CFLAGS) -Wno-shadow
+tinycc_CFLAGS  = $(AM_CFLAGS) -Wno-shadow -Wno-inline
index c445b9719e81a7a48a497f2ba4998ac520fce2bf..5bef0664f8d4e214ecb8fbe27a67d9a36789b4da 100644 (file)
 
 //#endif /* !CONFIG_TCCBOOT */
 
+// Dummy variables used to avoid warnings like these: 
+// warning: ignoring return value of ‘fwrite’, declared with attribute
+//    warn_unused_result
+char* dummy_char_star;
+size_t dummy_size_t;
+
 // njn: inlined elf.h
 //#include "elf.h"
 //---------------------------------------------------------------------------
@@ -14839,7 +14845,7 @@ static int tcc_compile(TCCState *s1)
         section_sym = put_elf_sym(symtab_section, 0, 0, 
                                   ELF32_ST_INFO(STB_LOCAL, STT_SECTION), 0, 
                                   text_section->sh_num, NULL);
-        getcwd(buf, sizeof(buf));
+        dummy_char_star = getcwd(buf, sizeof(buf));
         pstrcat(buf, sizeof(buf), "/");
         put_stabs_r(buf, N_SO, 0, 0, 
                     text_section->data_offset, text_section, section_sym);
@@ -19193,7 +19199,7 @@ static void tcc_output_binary(TCCState *s1, FILE *f,
                 offset++;
             }
             size = s->sh_size;
-            fwrite(s->data, 1, size, f);
+            dummy_size_t = fwrite(s->data, 1, size, f);
             offset += size;
         }
     }
@@ -19776,8 +19782,8 @@ int tcc_output_file(TCCState *s1, const char *filename)
         ehdr.e_shnum = shnum;
         ehdr.e_shstrndx = shnum - 1;
         
-        fwrite(&ehdr, 1, sizeof(Elf32_Ehdr), f);
-        fwrite(phdr, 1, phnum * sizeof(Elf32_Phdr), f);
+        dummy_size_t = fwrite(&ehdr, 1, sizeof(Elf32_Ehdr), f);
+        dummy_size_t = fwrite(phdr, 1, phnum * sizeof(Elf32_Phdr), f);
         offset = sizeof(Elf32_Ehdr) + phnum * sizeof(Elf32_Phdr);
 
         for(i=1;i<s1->nb_sections;i++) {
@@ -19788,7 +19794,7 @@ int tcc_output_file(TCCState *s1, const char *filename)
                     offset++;
                 }
                 size = s->sh_size;
-                fwrite(s->data, 1, size, f);
+                dummy_size_t = fwrite(s->data, 1, size, f);
                 offset += size;
             }
         }
@@ -19816,7 +19822,7 @@ int tcc_output_file(TCCState *s1, const char *filename)
                 sh->sh_offset = s->sh_offset;
                 sh->sh_size = s->sh_size;
             }
-            fwrite(sh, 1, sizeof(Elf32_Shdr), f);
+            dummy_size_t = fwrite(sh, 1, sizeof(Elf32_Shdr), f);
         }
     } else {
         tcc_output_binary(s1, f, section_order);
@@ -19838,7 +19844,7 @@ static void *load_data(int fd, unsigned long file_offset, unsigned long size)
 
     data = tcc_malloc(size);
     lseek(fd, file_offset, SEEK_SET);
-    read(fd, data, size);
+    dummy_size_t = read(fd, data, size);
     return data;
 }
 
@@ -19975,7 +19981,7 @@ static int tcc_load_object_file(TCCState *s1,
             unsigned char *ptr;
             lseek(fd, file_offset + sh->sh_offset, SEEK_SET);
             ptr = section_ptr_add(s, size);
-            read(fd, ptr, size);
+            dummy_size_t = read(fd, ptr, size);
         } else {
             s->data_offset += size;
         }
@@ -20157,7 +20163,7 @@ static int tcc_load_archive(TCCState *s1, int fd)
     unsigned long file_offset;
 
     /* skip magic which was already checked */
-    read(fd, magic, sizeof(magic));
+    dummy_size_t = read(fd, magic, sizeof(magic));
     
     for(;;) {
         len = read(fd, &hdr, sizeof(hdr));
@@ -20212,7 +20218,7 @@ static int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level)
     const char *name, *soname, *p;
     DLLReference *dllref;
     
-    read(fd, &ehdr, sizeof(ehdr));
+    dummy_size_t = read(fd, &ehdr, sizeof(ehdr));
 
     /* test CPU specific stuff */
     if (ehdr.e_ident[5] != ELFDATA2LSB ||