diff options
Diffstat (limited to '')
-rw-r--r-- | arg.h | 4 | ||||
-rw-r--r-- | common.h | 16 | ||||
-rw-r--r-- | sctrace.c | 7 | ||||
-rw-r--r-- | util.c | 5 |
4 files changed, 27 insertions, 5 deletions
@@ -9,7 +9,7 @@ extern char *argv0; /* use main(int argc, char *argv[]) */ -#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\ +#define ARGBEGIN do { for (argv0 = *argv, argv++, argc--;\ argv[0] && argv[0][0] && argv[0][1];\ argc--, argv++) {\ char argc_;\ @@ -55,7 +55,7 @@ extern char *argv0; } else {\ break;\ }\ - } + } } while (0) #define ARGC() argc_ @@ -1,4 +1,5 @@ /* See LICENSE file for copyright and license details. */ +#include <asm/unistd.h> #include <sys/uio.h> #include <sys/wait.h> #include <ctype.h> @@ -12,6 +13,21 @@ #include <string.h> #include <unistd.h> +#if defined(__clang__) +# define FALL_THROUGH __attribute__((fallthrough)); +#else +# define FALL_THROUGH +#endif + +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wdisabled-macro-expansion" +# pragma clang diagnostic ignored "-Wpadded" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wpadded" +# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +# pragma GCC diagnostic ignored "-Wsuggest-attribute=format" +#endif + #if defined(__linux__) # include "linux/os.h" #else @@ -1,14 +1,12 @@ /* See LICENSE file for copyright and license details. */ #include "common.h" -#include <asm/unistd.h> - char *argv0; static unsigned long int trace_options = PTRACE_O_EXITKILL | PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEEXEC; -static void +_Noreturn static void usage(void) { fprintf(stderr, "usage: %s [-o trace-output-file] [-ft] (command | -0 command argv0) [argument] ...\n", argv0); @@ -75,6 +73,7 @@ handle_syscall(struct process *proc) case Exec: proc->silent_until_execed -= (proc->silent_until_execed == 2); + FALL_THROUGH /* fall through */ case VforkParent: if (ptrace(PTRACE_SYSCALL, proc->pid, NULL, 0)) @@ -105,6 +104,7 @@ handle_event(struct process *proc, int status) case PTRACE_EVENT_VFORK: tprintf(proc, "\nProcess stopped by vfork until child exits or exec(2)s\n"); + FALL_THROUGH /* fall through */ case PTRACE_EVENT_FORK: case PTRACE_EVENT_CLONE: @@ -198,6 +198,7 @@ main(int argc, char **argv) case 'f': trace_options |= PTRACE_O_TRACEFORK; trace_options |= PTRACE_O_TRACEVFORK; + FALL_THROUGH /* fall through */ case 't': trace_options |= PTRACE_O_TRACECLONE; @@ -2,6 +2,11 @@ #include "common.h" +#if defined(__GNUC__) || defined(__clang__) +# pragma GCC diagnostic ignored "-Wformat-nonliteral" +#endif + + static FILE *trace_fp; static char last_char = '\n'; static pid_t last_pid = 0; |