[PATCH 6/6] libgloss: i386: cygmon-gmon.c: fix _mcount() return type

Vincent Mailhol mailhol@kernel.org
Wed Oct 29 06:58:31 GMT 2025


_mcount() is declared as returning an int, but in reality, it always
returns void as shown by those GCC errors:

  cygmon-gmon.c: In function 'monstartup':
  cygmon-gmon.c:142:7: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
    142 |       return;
        |       ^~~~~~
  cygmon-gmon.c:118:1: note: declared here
    118 | monstartup(lowpc, highpc)
        | ^~~~~~~~~~
  cygmon-gmon.c:150:7: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
    150 |       return;
        |       ^~~~~~
  cygmon-gmon.c:118:1: note: declared here
    118 | monstartup(lowpc, highpc)
        | ^~~~~~~~~~
  cygmon-gmon.c:171:7: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
    171 |       return;
        |       ^~~~~~
  cygmon-gmon.c:118:1: note: declared here
    118 | monstartup(lowpc, highpc)
        | ^~~~~~~~~~
  cygmon-gmon.c:182:5: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
    182 |     return;
        |     ^~~~~~
  cygmon-gmon.c:118:1: note: declared here
    118 | monstartup(lowpc, highpc)
        | ^~~~~~~~~~

Change monstartup()'s return type from int to void.

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

diff --git a/libgloss/i386/cygmon-gmon.c b/libgloss/i386/cygmon-gmon.c
index 3c2f07fed..b6e2467b0 100644
--- a/libgloss/i386/cygmon-gmon.c
+++ b/libgloss/i386/cygmon-gmon.c
@@ -118,7 +118,7 @@ moncontrol(int mode)
     }
 }
 
-int
+void
 monstartup(lowpc, highpc)
      char	*lowpc;
      char	*highpc;

-- 
2.51.0



More information about the Newlib mailing list