0006-Add-missing-function-declarations.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. From fd7ce4b6a9e268e60071c94852f7f00f6e60ef11 Mon Sep 17 00:00:00 2001
  2. From: Steffen Persvold <spersvold@gmail.com>
  3. Date: Mon, 15 Jul 2024 11:16:36 +0200
  4. Subject: [PATCH] Add missing function declarations
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Fixes:
  9. GCC14 will give errors for missing function declarations and
  10. missing return types :
  11. dhry_1.c:75:1: error: return type defaults to ‘int’ [-Wimplicit-int]
  12. 75 | main(int argc, char *argv[])
  13. | ^~~~
  14. dhry_1.c: In function ‘main’:
  15. dhry_1.c:159:5: error: implicit declaration of function ‘Proc_5’ [-Wimplicit-function-declaration]
  16. 159 | Proc_5();
  17. | ^~~~~~
  18. Upstream: dead
  19. Signed-off-by: Steffen Persvold <spersvold@gmail.com>
  20. ---
  21. dhry_1.c | 26 +++++++++++++++++---------
  22. dhry_2.c | 8 ++++----
  23. 2 files changed, 21 insertions(+), 13 deletions(-)
  24. diff --git a/dhry_1.c b/dhry_1.c
  25. index 3ed1716..cad5840 100644
  26. --- a/dhry_1.c
  27. +++ b/dhry_1.c
  28. @@ -32,6 +32,7 @@ int Arr_2_Glob [50] [50];
  29. extern char *malloc ();
  30. #endif
  31. Enumeration Func_1 ();
  32. +Boolean Func_2 ();
  33. /* forward declaration necessary since Enumeration may not simply be int */
  34. #ifndef REG
  35. @@ -71,8 +72,17 @@ float Microseconds,
  36. /* end of variables for time measurement */
  37. -
  38. -main(int argc, char *argv[])
  39. +/* forward declarations */
  40. +void Proc_1 ();
  41. +void Proc_2 ();
  42. +void Proc_3 ();
  43. +void Proc_4 ();
  44. +void Proc_5 ();
  45. +void Proc_6 ();
  46. +void Proc_7 ();
  47. +void Proc_8 ();
  48. +
  49. +int main(int argc, char *argv[])
  50. /*****/
  51. /* main program, corresponds to procedures */
  52. @@ -295,7 +305,7 @@ main(int argc, char *argv[])
  53. }
  54. -Proc_1 (Ptr_Val_Par)
  55. +void Proc_1 (Ptr_Val_Par)
  56. /******************/
  57. REG Rec_Pointer Ptr_Val_Par;
  58. @@ -329,7 +339,7 @@ REG Rec_Pointer Ptr_Val_Par;
  59. } /* Proc_1 */
  60. -Proc_2 (Int_Par_Ref)
  61. +void Proc_2 (Int_Par_Ref)
  62. /******************/
  63. /* executed once */
  64. /* *Int_Par_Ref == 1, becomes 4 */
  65. @@ -352,7 +362,7 @@ One_Fifty *Int_Par_Ref;
  66. } /* Proc_2 */
  67. -Proc_3 (Ptr_Ref_Par)
  68. +void Proc_3 (Ptr_Ref_Par)
  69. /******************/
  70. /* executed once */
  71. /* Ptr_Ref_Par becomes Ptr_Glob */
  72. @@ -367,7 +377,7 @@ Rec_Pointer *Ptr_Ref_Par;
  73. } /* Proc_3 */
  74. -Proc_4 () /* without parameters */
  75. +void Proc_4 () /* without parameters */
  76. /*******/
  77. /* executed once */
  78. {
  79. @@ -379,7 +389,7 @@ Proc_4 () /* without parameters */
  80. } /* Proc_4 */
  81. -Proc_5 () /* without parameters */
  82. +void Proc_5 () /* without parameters */
  83. /*******/
  84. /* executed once */
  85. {
  86. @@ -399,5 +409,3 @@ register int l;
  87. while (l--) *d++ = *s++;
  88. }
  89. #endif
  90. -
  91. -
  92. diff --git a/dhry_2.c b/dhry_2.c
  93. index 63a3d3e..25051e7 100644
  94. --- a/dhry_2.c
  95. +++ b/dhry_2.c
  96. @@ -26,8 +26,9 @@
  97. extern int Int_Glob;
  98. extern char Ch_1_Glob;
  99. +Boolean Func_3 ();
  100. -Proc_6 (Enum_Val_Par, Enum_Ref_Par)
  101. +void Proc_6 (Enum_Val_Par, Enum_Ref_Par)
  102. /*********************************/
  103. /* executed once */
  104. /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
  105. @@ -61,7 +62,7 @@ Enumeration *Enum_Ref_Par;
  106. } /* Proc_6 */
  107. -Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
  108. +void Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
  109. /**********************************************/
  110. /* executed three times */
  111. /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
  112. @@ -81,7 +82,7 @@ One_Fifty *Int_Par_Ref;
  113. } /* Proc_7 */
  114. -Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
  115. +void Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
  116. /*********************************************************************/
  117. /* executed once */
  118. /* Int_Par_Val_1 == 3 */
  119. @@ -189,4 +190,3 @@ Enumeration Enum_Par_Val;
  120. else /* not executed */
  121. return (false);
  122. } /* Func_3 */
  123. -
  124. --
  125. 2.45.2