Get rid of dead code and/or localise global functions as needed to
avoid warnings from -fwarn-missing-prototypes. vg_replace_malloc.c
has not been done yet though.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3298 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/stage1.c b/coregrind/stage1.c
index 247912c..4864855 100644
--- a/coregrind/stage1.c
+++ b/coregrind/stage1.c
@@ -204,6 +204,7 @@
}
// Choose a name for the padfile, open it.
+static
int as_openpadfile(void)
{
char buf[256];
@@ -223,6 +224,7 @@
}
// Pad all the empty spaces in a range of address space to stop interlopers.
+static
void as_pad(void *start, void *end, int padfile)
{
fillgap_extra extra;
diff --git a/coregrind/ume.c b/coregrind/ume.c
index f69ecdc..3e96c58 100644
--- a/coregrind/ume.c
+++ b/coregrind/ume.c
@@ -142,6 +142,7 @@
/*--- Loading ELF files ---*/
/*------------------------------------------------------------*/
+static
struct elfinfo *readelf(int fd, const char *filename)
{
struct elfinfo *e = malloc(sizeof(*e));
@@ -197,6 +198,7 @@
}
/* Map an ELF file. Returns the brk address. */
+static
ESZ(Addr) mapelf(struct elfinfo *e, ESZ(Addr) base)
{
int i;
diff --git a/coregrind/vg_execontext.c b/coregrind/vg_execontext.c
index 2940090..ff1545d 100644
--- a/coregrind/vg_execontext.c
+++ b/coregrind/vg_execontext.c
@@ -309,6 +309,7 @@
return new_ec;
}
+static
void get_needed_regs(ThreadId tid, Addr* ip, Addr* fp, Addr* sp,
Addr* stack_highest_word)
{
@@ -371,14 +372,6 @@
return INSTR_PTR(VG_(threads)[ tid ].arch);
}
-Addr VG_(get_thread_stack_pointer) ( ThreadId tid )
-{
- Addr ret;
-
- ret = STACK_PTR(VG_(threads)[ tid ].arch);
-
- return ret;
-}
/*--------------------------------------------------------------------*/
/*--- end ---*/
diff --git a/coregrind/vg_intercept.c b/coregrind/vg_intercept.c
index 1e77c44..5ca136e 100644
--- a/coregrind/vg_intercept.c
+++ b/coregrind/vg_intercept.c
@@ -47,6 +47,7 @@
Hook for running __libc_freeres once the program exits.
------------------------------------------------------------------ */
+void VG_WRAPPER(freeres)( void );
void VG_WRAPPER(freeres)( void )
{
int res;
diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c
index 3776954..d49d966 100644
--- a/coregrind/vg_main.c
+++ b/coregrind/vg_main.c
@@ -324,11 +324,6 @@
return STACK_PTR( VG_(threads)[tid].arch );
}
-/* Debugging thing .. can be called from assembly with OYNK macro. */
-void VG_(oynk) ( Int n )
-{
- OINK(n);
-}
/*====================================================================*/
/*=== Check we were launched by stage 1 ===*/
@@ -1384,7 +1379,7 @@
}
// Remove padding of 'padfile' from a range of address space.
-void as_unpad(void *start, void *end, int padfile)
+static void as_unpad(void *start, void *end, int padfile)
{
static struct stat padstat;
killpad_extra extra;
@@ -1400,7 +1395,7 @@
foreach_map(killpad, &extra);
}
-void as_closepadfile(int padfile)
+static void as_closepadfile(int padfile)
{
int res = close(padfile);
vg_assert(0 == res);
@@ -1458,7 +1453,7 @@
static Bool VG_(clo_wait_for_gdb) = False;
-void usage ( Bool debug_help )
+static void usage ( Bool debug_help )
{
Char* usage1 =
"usage: valgrind --tool=<toolname> [options] prog-and-args\n"
diff --git a/coregrind/vg_messages.c b/coregrind/vg_messages.c
index a971324..59d3183 100644
--- a/coregrind/vg_messages.c
+++ b/coregrind/vg_messages.c
@@ -64,7 +64,7 @@
return;
}
-int add_to_msg ( const Char *format, ... )
+static int add_to_msg ( const Char *format, ... )
{
int count;
va_list vargs;
@@ -74,7 +74,7 @@
return count;
}
-int start_msg ( VgMsgKind kind )
+static int start_msg ( VgMsgKind kind )
{
Char ts[32];
Char c;
@@ -101,6 +101,7 @@
c,c, ts, VG_(getpid)(), c,c );
}
+static
int end_msg ( void )
{
int count = 0;
diff --git a/coregrind/vg_pthreadmodel.c b/coregrind/vg_pthreadmodel.c
index 8748f0c..b1bcc49 100644
--- a/coregrind/vg_pthreadmodel.c
+++ b/coregrind/vg_pthreadmodel.c
@@ -577,12 +577,11 @@
#else /* !0 */
/* Stubs for now */
-
-void VG_(pthread_init)()
-{
-}
-
-void VG_(pthread_startfunc_wrapper)(Addr wrapper)
-{
-}
+//:: void VG_(pthread_init)()
+//:: {
+//:: }
+//::
+//:: void VG_(pthread_startfunc_wrapper)(Addr wrapper)
+//:: {
+//:: }
#endif /* 0 */
diff --git a/coregrind/vg_signals.c b/coregrind/vg_signals.c
index 412a854..bdc8c35 100644
--- a/coregrind/vg_signals.c
+++ b/coregrind/vg_signals.c
@@ -755,6 +755,7 @@
/* Set up a stack frame (VgSigContext) for the client's signal
handler. */
+static
void vg_push_signal_frame ( ThreadId tid, const vki_siginfo_t *siginfo )
{
Addr esp_top_of_frame;
@@ -1537,6 +1538,7 @@
tid==0 means add it to the process-wide queue, and not sent it to a
specific thread.
*/
+static
void queue_signal(ThreadId tid, const vki_siginfo_t *si)
{
ThreadState *tst;
diff --git a/coregrind/vg_skiplist.c b/coregrind/vg_skiplist.c
index 2ca3db5..a117a01 100644
--- a/coregrind/vg_skiplist.c
+++ b/coregrind/vg_skiplist.c
@@ -450,17 +450,6 @@
return data_of_node(l, n);
}
-void VG_(SkipList_for_each_node)(const SkipList *l,
- void (*fn)(void *node, void *arg), void *arg)
-{
- void *n;
-
- for(n = VG_(SkipNode_First)(l);
- n != NULL;
- n = VG_(SkipNode_Next)(l, n))
- (*fn)(n, arg);
-}
-
/* --------------------------------------------------
Comparison functions
diff --git a/coregrind/vg_symtypes.c b/coregrind/vg_symtypes.c
index b0e386a..8e9d079 100644
--- a/coregrind/vg_symtypes.c
+++ b/coregrind/vg_symtypes.c
@@ -748,7 +748,7 @@
Bool keep = False;
/* Add a new variable to the list */
- void newvar(Char *name, SymType *ty, Addr valuep, UInt size) {
+ static void newvar(Char *name, SymType *ty, Addr valuep, UInt size) {
Variable *v;
/* have we been here before? */
@@ -968,7 +968,7 @@
Char expr[len*2];
Char *sp = &expr[len]; /* pointer at start of string */
Char *ep = sp; /* pointer at end of string */
- void genstring(Variable *v, Variable *inner) {
+ static void genstring(Variable *v, Variable *inner) {
Variable *c = v->container;
if (c != NULL)