From 0d3a6f854024a8c596431e22ff780f34ead9dfea Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 18 Oct 2013 16:38:36 +0200 Subject: [PATCH] * include/grub/setjmp.h: Define RETURNS_TWICE. Keep it empty for gcc < 4.0. * include/grub/*/setjmp.h: USe RETURNS_TWICE. --- ChangeLog | 6 ++++++ include/grub/arm/setjmp.h | 2 +- include/grub/i386/setjmp.h | 2 +- include/grub/ia64/setjmp.h | 2 +- include/grub/mips/setjmp.h | 2 +- include/grub/powerpc/setjmp.h | 2 +- include/grub/setjmp.h | 9 +++++++++ include/grub/sparc64/setjmp.h | 2 +- include/grub/x86_64/setjmp.h | 2 +- 9 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e74072ccf..54bf2d695 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-10-18 Vladimir Serbinenko + + * 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 * grub-core/disk/dmraid_nvidia.c: Fix potentially uninited "layout". diff --git a/include/grub/arm/setjmp.h b/include/grub/arm/setjmp.h index 1c1d0b54e..7990f2eb3 100644 --- a/include/grub/arm/setjmp.h +++ b/include/grub/arm/setjmp.h @@ -21,7 +21,7 @@ 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)); #endif /* ! GRUB_SETJMP_CPU_HEADER */ diff --git a/include/grub/i386/setjmp.h b/include/grub/i386/setjmp.h index c5f94b406..bf959a665 100644 --- a/include/grub/i386/setjmp.h +++ b/include/grub/i386/setjmp.h @@ -21,7 +21,7 @@ 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))); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn, cdecl, regparm (3))); diff --git a/include/grub/ia64/setjmp.h b/include/grub/ia64/setjmp.h index 6e9bc8bef..0a6211379 100644 --- a/include/grub/ia64/setjmp.h +++ b/include/grub/ia64/setjmp.h @@ -24,5 +24,5 @@ /* the __jmp_buf element type should be __float80 per ABI... */ 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)); diff --git a/include/grub/mips/setjmp.h b/include/grub/mips/setjmp.h index 5e5985586..5ce45f508 100644 --- a/include/grub/mips/setjmp.h +++ b/include/grub/mips/setjmp.h @@ -21,7 +21,7 @@ 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)); #endif /* ! GRUB_SETJMP_CPU_HEADER */ diff --git a/include/grub/powerpc/setjmp.h b/include/grub/powerpc/setjmp.h index fa16f73d2..9beddfdb2 100644 --- a/include/grub/powerpc/setjmp.h +++ b/include/grub/powerpc/setjmp.h @@ -21,7 +21,7 @@ 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)); #endif /* ! GRUB_SETJMP_CPU_HEADER */ diff --git a/include/grub/setjmp.h b/include/grub/setjmp.h index a107b8229..4bba034f4 100644 --- a/include/grub/setjmp.h +++ b/include/grub/setjmp.h @@ -25,6 +25,15 @@ typedef jmp_buf grub_jmp_buf; #define grub_setjmp setjmp #define grub_longjmp longjmp #else + +#include + +#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 grub_longjmp. */ # include diff --git a/include/grub/sparc64/setjmp.h b/include/grub/sparc64/setjmp.h index 6096baef1..00286a574 100644 --- a/include/grub/sparc64/setjmp.h +++ b/include/grub/sparc64/setjmp.h @@ -23,7 +23,7 @@ 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)); #endif /* ! GRUB_SETJMP_CPU_HEADER */ diff --git a/include/grub/x86_64/setjmp.h b/include/grub/x86_64/setjmp.h index 4ad968ed5..e9f2bac8e 100644 --- a/include/grub/x86_64/setjmp.h +++ b/include/grub/x86_64/setjmp.h @@ -21,7 +21,7 @@ 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)); #endif /* ! GRUB_SETJMP_CPU_HEADER */