Skip to contentSkip to conversation

dhrystone: add patch with forward declarations for functions

PATCH In review Steffen Persvold 3 participants 3 messages Jun 27, 2024 – Aug 20, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dhrystone: add patch with forward declarations for functions

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();
      |     ^~~~~~
---
 package/dhrystone/0006-fwd-decl.patch | 121 ++++++++++++++++++++++++++
 1 file changed, 121 insertions(+)
 create mode 100644 package/dhrystone/0006-fwd-decl.patch
package/dhrystone/0006-fwd-decl.patch new file +121 -0
new file mode 100644
index 00000000..830a704c
@@ -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 */
+-
Signature · 6 lines
2.40.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello,

Quoted 11 lines · On Thu, 27 Jun 2024 12:34:40 +0200 Steffen Persvold <[email protected]> wrote:

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();
      |     ^~~~~~
Quoted 5 lines
---
 package/dhrystone/0006-fwd-decl.patch | 121 ++++++++++++++++++++++++++
 1 file changed, 121 insertions(+)
 create mode 100644 package/dhrystone/0006-fwd-decl.patch

Thanks for your contribution!

The patch added by your patch was missing a Signed-off-by line and an Upstream tag, so I've added that. Also your commit message was missing a reference to the autobuilder failure being fixed by this. I addressed both issues when applying.

I did a preparation patch to clean-up the existing patches a bit:

https://gitlab.com/buildroot.org/buildroot/-/commit/95013777cf93548eee7ac3010b513d354e8b0a30

And then applied your patch with the fixes described above:

https://gitlab.com/buildroot.org/buildroot/-/commit/3847a145c23234b3bddae3a9ceb9d2d4e6a90fc5

Thanks a lot for your contribution!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
Quoted 32 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni via buildroot <[email protected]> writes:

Hello,

Quoted 11 lines · On Thu, 27 Jun 2024 12:34:40 +0200 Steffen Persvold <[email protected]> wrote:

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();
| ^~~~~~

Quoted 5 lines

---
package/dhrystone/0006-fwd-decl.patch | 121 ++++++++++++++++++++++++++

1 file changed, 121 insertions(+)

create mode 100644 package/dhrystone/0006-fwd-decl.patch

Thanks for your contribution!

The patch added by your patch was missing a Signed-off-by line and an Upstream tag, so I've added that. Also your commit message was missing a reference to the autobuilder failure being fixed by this. I addressed both issues when applying.

I did a preparation patch to clean-up the existing patches a bit:

Quoted 7 lines

https://gitlab.com/buildroot.org/buildroot/-/commit/95013777cf93548eee7ac3010b513d354e8b0a30

And then applied your patch with the fixes described above:

https://gitlab.com/buildroot.org/buildroot/-/commit/3847a145c23234b3bddae3a9ceb9d2d4e6a90fc5

Thanks a lot for your contribution!

Committed both to 2024.05.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot