[openssl-dev] Testing for a type with a define in e_os2.h?

Jeffrey Walton noloader at gmail.com
Sun Mar 27 03:50:12 UTC 2016


On Sat, Mar 26, 2016 at 11:10 PM, Richard Levitte <levitte at openssl.org> wrote:
> In message <CAH8yC8kncrGmWLOfROMd_F++g+xOxQVuZpNcBX3D44S-t7=qUg at mail.gmail.com> on Sat, 26 Mar 2016 18:14:05 -0400, Jeffrey Walton <noloader at gmail.com> said:
>
> noloader> e_os2.h has this around line 260:
> noloader>
> noloader> # if defined(OPENSSL_SYS_UEFI) && !defined(ssize_t)
> noloader> #  define ossl_ssize_t int
> noloader> #  define OSSL_SSIZE_MAX INT_MAX
> noloader> # endif
> noloader>
> noloader> I don't believe you can test for a type by using 'defined(t)'. Also
> noloader> see http://stackoverflow.com/questions/12558538/how-can-i-check-a-certain-type-is-already-defined-in-c-compiler.
>
> ... unless it's defined with a macro

Yeah, I kind of knew about that. But a type like ssize_t defined with
a typedef won't pass that test. It will degenerate into:

   #if defined(OPENSSL_SYS_UEFI) && /*TRUE*/
     ...
   #endif

That brings up the thing I was wondering about. I followed the pattern
in my diffs, but did not feel it was quite right (I might be missing
something obvious)... Why isn't ossl_ssize_t a typedef?

Jeff


More information about the openssl-dev mailing list