From: Tarun Sahu <tsahu@linux.ibm.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] hugepage15: Resolve compile time warning generating with -O0
Date: Mon, 13 Feb 2023 20:56:55 +0530 [thread overview]
Message-ID: <20230213152655.64295-1-tsahu@linux.ibm.com> (raw)
In-Reply-To: <20230125222703.19943-2-pvorel@suse.cz>
Instead of turning off the optimizaton with -O0 to resolve unwanted
behaviour of clang with goto statements, this will make use of clang
pragma to turn off the optimization for just clang compiler. This way,
gcc won't throw unwanted warning on turning off optimization:
"warning: _FORTIFY_SOURCE requires compiling with optimization (-O)".
Also, removed redundant header-includes.
Reported-by: Petr Vorel <pvorel@suse.cz>
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Tarun Sahu <tsahu@linux.ibm.com>
---
v2:
- rebase and added Reviewed-by
testcases/kernel/mem/hugetlb/hugemmap/Makefile | 1 -
testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 13 ++++---------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/Makefile b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
index 6f10807cd..2d651b4aa 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/Makefile
+++ b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
@@ -8,5 +8,4 @@ include $(top_srcdir)/include/mk/testcases.mk
include $(abs_srcdir)/../Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
-hugemmap15: CFLAGS+=-O0
hugemmap06: CFLAGS+=-pthread
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
index 07e65a160..4d1984070 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
@@ -19,6 +19,10 @@
* remap, or because the icache happens to get flushed in the interim.
*/
+#if defined(__clang__)
+ #pragma clang optimize off
+#endif
+
#define _GNU_SOURCE
#include "hugetlb.h"
@@ -27,16 +31,7 @@
defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64) || \
defined(__i386__) || defined(__x86_64__) || defined(__arm__)
-#include <stdio.h>
-#include <stdlib.h>
#include <setjmp.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/mman.h>
-#include <ucontext.h>
-#include <limits.h>
-#include <sys/param.h>
-#include <sys/types.h>
#define SUCC_JMP 1
#define FAIL_JMP 2
--
2.31.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-02-13 15:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-25 22:27 [LTP] [PATCH 0/2] hugemmap15 pre-release testing Petr Vorel
2023-01-25 22:27 ` [LTP] [PATCH 1/2] hugemmap15: Compile with -O Petr Vorel
2023-01-26 21:05 ` Tarun Sahu
2023-01-26 23:00 ` Petr Vorel
2023-01-26 23:38 ` Tarun Sahu
2023-01-27 8:28 ` Petr Vorel
2023-01-27 9:20 ` Cyril Hrubis
2023-02-10 22:04 ` Tarun Sahu
2023-02-10 22:33 ` [LTP] [PATCH] hugepage15: Resolve compile time warning generating with -O0 Tarun Sahu
2023-02-12 21:34 ` Petr Vorel
2023-02-13 15:29 ` Tarun Sahu
2023-02-13 15:26 ` Tarun Sahu [this message]
2023-02-13 17:26 ` [LTP] [PATCH v2] " Petr Vorel
2023-01-25 22:27 ` [LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs Petr Vorel
2023-01-26 10:35 ` Cyril Hrubis
2023-01-26 10:36 ` Petr Vorel
2023-01-26 17:55 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230213152655.64295-1-tsahu@linux.ibm.com \
--to=tsahu@linux.ibm.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox