- (dtucker) [defines.h] Define __GNUC_PREREQ__ macro if we don't already

have it.  Only attempt to use __attribute__(__bounded__) for gcc.
This commit is contained in:
Darren Tucker 2014-05-01 02:24:35 +10:00
parent b628cc4c3e
commit f028460d0b
2 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,7 @@
20140430
- (dtucker) [defines.h] Define __GNUC_PREREQ__ macro if we don't already
have it. Only attempt to use __attribute__(__bounded__) for gcc.
20140420 20140420
- OpenBSD CVS Sync - OpenBSD CVS Sync
- djm@cvs.openbsd.org 2014/03/03 22:22:30 - djm@cvs.openbsd.org 2014/03/03 22:22:30

View File

@ -25,7 +25,7 @@
#ifndef _DEFINES_H #ifndef _DEFINES_H
#define _DEFINES_H #define _DEFINES_H
/* $Id: defines.h,v 1.177 2014/04/20 03:21:23 djm Exp $ */ /* $Id: defines.h,v 1.178 2014/04/30 16:24:35 dtucker Exp $ */
/* Constants */ /* Constants */
@ -826,9 +826,17 @@ struct winsize {
# define arc4random_stir() # define arc4random_stir()
#endif #endif
/* Macro to test if we're using a specific version of gcc or later. */
#if defined(__GNUC__) && !defined(__GNUC_PREREQ__)
#define __GNUC_PREREQ__(ma, mi) \
((__GNUC__ > (ma)) || (__GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)))
#else
#define __GNUC_PREREQ__(ma, mi) 0
#endif
/* __bounded macro */ /* __bounded macro */
#ifndef __bounded #ifndef __bounded
# if __GNUC_PREREQ__(3,3) && !defined(__clang__) # if defined(__GNUC__) && __GNUC_PREREQ__(3,3) && !defined(__clang__)
# define __bounded(args) __attribute__ ((__bounded__ args )) # define __bounded(args) __attribute__ ((__bounded__ args ))
# else # else
# define __bounded(args) /* delete */ # define __bounded(args) /* delete */