dhrystone:Add dhrystone download link

Source Code:https://github.com/Keith-S-Thompson/dhrystone

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
chenrun1 2024-04-04 21:27:05 +08:00 committed by Xiang Xiao
parent e9172a3195
commit da0c870b94
3 changed files with 111 additions and 0 deletions

View File

@ -0,0 +1,28 @@
From b5376f06c41e9460044500b24137928c83e06244 Mon Sep 17 00:00:00 2001
From: chenrun1 <chenrun1@xiaomi.com>
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 <chenrun1@xiaomi.com>
---
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

View File

@ -0,0 +1,67 @@
From ed7f8720aed17febe5d802cda53b38b80d0d5164 Mon Sep 17 00:00:00 2001
From: chenrun1 <chenrun1@xiaomi.com>
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 <chenrun1@xiaomi.com>
---
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

View File

@ -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