From da0c870b945ca3f86fcfd40383136cbb1c8393a7 Mon Sep 17 00:00:00 2001 From: chenrun1 Date: Thu, 4 Apr 2024 21:27:05 +0800 Subject: [PATCH] dhrystone:Add dhrystone download link Source Code:https://github.com/Keith-S-Thompson/dhrystone Signed-off-by: chenrun1 --- ...0001-dry2.2-Fix-malloc-type-mismatch.patch | 28 ++++++++ .../0002-dhrystone-fix-redefine-warning.patch | 67 +++++++++++++++++++ benchmarks/dhrystone/Makefile | 16 +++++ 3 files changed, 111 insertions(+) create mode 100644 benchmarks/dhrystone/0001-dry2.2-Fix-malloc-type-mismatch.patch create mode 100644 benchmarks/dhrystone/0002-dhrystone-fix-redefine-warning.patch diff --git a/benchmarks/dhrystone/0001-dry2.2-Fix-malloc-type-mismatch.patch b/benchmarks/dhrystone/0001-dry2.2-Fix-malloc-type-mismatch.patch new file mode 100644 index 000000000..7007764b2 --- /dev/null +++ b/benchmarks/dhrystone/0001-dry2.2-Fix-malloc-type-mismatch.patch @@ -0,0 +1,28 @@ +From b5376f06c41e9460044500b24137928c83e06244 Mon Sep 17 00:00:00 2001 +From: chenrun1 +Date: Mon, 12 Jun 2023 23:07:37 +0800 +Subject: [PATCH 1/2] dry2.2:Fix 'malloc' type mismatch + +'extern char *malloc' is a form from the early days of c that is no longer recommended in modern C implementations. This type of declaration can lead to type mismatch problems + +Signed-off-by: chenrun1 +--- + v2.2/dry.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/v2.2/dry.c b/v2.2/dry.c +index 602572a..e0fa391 100644 +--- dhrystone/v2.2/dry.c ++++ dhrystone/v2.2/dry.c +@@ -500,7 +500,7 @@ char Ch_1_Glob, + int Arr_1_Glob [50]; + int Arr_2_Glob [50] [50]; + +-extern char *malloc (); ++extern void *malloc (); + Enumeration Func_1 (); + /* forward declaration necessary since Enumeration may not simply be int */ + +-- +2.34.1 + diff --git a/benchmarks/dhrystone/0002-dhrystone-fix-redefine-warning.patch b/benchmarks/dhrystone/0002-dhrystone-fix-redefine-warning.patch new file mode 100644 index 000000000..1616abee1 --- /dev/null +++ b/benchmarks/dhrystone/0002-dhrystone-fix-redefine-warning.patch @@ -0,0 +1,67 @@ +From ed7f8720aed17febe5d802cda53b38b80d0d5164 Mon Sep 17 00:00:00 2001 +From: chenrun1 +Date: Fri, 29 Mar 2024 10:48:37 +0800 +Subject: [PATCH 2/2] dhrystone:fix redefine warning + +redefine: +dhrystone/v2.2/dry.c:458: warning: "true" redefined + 458 | #define true 1 + | +In file included from /home/crafcat7/ext2/vela/vela-dev/nuttx/include/nuttx/fs/fs.h:34, + from /home/crafcat7/ext2/vela/vela-dev/nuttx/include/stdio.h:34, + from dhrystone/v2.2/dry.c:453: +/home/crafcat7/ext2/vela/vela-dev/nuttx/include/stdbool.h:77: note: this is the location of the previous definition + 77 | # define true (bool)1 + | +dhrystone/v2.2/dry.c:459: warning: "false" redefined + +Signed-off-by: chenrun1 +--- + v2.1/dhry.h | 8 ++++++++ + v2.2/dry.c | 7 +++++++ + 2 files changed, 15 insertions(+) + +diff --git a/v2.1/dhry.h b/v2.1/dhry.h +index 404adb4..ee848d8 100644 +--- dhrystone/v2.1/dhry.h ++++ dhrystone/v2.1/dhry.h +@@ -396,8 +396,16 @@ + + #define Null 0 + /* Value of a Null pointer */ ++ ++#ifdef true ++#undef true + #define true 1 ++#endif ++ ++#ifdef false ++#undef false + #define false 0 ++#endif + + typedef int One_Thirty; + typedef int One_Fifty; +diff --git a/v2.2/dry.c b/v2.2/dry.c +index e0fa391..2994c13 100644 +--- dhrystone/v2.2/dry.c ++++ dhrystone/v2.2/dry.c +@@ -455,8 +455,15 @@ struct tms time_info; + + #define Null 0 + /* Value of a Null pointer */ ++#ifdef true ++#undef true + #define true 1 ++#endif ++ ++#ifdef false ++#undef false + #define false 0 ++#endif + + typedef int One_Thirty; + typedef int One_Fifty; +-- +2.34.1 + diff --git a/benchmarks/dhrystone/Makefile b/benchmarks/dhrystone/Makefile index 197302f35..64b90cdec 100644 --- a/benchmarks/dhrystone/Makefile +++ b/benchmarks/dhrystone/Makefile @@ -33,4 +33,20 @@ CSRCS += dhrystone/v2.1/dhry_2.c MAINSRC = dhrystone/v2.2/dry.c +ifeq ($(wildcard dhrystone/.git),) +VERSION ?= master +dhrystone.zip: + $(Q) curl -L https://github.com/Keith-S-Thompson/dhrystone/archive/refs/heads/master.zip -o dhrystone.zip + $(Q) unzip -o dhrystone.zip + $(Q) mv dhrystone-$(VERSION) dhrystone + $(Q) patch -p0 < 0001-dry2.2-Fix-malloc-type-mismatch.patch + $(Q) patch -p0 < 0002-dhrystone-fix-redefine-warning.patch + +context:: dhrystone.zip + +distclean:: + $(call DELDIR, dhrystone) + $(call DELFILE, dhrystone.zip) +endif + include $(APPDIR)/Application.mk