Menu

#17 jmp_buf definition violates C standard

v1.0_(example)
closed
None
5
2019-03-15
2019-02-06
No

jmp_buf in the current gnu-efi is a structure, which means it needs to be accessed using & to make a pointer. The C standard is that it is used without &. The standard solution for this is to typedef jmp_buf as an array, usually of size 1:

typedef struct __jmp_buf jmp_buf[1];

Discussion

  • Nigel Croxon

    Nigel Croxon - 2019-02-11

    Hello Peter,
    I looked at the code to see if I can understand what you are after.
    Can you provide a patch so I can compare?

    Thanks, Nigel

     
  • Joakim Tjernlund

    Current API gives:
    static jmp_buf load_error_buf;
    ...
    setjmp(&load_error_buf)
    ...
    longjmp(&load_error_buf, 1);

    But standard C says I/F should be:
    static jmp_buf load_error_buf;
    ..
    setjmp(load_error_buf);
    ..
    longjmp(load_error_buf, 1);

    Redefining jmp_buf to:
    typedef struct jmp_buf jmp_buf[1];
    will fix the api to std C

     
  • Nigel Croxon

    Nigel Croxon - 2019-03-15
    • status: open --> closed
    • assigned_to: Nigel Croxon
     
  • Nigel Croxon

    Nigel Croxon - 2019-03-15

    Patch reviewed and accepted
    commit 5b74db0e154ffd2fba4bcc254069844f21913988

     

Log in to post a comment.