* include/grub/setjmp.h: Define RETURNS_TWICE. Keep it empty for

gcc < 4.0.
	* include/grub/*/setjmp.h: USe RETURNS_TWICE.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-10-18 16:38:36 +02:00
parent 757e3eb7c3
commit 0d3a6f8540
9 changed files with 22 additions and 7 deletions

View file

@ -1,3 +1,9 @@
2013-10-18 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/setjmp.h: Define RETURNS_TWICE. Keep it empty for
gcc < 4.0.
* include/grub/*/setjmp.h: USe RETURNS_TWICE.
2013-10-18 Vladimir Serbinenko <phcoder@gmail.com> 2013-10-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/dmraid_nvidia.c: Fix potentially uninited "layout". * grub-core/disk/dmraid_nvidia.c: Fix potentially uninited "layout".

View file

@ -21,7 +21,7 @@
typedef unsigned long grub_jmp_buf[10]; typedef unsigned long grub_jmp_buf[10];
int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice)); int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE;
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
#endif /* ! GRUB_SETJMP_CPU_HEADER */ #endif /* ! GRUB_SETJMP_CPU_HEADER */

View file

@ -21,7 +21,7 @@
typedef unsigned long grub_jmp_buf[6]; typedef unsigned long grub_jmp_buf[6];
int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice, cdecl, int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE __attribute__ ((cdecl,
regparm (3))); regparm (3)));
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn, cdecl, void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn, cdecl,
regparm (3))); regparm (3)));

View file

@ -24,5 +24,5 @@
/* the __jmp_buf element type should be __float80 per ABI... */ /* the __jmp_buf element type should be __float80 per ABI... */
typedef long grub_jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */ typedef long grub_jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */
int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice)); int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE;
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));

View file

@ -21,7 +21,7 @@
typedef unsigned long grub_jmp_buf[11]; typedef unsigned long grub_jmp_buf[11];
int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice)); int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE;
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
#endif /* ! GRUB_SETJMP_CPU_HEADER */ #endif /* ! GRUB_SETJMP_CPU_HEADER */

View file

@ -21,7 +21,7 @@
typedef unsigned long grub_jmp_buf[20]; typedef unsigned long grub_jmp_buf[20];
int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice)); int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE;
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
#endif /* ! GRUB_SETJMP_CPU_HEADER */ #endif /* ! GRUB_SETJMP_CPU_HEADER */

View file

@ -25,6 +25,15 @@ typedef jmp_buf grub_jmp_buf;
#define grub_setjmp setjmp #define grub_setjmp setjmp
#define grub_longjmp longjmp #define grub_longjmp longjmp
#else #else
#include <grub/misc.h>
#if GNUC_PREREQ(4,0)
#define RETURNS_TWICE __attribute__ ((returns_twice))
#else
#define RETURNS_TWICE
#endif
/* This must define grub_jmp_buf, and declare grub_setjmp and /* This must define grub_jmp_buf, and declare grub_setjmp and
grub_longjmp. */ grub_longjmp. */
# include <grub/cpu/setjmp.h> # include <grub/cpu/setjmp.h>

View file

@ -23,7 +23,7 @@
typedef grub_uint64_t grub_jmp_buf[3]; typedef grub_uint64_t grub_jmp_buf[3];
int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice)); int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE;
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
#endif /* ! GRUB_SETJMP_CPU_HEADER */ #endif /* ! GRUB_SETJMP_CPU_HEADER */

View file

@ -21,7 +21,7 @@
typedef unsigned long grub_jmp_buf[8]; typedef unsigned long grub_jmp_buf[8];
int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice)); int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE;
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
#endif /* ! GRUB_SETJMP_CPU_HEADER */ #endif /* ! GRUB_SETJMP_CPU_HEADER */