Conditionally optimize out unused code
* syscall.c (internal_syscall): Call internal_exec only if
SUNOS4 || (LINUX && TCB_WAITEXECVE).
* process.c (internal_exec): Define this function only if
SUNOS4 || (LINUX && TCB_WAITEXECVE).
(printwaitn): Don't check wordsize if SUPPORTED_PERSONALITIES == 1.
* signal.c (sys_kill): Likewise.
* syscall.c (is_negated_errno): Likewise.
(trace_syscall_exiting): Fold a tprintf into tprintfs which follow it.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
diff --git a/process.c b/process.c
index 12b8720..aba2f56 100644
--- a/process.c
+++ b/process.c
@@ -1581,14 +1581,15 @@
#endif
+#if defined SUNOS4 || (defined LINUX && defined TCB_WAITEXECVE)
int
internal_exec(struct tcb *tcp)
{
-#ifdef SUNOS4
+# if defined SUNOS4
if (exiting(tcp) && !syserror(tcp) && followfork)
fixvfork(tcp);
-#endif /* SUNOS4 */
-#if defined LINUX && defined TCB_WAITEXECVE
+# endif
+# if defined LINUX && defined TCB_WAITEXECVE
if (exiting(tcp) && syserror(tcp))
tcp->flags &= ~TCB_WAITEXECVE;
else {
@@ -1596,9 +1597,10 @@
if (!(ptrace_setoptions & PTRACE_O_TRACEEXEC))
tcp->flags |= TCB_WAITEXECVE; /* no */
}
-#endif /* LINUX && TCB_WAITEXECVE */
+# endif
return 0;
}
+#endif
#ifdef LINUX
#ifndef __WNOTHREAD
@@ -1721,12 +1723,12 @@
int pid = tcp->u_arg[0];
tprintf("%d, ", pid);
#else
- /*
- * Sign-extend a 32-bit value when that's what it is.
- */
long pid = tcp->u_arg[0];
+# if SUPPORTED_PERSONALITIES > 1
+ /* Sign-extend a 32-bit value when that's what it is. */
if (personality_wordsize[current_personality] < sizeof pid)
pid = (long) (int) pid;
+# endif
tprintf("%ld, ", pid);
#endif
} else {