[Buildroot] [PATCH] package/dhrystone: Fix function definitions

Charlie Jenkins charlie at rivosinc.com
Fri Apr 4 21:33:39 UTC 2025


GCC-15 requires function definitions to have proper arguments. Add them
to dhrystone.

Signed-off-by: Charlie Jenkins <charlie at rivosinc.com>
---
GCC-15 hasn't been released yet but I was starting to look at what needs
to be done to run Buildroot. Here's a patch to fix dhrystone.
---
 .../0007-Fix-function-definitions-for-gcc15.patch  | 210 +++++++++++++++++++++
 1 file changed, 210 insertions(+)

diff --git a/package/dhrystone/0007-Fix-function-definitions-for-gcc15.patch b/package/dhrystone/0007-Fix-function-definitions-for-gcc15.patch
new file mode 100644
index 0000000000000000000000000000000000000000..6aa569b7b2e99464eda4008a058a65550a9dd4ca
--- /dev/null
+++ b/package/dhrystone/0007-Fix-function-definitions-for-gcc15.patch
@@ -0,0 +1,210 @@
+From b929daf9a5d61d8581e04b0a0c27252d3fe7b7a9 Mon Sep 17 00:00:00 2001
+From: Charlie Jenkins <charlie at rivosinc.com>
+Date: Fri, 4 Apr 2025 14:22:35 -0700
+Subject: [PATCH] Fix function definitions for gcc15
+
+Correct function declarations to contain args.
+
+Fixes:
+
+dhry_1.c:176:19: error: too many arguments to function 'Func_2'; expected 0, have 2
+  176 |     Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
+      |                   ^~~~~~  ~~~~~~~~~
+dhry_1.c:35:17: note: declared here
+   35 | Boolean         Func_2 ();
+      |                 ^~~~~~
+dhry_1.c:182:7: error: too many arguments to function 'Proc_7'; expected 0, have 3
+  182 |       Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
+      |       ^~~~~~  ~~~~~~~~~
+
+Upstream: dead
+Signed-off-by: Charlie Jenkins <charlie at rivosinc.com>
+---
+ dhry_1.c | 26 +++++++++++---------------
+ dhry_2.c | 30 +++++++-----------------------
+ 2 files changed, 18 insertions(+), 38 deletions(-)
+
+diff --git a/dhry_1.c b/dhry_1.c
+index cad5840..b02ff08 100644
+--- a/dhry_1.c
++++ b/dhry_1.c
+@@ -31,8 +31,8 @@ int             Arr_2_Glob [50] [50];
+ #ifndef NO_PROTOTYPES
+ extern char     *malloc ();
+ #endif
+-Enumeration     Func_1 ();
+-Boolean         Func_2 ();
++Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val);
++Boolean Func_2 (Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref);
+   /* forward declaration necessary since Enumeration may not simply be int */
+ 
+ #ifndef REG
+@@ -73,14 +73,14 @@ float           Microseconds,
+ /* end of variables for time measurement */
+ 
+ /* forward declarations */
+-void Proc_1 ();
+-void Proc_2 ();
+-void Proc_3 ();
++void Proc_1 (REG Rec_Pointer Ptr_Val_Par);
++void Proc_2 (One_Fifty *Int_Par_Ref);
++void Proc_3 (Rec_Pointer *Ptr_Ref_Par);
+ void Proc_4 ();
+ void Proc_5 ();
+-void Proc_6 ();
+-void Proc_7 ();
+-void Proc_8 ();
++void Proc_6 (Enumeration  Enum_Val_Par, Enumeration *Enum_Ref_Par);
++void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, One_Fifty *Int_Par_Ref);
++void Proc_8 (Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref, int Int_1_Par_Val, int Int_2_Par_Val);
+ 
+ int main(int argc, char *argv[])
+ /*****/
+@@ -305,10 +305,9 @@ int main(int argc, char *argv[])
+ }
+ 
+ 
+-void Proc_1 (Ptr_Val_Par)
++void Proc_1 (REG Rec_Pointer Ptr_Val_Par)
+ /******************/
+ 
+-REG Rec_Pointer Ptr_Val_Par;
+     /* executed once */
+ {
+   REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;  
+@@ -339,12 +338,11 @@ REG Rec_Pointer Ptr_Val_Par;
+ } /* Proc_1 */
+ 
+ 
+-void Proc_2 (Int_Par_Ref)
++void Proc_2 (One_Fifty   *Int_Par_Ref)
+ /******************/
+     /* executed once */
+     /* *Int_Par_Ref == 1, becomes 4 */
+ 
+-One_Fifty   *Int_Par_Ref;
+ {
+   One_Fifty  Int_Loc;  
+   Enumeration   Enum_Loc;
+@@ -362,13 +360,11 @@ One_Fifty   *Int_Par_Ref;
+ } /* Proc_2 */
+ 
+ 
+-void Proc_3 (Ptr_Ref_Par)
++void Proc_3 (Rec_Pointer *Ptr_Ref_Par)
+ /******************/
+     /* executed once */
+     /* Ptr_Ref_Par becomes Ptr_Glob */
+ 
+-Rec_Pointer *Ptr_Ref_Par;
+-
+ {
+   if (Ptr_Glob != Null)
+     /* then, executed */
+diff --git a/dhry_2.c b/dhry_2.c
+index 25051e7..b1c9d8f 100644
+--- a/dhry_2.c
++++ b/dhry_2.c
+@@ -26,15 +26,13 @@
+ extern  int     Int_Glob;
+ extern  char    Ch_1_Glob;
+ 
+-Boolean Func_3 ();
++Boolean Func_3 (Enumeration Enum_Par_Val);
+ 
+-void Proc_6 (Enum_Val_Par, Enum_Ref_Par)
++void Proc_6 (Enumeration  Enum_Val_Par, Enumeration *Enum_Ref_Par)
+ /*********************************/
+     /* executed once */
+     /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
+ 
+-Enumeration  Enum_Val_Par;
+-Enumeration *Enum_Ref_Par;
+ {
+   *Enum_Ref_Par = Enum_Val_Par;
+   if (! Func_3 (Enum_Val_Par))
+@@ -62,7 +60,7 @@ Enumeration *Enum_Ref_Par;
+ } /* Proc_6 */
+ 
+ 
+-void Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
++void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, One_Fifty *Int_Par_Ref)
+ /**********************************************/
+     /* executed three times                                      */ 
+     /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
+@@ -71,9 +69,6 @@ void Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
+     /*                  Int_Par_Ref becomes 17                   */
+     /* third call:      Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
+     /*                  Int_Par_Ref becomes 18                   */
+-One_Fifty       Int_1_Par_Val;
+-One_Fifty       Int_2_Par_Val;
+-One_Fifty      *Int_Par_Ref;
+ {
+   One_Fifty Int_Loc;
+ 
+@@ -82,15 +77,11 @@ One_Fifty      *Int_Par_Ref;
+ } /* Proc_7 */
+ 
+ 
+-void Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
++void Proc_8 (Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref, int Int_1_Par_Val, int Int_2_Par_Val)
+ /*********************************************************************/
+     /* executed once      */
+     /* Int_Par_Val_1 == 3 */
+     /* Int_Par_Val_2 == 7 */
+-Arr_1_Dim       Arr_1_Par_Ref;
+-Arr_2_Dim       Arr_2_Par_Ref;
+-int             Int_1_Par_Val;
+-int             Int_2_Par_Val;
+ {
+   REG One_Fifty Int_Index;
+   REG One_Fifty Int_Loc;
+@@ -107,15 +98,12 @@ int             Int_2_Par_Val;
+ } /* Proc_8 */
+ 
+ 
+-Enumeration Func_1 (Ch_1_Par_Val, Ch_2_Par_Val)
++Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val)
+ /*************************************************/
+     /* executed three times                                         */
+     /* first call:      Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R'    */
+     /* second call:     Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C'    */
+     /* third call:      Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C'    */
+-
+-Capital_Letter   Ch_1_Par_Val;
+-Capital_Letter   Ch_2_Par_Val;
+ {
+   Capital_Letter        Ch_1_Loc;
+   Capital_Letter        Ch_2_Loc;
+@@ -133,14 +121,11 @@ Capital_Letter   Ch_2_Par_Val;
+ } /* Func_1 */
+ 
+ 
+-Boolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref)
++Boolean Func_2 (Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref)
+ /*************************************************/
+     /* executed once */
+     /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
+     /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
+-
+-Str_30  Str_1_Par_Ref;
+-Str_30  Str_2_Par_Ref;
+ {
+   REG One_Thirty        Int_Loc;
+       Capital_Letter    Ch_Loc;
+@@ -175,11 +160,10 @@ Str_30  Str_2_Par_Ref;
+ } /* Func_2 */
+ 
+ 
+-Boolean Func_3 (Enum_Par_Val)
++Boolean Func_3 (Enumeration Enum_Par_Val)
+ /***************************/
+     /* executed once        */
+     /* Enum_Par_Val == Ident_3 */
+-Enumeration Enum_Par_Val;
+ {
+   Enumeration Enum_Loc;
+ 
+-- 
+2.43.0
+

---
base-commit: a3b4ae2eaca9791c7c184e49a04a348dd35185c3
change-id: 20250404-dhrystone_gcc15-e7e163403423
-- 
- Charlie



More information about the buildroot mailing list