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

Vincent Mailhol <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <20251029-fix-libgloss-i386-compile-issues-v1-3-26edcb02f69c@kernel.org>
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 <[email protected]>
---
 libgloss/i386/cygmon-gmon.c | 50 ++++++++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

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;
-    }
-}

-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.