From 4b466e92a2d9f76ce1082cde982c7be0be91e248 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 23 May 2022 13:39:03 +0000 Subject: [PATCH] Fix GCC declaration-after-statement error Since upgrading to Linux v5.18 in Nixpkgs, we've been seeing an "ISO C90 forbids mixed declarations and code" error from GCC. This patch fixes it by initializing regs as part of its declaration, meaning hook will no longer be declared after a statement. Signed-off-by: Alyssa Ross --- src/ftrace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ftrace.c b/src/ftrace.c index 7eed223..92cba2d 100644 --- a/src/ftrace.c +++ b/src/ftrace.c @@ -55,8 +55,7 @@ static void notrace fh_trace_thunk(unsigned long ip, unsigned long parent_ip, st #else static void notrace fh_trace_thunk(unsigned long ip, unsigned long parent_ip, struct ftrace_ops *ops, struct ftrace_regs *fregs) { - struct pt_regs *regs; - regs = ftrace_get_regs(fregs); + struct pt_regs *regs = ftrace_get_regs(fregs); #endif struct ftrace_hook *hook = to_ftrace_hook(ops);