mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
Get rid of all "make check" compile warnings, except for the ones from
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
This commit is contained in:
parent
6ddf479d41
commit
2ae89cee5d
@ -12,7 +12,7 @@
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
static pthread_barrier_t* barrier;
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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) ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
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
|
||||
|
||||
# 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
|
||||
# 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,39 +290,6 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
# Build shared object for wrap7
|
||||
wrap7_SOURCES = wrap7.c
|
||||
wrap7_DEPENDENCIES = wrap7so.so
|
||||
if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
|
||||
wrap7_LDADD = `pwd`/wrap7so.so
|
||||
wrap7_LDFLAGS = $(AM_FLAG_M3264_PRI)
|
||||
else
|
||||
if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
|
||||
wrap7_LDADD = `pwd`/wrap7so.so
|
||||
wrap7_LDFLAGS = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
|
||||
else
|
||||
wrap7_LDADD = wrap7so.so
|
||||
wrap7_LDFLAGS = $(AM_FLAG_M3264_PRI) \
|
||||
-Wl,-rpath,$(top_builddir)/memcheck/tests
|
||||
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
|
||||
else
|
||||
if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
|
||||
wrap7so_so_LDFLAGS = -fpic $(AM_FLAG_M3264_PRI) -shared \
|
||||
-Wl,-G -Wl,-bnogc
|
||||
else
|
||||
wrap7so_so_LDFLAGS = -fpic $(AM_FLAG_M3264_PRI) -shared \
|
||||
-Wl,-soname -Wl,wrap7so.so
|
||||
endif
|
||||
endif
|
||||
|
||||
# Build shared object for varinfo5
|
||||
varinfo5_SOURCES = varinfo5.c
|
||||
varinfo5_DEPENDENCIES = varinfo5so.so
|
||||
@ -333,9 +308,7 @@ endif
|
||||
endif
|
||||
|
||||
varinfo5so_so_SOURCES = varinfo5so.c
|
||||
varinfo5so_so_LDADD =
|
||||
varinfo5so_so_DEPENDENCIES =
|
||||
varinfo5so_so_CFLAGS = $(AM_CFLAGS) -fpic -O
|
||||
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
|
||||
@ -347,4 +320,35 @@ else
|
||||
-Wl,-soname -Wl,varinfo5so.so
|
||||
endif
|
||||
endif
|
||||
# Build shared object for wrap7
|
||||
wrap7_SOURCES = wrap7.c
|
||||
wrap7_DEPENDENCIES = wrap7so.so
|
||||
if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
|
||||
wrap7_LDADD = `pwd`/wrap7so.so
|
||||
wrap7_LDFLAGS = $(AM_FLAG_M3264_PRI)
|
||||
else
|
||||
if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
|
||||
wrap7_LDADD = `pwd`/wrap7so.so
|
||||
wrap7_LDFLAGS = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
|
||||
else
|
||||
wrap7_LDADD = wrap7so.so
|
||||
wrap7_LDFLAGS = $(AM_FLAG_M3264_PRI) \
|
||||
-Wl,-rpath,$(top_builddir)/memcheck/tests
|
||||
endif
|
||||
endif
|
||||
|
||||
wrap7so_so_SOURCES = wrap7so.c
|
||||
wrap7so_so_CFLAGS = $(AM_CFLAGS) -fpic
|
||||
if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
|
||||
wrap7so_so_LDFLAGS = -fpic $(AM_FLAG_M3264_PRI) -shared
|
||||
else
|
||||
if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
|
||||
wrap7so_so_LDFLAGS = -fpic $(AM_FLAG_M3264_PRI) -shared \
|
||||
-Wl,-G -Wl,-bnogc
|
||||
else
|
||||
wrap7so_so_LDFLAGS = -fpic $(AM_FLAG_M3264_PRI) -shared \
|
||||
-Wl,-soname -Wl,wrap7so.so
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@ -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++) ;
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -59,6 +59,12 @@
|
||||
|
||||
//#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 ||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user