Fix sysdeps/mips/__longjmp.c warning

Message ID alpine.DEB.2.10.1411261634260.854@digraph.polyomino.org.uk
State Committed
Headers

Commit Message

Joseph Myers Nov. 26, 2014, 4:34 p.m. UTC
  This patch fixes

../sysdeps/mips/__longjmp.c:27:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]

which arose I think from the MIPS16 changes (renaming the function to
____longjmp with an alias __longjmp, so a prior header prototype for
__longjmp no longer sufficed to prevent a warning).  I've made the
function use a prototype definition, which is what we want for all
function definitions in glibc anyway.

Tested for MIPS and committed.

2014-11-26  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/mips/__longjmp.c (____longjmp): Use prototype
	definition.
  

Comments

Rich Felker Dec. 1, 2014, 3:22 p.m. UTC | #1
On Wed, Nov 26, 2014 at 04:34:50PM +0000, Joseph Myers wrote:
> This patch fixes
> 
> .../sysdeps/mips/__longjmp.c:27:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
> 
> which arose I think from the MIPS16 changes (renaming the function to
> ____longjmp with an alias __longjmp, so a prior header prototype for
> __longjmp no longer sufficed to prevent a warning).  I've made the
> function use a prototype definition, which is what we want for all
> function definitions in glibc anyway.
> 
> Tested for MIPS and committed.

This file is utter nonsense and really needs to be replaced completely
by either one giant __asm__ block or a .S file. As-written, it assumes
the compiler will not use or clobber any registers between one asm
statement and the next, which is an invalid assumption. setjmp_aux.c
is even worse and relies on the same invalid assumption and on tail
call optimization.

Rich
  

Patch

diff --git a/sysdeps/mips/__longjmp.c b/sysdeps/mips/__longjmp.c
index 5e6a353..c2498c3 100644
--- a/sysdeps/mips/__longjmp.c
+++ b/sysdeps/mips/__longjmp.c
@@ -24,9 +24,7 @@ 
 #endif
 
 static void __attribute__ ((nomips16))
-____longjmp (env_arg, val_arg)
-     __jmp_buf env_arg;
-     int val_arg;
+____longjmp (__jmp_buf env_arg, int val_arg)
 {
   /* gcc 1.39.19 miscompiled the longjmp routine (as it did setjmp before
      the hack around it); force it to use $a1 for the longjmp value.