Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] dhrystone: add patch with forward declarations for functions
@ 2024-06-27 10:34 Steffen Persvold
  2024-07-15  9:28 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Steffen Persvold @ 2024-06-27 10:34 UTC (permalink / raw)
  To: buildroot; +Cc: Steffen Persvold

GCC14 will give errors for missing function declarations and
missing return types :

dhry_1.c:75:1: error: return type defaults to ‘int’ [-Wimplicit-int]
   75 | main(int argc, char *argv[])
      | ^~~~
dhry_1.c: In function ‘main’:
dhry_1.c:159:5: error: implicit declaration of function ‘Proc_5’ [-Wimplicit-function-declaration]
  159 |     Proc_5();
      |     ^~~~~~

Signed-off-by: Steffen Persvold <spersvold@gmail.com>
---
 package/dhrystone/0006-fwd-decl.patch | 121 ++++++++++++++++++++++++++
 1 file changed, 121 insertions(+)
 create mode 100644 package/dhrystone/0006-fwd-decl.patch

diff --git a/package/dhrystone/0006-fwd-decl.patch b/package/dhrystone/0006-fwd-decl.patch
new file mode 100644
index 00000000..830a704c
--- /dev/null
+++ b/package/dhrystone/0006-fwd-decl.patch
@@ -0,0 +1,121 @@
+diff --git a/dhry_1.c b/dhry_1.c
+index 3ed1716b..61c3d908 100644
+--- a/dhry_1.c
++++ b/dhry_1.c
+@@ -32,6 +32,7 @@ int             Arr_2_Glob [50] [50];
+ extern char     *malloc ();
+ #endif
+ Enumeration     Func_1 ();
++Boolean         Func_2 ();
+   /* forward declaration necessary since Enumeration may not simply be int */
+ 
+ #ifndef REG
+@@ -71,8 +72,17 @@ float           Microseconds,
+ 
+ /* end of variables for time measurement */
+ 
+-
+-main(int argc, char *argv[])
++/* forward declarations */
++void Proc_1 ();
++void Proc_2 ();
++void Proc_3 ();
++void Proc_4 ();
++void Proc_5 ();
++void Proc_6 ();
++void Proc_7 ();
++void Proc_8 ();
++
++int main(int argc, char *argv[])
+ /*****/
+ 
+   /* main program, corresponds to procedures        */
+@@ -295,7 +305,7 @@ main(int argc, char *argv[])
+ }
+ 
+ 
+-Proc_1 (Ptr_Val_Par)
++void Proc_1 (Ptr_Val_Par)
+ /******************/
+ 
+ REG Rec_Pointer Ptr_Val_Par;
+@@ -329,7 +339,7 @@ REG Rec_Pointer Ptr_Val_Par;
+ } /* Proc_1 */
+ 
+ 
+-Proc_2 (Int_Par_Ref)
++void Proc_2 (Int_Par_Ref)
+ /******************/
+     /* executed once */
+     /* *Int_Par_Ref == 1, becomes 4 */
+@@ -352,7 +362,7 @@ One_Fifty   *Int_Par_Ref;
+ } /* Proc_2 */
+ 
+ 
+-Proc_3 (Ptr_Ref_Par)
++void Proc_3 (Ptr_Ref_Par)
+ /******************/
+     /* executed once */
+     /* Ptr_Ref_Par becomes Ptr_Glob */
+@@ -367,7 +377,7 @@ Rec_Pointer *Ptr_Ref_Par;
+ } /* Proc_3 */
+ 
+ 
+-Proc_4 () /* without parameters */
++void Proc_4 () /* without parameters */
+ /*******/
+     /* executed once */
+ {
+@@ -379,7 +389,7 @@ Proc_4 () /* without parameters */
+ } /* Proc_4 */
+ 
+ 
+-Proc_5 () /* without parameters */
++void Proc_5 () /* without parameters */
+ /*******/
+     /* executed once */
+ {
+@@ -399,5 +409,3 @@ register int    l;
+         while (l--) *d++ = *s++;
+ }
+ #endif
+-
+-
+diff --git a/dhry_2.c b/dhry_2.c
+index 63a3d3ea..23486c6c 100644
+--- a/dhry_2.c
++++ b/dhry_2.c
+@@ -26,8 +26,9 @@
+ extern  int     Int_Glob;
+ extern  char    Ch_1_Glob;
+ 
++Boolean Func_3 ();
+ 
+-Proc_6 (Enum_Val_Par, Enum_Ref_Par)
++void Proc_6 (Enum_Val_Par, Enum_Ref_Par)
+ /*********************************/
+     /* executed once */
+     /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
+@@ -61,7 +62,7 @@ Enumeration *Enum_Ref_Par;
+ } /* Proc_6 */
+ 
+ 
+-Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
++void Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
+ /**********************************************/
+     /* executed three times                                      */
+     /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
+@@ -81,7 +82,7 @@ One_Fifty      *Int_Par_Ref;
+ } /* Proc_7 */
+ 
+ 
+-Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
++void Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
+ /*********************************************************************/
+     /* executed once      */
+     /* Int_Par_Val_1 == 3 */
+@@ -189,4 +190,3 @@ Enumeration Enum_Par_Val;
+   else /* not executed */
+     return (false);
+ } /* Func_3 */
+-
-- 
2.40.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-20 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27 10:34 [Buildroot] [PATCH] dhrystone: add patch with forward declarations for functions Steffen Persvold
2024-07-15  9:28 ` Thomas Petazzoni via buildroot
2024-08-20 20:05   ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox