On 10/3/22 03:10, Simon Glass wrote:
Hi Heinrich,

On Sat, 1 Oct 2022 at 07:05, Heinrich Schuchardt
<[email protected]> wrote:

The jmp_buf type is required by the C99 specification.
Defining it for x86 fixes building the longjmp unit test.

Signed-off-by: Heinrich Schuchardt <[email protected]>
---
  arch/x86/include/asm/setjmp.h | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <[email protected]>


diff --git a/arch/x86/include/asm/setjmp.h b/arch/x86/include/asm/setjmp.h
index 49c36c1cc8..788d59e231 100644
--- a/arch/x86/include/asm/setjmp.h
+++ b/arch/x86/include/asm/setjmp.h
@@ -34,7 +34,9 @@ struct jmp_buf_data {

  #endif

-int setjmp(struct jmp_buf_data *jmp_buf);
-void longjmp(struct jmp_buf_data *jmp_buf, int val);
+typedef struct jmp_buf_data jmp_buf[1];
+
+int setjmp(jmp_buf env);
+void longjmp(jmp_buf env, int val);

  #endif
--
2.37.2


This is an odd test. Where is the failure?

qemu-x86_defconfig with CONFIG_UNIT_TEST=y does not build without this patch:

test/lib/longjmp.c:15:9: error: unknown type name ‘jmp_buf’
   15 |         jmp_buf env;

Best regards

Heinrich

Reply via email to