/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* bos72X src/bos/usr/include/comp_macros.h 1.1                           */
/*                                                                        */
/* Licensed Materials - Property of IBM                                   */
/*                                                                        */
/* Restricted Materials of IBM                                            */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2021                   */
/* All Rights Reserved                                                    */
/*                                                                        */
/* US Government Users Restricted Rights - Use, duplication or            */
/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.      */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/* @(#)28  1.1  src/bos/usr/include/comp_macros.h, incstd, bos72X, x2021_25A9 6/4/21 01:28:35 */

#ifndef _H_COMP_MACROS
#define _H_COMP_MACROS

/* 
 * Following macros are defined for compatibility of header files with 
 * different compilers. These new attributes/features are supported in new 
 * compilers (openxl/gcc) but not with older compiler (xlc). 
 */

#ifndef _NORETURN
#if __cplusplus >= 201103L
#define _NORETURN(_T, _F) _T _F [[noreturn]]
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define _NORETURN(_T, _F) _Noreturn _T _F
#elif defined(__has_attribute)
#if __has_attribute(__noreturn__)
#define _NORETURN(_T, _F) _T __attribute__((__noreturn__)) _F
#endif
#endif
#endif
#ifndef _NORETURN
#define _NORETURN(_T, _F) _T _F
#endif

#if !defined(_NOTHROW) && !defined(__xlC__) && !defined(__ibmxl__)
#if __cplusplus >= 201103L
#define _NOTHROW(_F, _B) _F _B noexcept(true)
#elif defined(__cplusplus)
#define _NOTHROW(_F, _B) _F _B throw()
#endif
#endif
#ifndef _NOTHROW
#define _NOTHROW(_F, _B) _F _B
#endif

#ifndef _FAST_INLINE
#if defined(__GNUC__) && (!defined(__xlC__) || defined(__ibmxl__))
#define _FAST_INLINE extern __inline__ __attribute__((__gnu_inline__,__always_inline__))
#else
#define _FAST_INLINE inline
#endif
#endif /* _FAST_INLINE */

#ifndef _LIBCALLNAME
#if defined(__GNUC__)
#define _LIBCALLNAME(__x) __asm__(__x)
#else
#define _LIBCALLNAME(__x)
#endif
#endif /* _LIBCALLNAME */

#ifndef _CONST
#if defined(__has_attribute)
#if __has_attribute(__const__)
#define _CONST __attribute__((__const__))
#endif /* __has_attribute(__const__) */
#endif /* defined(__has_attribute) */
#ifndef _CONST
#define _CONST
#endif /* _CONST */
#endif /* _CONST */

#ifndef __has_builtin
#define __has_builtin(__x) 0
#endif /* __has_builtin */

#ifndef _RETURNS_TWICE
#if defined(__has_attribute)
#if __has_attribute(__returns_twice__)
#define _RETURNS_TWICE __attribute__((__returns_twice__))
#endif /* __has_attribute(__returns_twice__) */
#endif /* defined(__has_attribute) */
#ifndef _RETURNS_TWICE
#define _RETURNS_TWICE
#endif /* _RETURNS_TWICE */
#endif /* _RETURNS_TWICE */

#endif /* _H_COMP_MACROS */
