[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] libpng 1.51?



I was thinking about that Newsie macro issue but I forgot to post a reply.

Regards,

Peter

On Thu, 10 Mar 2011 19:18:18 , Miro Kropá?ek wrote:
> > To be honest I don't understand what is the problem, I just see that png.h
> > is able to make longjmp disappear, but siglongjmp is still around...
> >
> Nothing disappears. It's a problem which was discussed here some time ago,
> how compiler interprets #defines within #defines (right, very scientific
> description). Your problem is this line (png.h:970):
>
> #  define png_jmpbuf(png_ptr) \
>       (*png_set_longjmp_fn((png_ptr), *longjmp*, sizeof (jmp_buf)))
>
> This macro (png_jmpbuf) is used in pngread.c:90:
>
> if (setjmp(*png_jmpbuf*(png_ptr)))
>
> and guess what, longjmp isn't expanded (even if known to compiler!). It even
> doesn't help if you do something like this:
>
> *#define longjmp(__jb,__v)       (siglongjmp(__jb, __v))*
> #  define png_jmpbuf(png_ptr) \
>       (*png_set_longjmp_fn((png_ptr), *longjmp*, sizeof (jmp_buf)))
>
> Don't ask me why, to me it looks stupid but probably it has some reason. So
> this is why siglongjmp worked for you -- macro is then expanded correctly.
> Question is how to fix this.
>
> Btw, <setjmp.h> (better said, features.h which is #included there) #defines
> __USE_BSD but does NOT define __STRICT_ANSI.
>