Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 7 Jan 2005 19:42:24 +0000 (19:42 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 7 Jan 2005 19:42:24 +0000 (19:42 +0000)
* misc/sys/cdefs.h (__attribute_warn_unused_result__): Define.
* stdlib/stdlib.h: Make realloc with
__attribute_warn_unused_result__ instead of __wur.
* malloc/malloc.h: Add __wur and __attribute_warn_unused_result__
markers as in <stdlib.h>.

ChangeLog
malloc/malloc.h
misc/sys/cdefs.h
stdlib/stdlib.h

index 774302a891b8149a9c3303131f0e5225f9f8b18a..402748a5d8ebd52e681e2ac76a3168e653f28ebd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-01-07  Ulrich Drepper  <drepper@redhat.com>
 
+       * misc/sys/cdefs.h (__attribute_warn_unused_result__): Define.
+       * stdlib/stdlib.h: Make realloc with
+       __attribute_warn_unused_result__ instead of __wur.
+       * malloc/malloc.h: Add __wur and __attribute_warn_unused_result__
+       markers as in <stdlib.h>.
+
        * libio/stdio.h: Remove __wur from rename and remove.
        * posix/unistd.h: Remove __wur from dup2.
 
index 753539e7b0fbb59584315054ae1781be66a53583..88a0fba72957ca2c444c53765747610f0df2a6be 100644 (file)
@@ -1,5 +1,5 @@
 /* Prototypes and definition for malloc implementation.
-   Copyright (C) 1996,97,99,2000,2002,2003,2004 Free Software Foundation, Inc.
+   Copyright (C) 1996,97,99,2000,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
@@ -117,17 +117,18 @@ extern "C" {
 #endif
 
 /* Allocate SIZE bytes of memory.  */
-extern __malloc_ptr_t malloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
+extern __malloc_ptr_t malloc __MALLOC_P ((size_t __size))
+       __attribute_malloc__ __wur;
 
 /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
 extern __malloc_ptr_t calloc __MALLOC_P ((size_t __nmemb, size_t __size))
-       __attribute_malloc__;
+       __attribute_malloc__ __wur;
 
 /* Re-allocate the previously allocated block in __ptr, making the new
    block SIZE bytes long.  */
 extern __malloc_ptr_t realloc __MALLOC_P ((__malloc_ptr_t __ptr,
                                           size_t __size))
-       __attribute_malloc__;
+       __attribute_malloc__ __attribute_warn_unused_result__;
 
 /* Free a block allocated by `malloc', `realloc' or `calloc'.  */
 extern void free __MALLOC_P ((__malloc_ptr_t __ptr));
@@ -136,15 +137,17 @@ extern void free __MALLOC_P ((__malloc_ptr_t __ptr));
 extern void cfree __MALLOC_P ((__malloc_ptr_t __ptr));
 
 /* Allocate SIZE bytes allocated to ALIGNMENT bytes.  */
-extern __malloc_ptr_t memalign __MALLOC_P ((size_t __alignment, size_t __size));
+extern __malloc_ptr_t memalign __MALLOC_P ((size_t __alignment, size_t __size))
+       __attribute_malloc__ __wur;
 
 /* Allocate SIZE bytes on a page boundary.  */
-extern __malloc_ptr_t valloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
+extern __malloc_ptr_t valloc __MALLOC_P ((size_t __size))
+       __attribute_malloc__ __wur;
 
 /* Equivalent to valloc(minimum-page-that-holds(n)), that is, round up
    __size to nearest pagesize. */
 extern __malloc_ptr_t  pvalloc __MALLOC_P ((size_t __size))
-       __attribute_malloc__;
+       __attribute_malloc__ __wur;
 
 /* Underlying allocation function; successive calls should return
    contiguous pieces of memory.  */
index 6ac21013cc1196315445bf2fcea4c40a34d58a23..8d529bfadc93f1734a5c8a39adfc937ecf3c9f86 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2001, 2002, 2004 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
 
 /* If fortification mode, we warn about unused results of certain
    function calls which can lead to problems.  */
-#if __GNUC_PREREQ (3,4) && __USE_FORTIFY_LEVEL > 0
-# define __wur __attribute__ ((__warn_unused_result__))
+#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
 
index e1d60d7619cd8bf0a51be3d8d675bb2c2787ed96..4a1571e7dbdbaaf487cdfea2dece1a5cba903c34 100644 (file)
@@ -596,7 +596,7 @@ __BEGIN_NAMESPACE_STD
 /* Re-allocate the previously allocated block
    in PTR, making the new block SIZE bytes long.  */
 extern void *realloc (void *__ptr, size_t __size)
-     __THROW __attribute_malloc__ __wur;
+     __THROW __attribute_malloc__ __attribute_warn_unused_result__;
 /* Free a block allocated by `malloc', `realloc' or `calloc'.  */
 extern void free (void *__ptr) __THROW;
 __END_NAMESPACE_STD