From b9e9cd32243428fff2898aa203fac6b3ae7d2eea Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 2 Jul 2005 14:34:39 +0000 Subject: sync with glibc versions --- include/sys/cdefs.h | 78 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 11 deletions(-) (limited to 'include/sys/cdefs.h') diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index f370145f1..0a6d345bc 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1992-2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -39,24 +39,28 @@ /* GCC can always grok prototypes. For C++ programs we add throw() to help it optimize the function calls. But this works only with - gcc 2.8.x and egcs. */ -# if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () + gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions + as non-throwing using a function attribute since programs can use + the -fexceptions options for C code as well. */ +# if 0 //!defined __cplusplus && __GNUC_PREREQ (3, 3) +# define __THROW __attribute__ ((__nothrow__)) +# define __NTH(fct) __attribute__ ((__nothrow__)) fct # else -# define __THROW +# if defined __cplusplus && __GNUC_PREREQ (2,8) +# define __THROW throw () +# define __NTH(fct) fct throw () +# else +# define __THROW +# define __NTH(fct) fct +# endif # endif -# define __P(args) args __THROW -/* This macro will be used for functions which might take C++ callback - functions. */ -# define __PMT(args) args #else /* Not GCC. */ # define __inline /* No inline functions. */ # define __THROW -# define __P(args) args -# define __PMT(args) args +# define __NTH(fct) fct # define __const const # define __signed signed @@ -64,6 +68,11 @@ #endif /* GCC. */ +/* These two macros are not used in glibc anymore. They are kept here + only because some other projects expect the macros to be defined. */ +#define __P(args) args +#define __PMT(args) args + /* For these things, GCC behaves the ANSI way normally, and the non-ANSI way under -traditional. */ @@ -118,6 +127,12 @@ #endif +/* Fortify support. */ +#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) +#define __bos0(ptr) __builtin_object_size (ptr, 0) +#define __warndecl(name, msg) extern void name (void) + + /* Support for flexible arrays. */ #if __GNUC_PREREQ (2,97) /* GCC 2.97 supports C99 flexible array members. */ @@ -150,6 +165,17 @@ # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) # define __ASMNAME(cname) __C_SYMBOL_PREFIX__ cname +/* +# ifdef __cplusplus +# define __REDIRECT_NTH(name, proto, alias) \ + name proto __THROW __asm__ (__ASMNAME (#alias)) +# else +# define __REDIRECT_NTH(name, proto, alias) \ + name proto __asm__ (__ASMNAME (#alias)) __THROW +# endif +# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) +# define __ASMNAME2(prefix, cname) __STRING (prefix) cname +*/ /* #elif __SOME_OTHER_COMPILER__ @@ -225,6 +251,36 @@ # define __attribute_format_strfmon__(a,b) /* Ignore */ #endif +/* The nonull function attribute allows to mark pointer parameters which + must not be NULL. */ +#if __GNUC_PREREQ (3,3) +# define __nonnull(params) __attribute__ ((__nonnull__ params)) +#else +# define __nonnull(params) +#endif + +/* If fortification mode, we warn about unused results of certain + function calls which can lead to problems. */ +#if __GNUC_PREREQ (3,4) +# define __attribute_warn_unused_result__ \ + __attribute__ ((__warn_unused_result__)) +# if __USE_FORTIFY_LEVEL > 0 +# define __wur __attribute_warn_unused_result__ +# endif +#else +# define __attribute_warn_unused_result__ /* empty */ +#endif +#ifndef __wur +# define __wur /* Ignore */ +#endif + +/* Forces a function to be always inlined. */ +#if __GNUC_PREREQ (3,2) +# define __always_inline __inline __attribute__ ((__always_inline__)) +#else +# define __always_inline __inline +#endif + /* It is possible to compile containing GCC extensions even if GCC is run in pedantic mode if the uses are carefully marked using the `__extension__' keyword. But this is not generally available before -- cgit v1.2.3