[LTP] [PATCH v2] Remove cleanup.c inclusion from syscalls generation
Andrea Cervesato
andrea.cervesato@suse.de
Tue Sep 10 10:55:54 CEST 2024
From: Andrea Cervesato <andrea.cervesato@suse.com>
Remove cleanup.c from syscalls.h as it is part of the old library and
its usage is discouraged. LSP(s) supporting C language correctly flag
this file as problematic. This patch ensures that the lapi/syscalls/regen.sh
script will no longer include cleanup.c, preventing unnecessary usage in
generated headers.
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
Changes in v2:
- delete cleanup.c
- use "inline static" for dummy cleanup
- Link to v1: https://lore.kernel.org/r/20240909-regen_shutup_lsp-v1-1-d65ad07b822f@suse.com
---
include/lapi/syscalls/regen.sh | 5 +++--
include/old/cleanup.c | 47 ------------------------------------------
2 files changed, 3 insertions(+), 49 deletions(-)
diff --git a/include/lapi/syscalls/regen.sh b/include/lapi/syscalls/regen.sh
index 97027e2f3..663ce4458 100755
--- a/include/lapi/syscalls/regen.sh
+++ b/include/lapi/syscalls/regen.sh
@@ -33,7 +33,6 @@ cat << EOF > "${output_pid}"
#include <errno.h>
#include <sys/syscall.h>
#include <asm/unistd.h>
-#include "cleanup.c"
#ifdef TST_TEST_H__
#define TST_SYSCALL_BRK__(NR, SNR) ({ \\
@@ -41,8 +40,10 @@ cat << EOF > "${output_pid}"
"syscall(%d) " SNR " not supported on your arch", NR); \\
})
#else
+inline static void dummy_cleanup(void) {}
+
#define TST_SYSCALL_BRK__(NR, SNR) ({ \\
- tst_brkm(TCONF, CLEANUP, \\
+ tst_brkm(TCONF, dummy_cleanup, \\
"syscall(%d) " SNR " not supported on your arch", NR); \\
})
#endif
diff --git a/include/old/cleanup.c b/include/old/cleanup.c
deleted file mode 100644
index 040dff852..000000000
--- a/include/old/cleanup.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Default cleanup logic because linux_syscall_numbers.h's need for cleanup
- * and binutils bugs suck.
- *
- * Copyright (c) 2009 Cisco Systems, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-#ifndef __CLEANUP_C__
-#define __CLEANUP_C__
-
-/* Did the user define a cleanup function? */
-#ifndef CLEANUP
-#define USING_DUMMY_CLEANUP 1
-#define CLEANUP dummy_cleanup
-#endif
-
-/* A freebie for defining the function prototype. */
-static void CLEANUP(void) __attribute__ ((unused));
-
-#ifdef USING_DUMMY_CLEANUP
-/* The stub function. Wewt.. */
-static void dummy_cleanup(void)
-{
-}
-#endif
-
-#endif
---
base-commit: cc9730eae07446e9d083219c112b0512892d16da
change-id: 20240909-regen_shutup_lsp-a35606a887b6
Best regards,
--
Andrea Cervesato <andrea.cervesato@suse.com>
More information about the ltp
mailing list