Thanks for feedback Michael! I wasn't aware of __GNUC_PREREQ.
I did a grep and found a few more places where it can be used.

Index: lib/libssl/src/crypto/bn/bn_lcl.h
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/bn/bn_lcl.h,v
retrieving revision 1.21
diff -r1.21 bn_lcl.h
262c262
< #   if __GNUC__>=4 && __GNUC_MINOR__>=4 /* "h" constraint is no more since 4.4 */
---
> #   if __GNUC_PREREQ(4,4) /* "h" constraint is no more since 4.4 */
Index: lib/libssl/src/crypto/ec/ecp_nistp224.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/ec/ecp_nistp224.c,v
retrieving revision 1.17
diff -r1.17 ecp_nistp224.c
38c38
< #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
---
> #if __GNUC_PREREQ(3,1)
Index: lib/libssl/src/crypto/ec/ecp_nistp256.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/ec/ecp_nistp256.c,v
retrieving revision 1.16
diff -r1.16 ecp_nistp256.c
39c39
< #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
---
> #if __GNUC_PREREQ(3,1)
Index: lib/libssl/src/crypto/ec/ecp_nistp521.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/ec/ecp_nistp521.c,v
retrieving revision 1.17
diff -r1.17 ecp_nistp521.c
39c39
< #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
---
> #if __GNUC_PREREQ(3,1)

Michael McConville writes:

> Ruslan Babayev wrote:
>> This fixes the portable LibreSSL build on Linux with GCC5 for MIPS64.
>
> Is __GNUC_PREREQ__ from /usr/include/sys/cdefs.h in other OSs? If not,
> you could probably just add it to the LibreSSL portability headers. It's
> probably the easiest and most readable solution if these sorts of
> preproc conditions exist in more than one place.
>
>> Index: lib/libssl/src/crypto/bn/bn_lcl.h
>> ===================================================================
>> RCS file: /cvs/src/lib/libssl/src/crypto/bn/bn_lcl.h,v
>> retrieving revision 1.21
>> diff -r1.21 bn_lcl.h
>> 262c262
>> < #   if __GNUC__>=4 && __GNUC_MINOR__>=4 /* "h" constraint is no more since 
>> 4.4 */
>> ---
>> > #   if __GNUC__>=4 && __GNUC_MINOR__>=4 || __GNUC__>=5 /* "h" constraint 
>> > is no more since 4.4 */

Reply via email to