diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-07-02 14:34:39 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-07-02 14:34:39 +0000 |
commit | b9e9cd32243428fff2898aa203fac6b3ae7d2eea (patch) | |
tree | b17f489170183a588d1adf2e36fffc8182aca98b /include/sys | |
parent | 06ffd3f8248f8147d9f58cb3958134e0b634f5d1 (diff) |
sync with glibc versions
Diffstat (limited to 'include/sys')
-rw-r--r-- | include/sys/cdefs.h | 78 | ||||
-rw-r--r-- | include/sys/sysmacros.h | 20 |
2 files changed, 78 insertions, 20 deletions
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 diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h index 85dc3d281..c5efca4f9 100644 --- a/include/sys/sysmacros.h +++ b/include/sys/sysmacros.h @@ -1,5 +1,5 @@ /* Definitions of macros to access `dev_t' values. - Copyright (C) 1996, 1997, 1999, 2003 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999, 2003, 2004 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 @@ -25,6 +25,7 @@ /* If the compiler does not know long long it is out of luck. We are not going to hack weird hacks to support the dev_t representation they need. */ +#if 1 /*def __GLIBC_HAVE_LONG_LONG uClibc note: always enable */ __extension__ static __inline unsigned int gnu_dev_major (unsigned long long int __dev) __THROW; @@ -36,32 +37,33 @@ static __inline unsigned long long int gnu_dev_makedev (unsigned int __major, unsigned int __minor) __THROW; -#if defined __GNUC__ && __GNUC__ >= 2 +# if defined __GNUC__ && __GNUC__ >= 2 __extension__ static __inline unsigned int -gnu_dev_major (unsigned long long int __dev) __THROW +__NTH (gnu_dev_major (unsigned long long int __dev)) { return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); } __extension__ static __inline unsigned int -gnu_dev_minor (unsigned long long int __dev) __THROW +__NTH (gnu_dev_minor (unsigned long long int __dev)) { return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); } __extension__ static __inline unsigned long long int -gnu_dev_makedev (unsigned int __major, unsigned int __minor) __THROW +__NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor)) { return ((__minor & 0xff) | ((__major & 0xfff) << 8) | (((unsigned long long int) (__minor & ~0xff)) << 12) | (((unsigned long long int) (__major & ~0xfff)) << 32)); } -#endif +# endif /* Access the functions with their traditional names. */ -#define major(dev) gnu_dev_major (dev) -#define minor(dev) gnu_dev_minor (dev) -#define makedev(maj, min) gnu_dev_makedev (maj, min) +# define major(dev) gnu_dev_major (dev) +# define minor(dev) gnu_dev_minor (dev) +# define makedev(maj, min) gnu_dev_makedev (maj, min) +#endif #endif /* sys/sysmacros.h */ |