[3/6] libgloss: i386: cygmon-gmon.c: make moncontrol() visible to its users

Message ID 20251029-fix-libgloss-i386-compile-issues-v1-3-26edcb02f69c@kernel.org
State New
Headers
Series libgloss: i386: fix compilation issues |

Commit Message

Vincent Mailhol Oct. 29, 2025, 6:58 a.m. UTC
  Move moncontrol() up so that it becomes visible to the two functions
which are using it: monstartup() and _mcleanup(). This resolves below
GCC errors:

  cygmon-gmon.c: In function 'monstartup':
  cygmon-gmon.c:165:3: error: implicit declaration of function 'moncontrol' [-Wimplicit-function-declaration]
    165 |   moncontrol (1);
        |   ^~~~~~~~~~

While at it, change the function declaration style of moncontrol()
from K&R to ISO C and remove any trailing spaces in that function.

Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
 libgloss/i386/cygmon-gmon.c | 50 ++++++++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 25 deletions(-)
  

Patch

diff --git a/libgloss/i386/cygmon-gmon.c b/libgloss/i386/cygmon-gmon.c
index 7d0697852..88bdf251c 100644
--- a/libgloss/i386/cygmon-gmon.c
+++ b/libgloss/i386/cygmon-gmon.c
@@ -92,6 +92,31 @@  static int	s_scale;
 
 extern int errno;
 
+/*
+ * Control profiling
+ *	profiling is what mcount checks to see if
+ *	all the data structures are ready.
+ */
+void
+moncontrol(int mode)
+{
+  if (mode)
+    {
+      /* start */
+      profil((unsigned short *)(sbuf + sizeof(struct phdr)),
+	     ssiz - sizeof(struct phdr),
+	     (int)s_lowpc, s_scale);
+
+      profiling = 0;
+    }
+  else
+    {
+      /* stop */
+      profil((unsigned short *)0, 0, 0, 0);
+      profiling = 3;
+    }
+}
+
 int
 monstartup(lowpc, highpc)
      char	*lowpc;
@@ -338,28 +363,3 @@  overflow:
   write (2, TOLIMIT, sizeof(TOLIMIT));
   goto out;
 }
-
-/*
- * Control profiling
- *	profiling is what mcount checks to see if
- *	all the data structures are ready.
- */
-moncontrol(mode)
-    int mode;
-{
-  if (mode)
-    {
-      /* start */
-      profil((unsigned short *)(sbuf + sizeof(struct phdr)),
-	     ssiz - sizeof(struct phdr),
-	     (int)s_lowpc, s_scale);
-      
-      profiling = 0;
-    }
-  else 
-    {
-      /* stop */
-      profil((unsigned short *)0, 0, 0, 0);
-      profiling = 3;
-    }
-}