Add nonnull annotation to posix_memalign.

GCC 6.0+ asserts that the memptr argument to the builtin function
posix_memalign is nonnull.
Add the necessary annotation to the prototype and
remove the now unnecessary check to fix a warning.

newlib/Changelog
newlib/libc/include/stdlib.h: Annotate arg to posix_memalign as
non-null.

winsup/cygwin/ChangeLog
malloc_wrapper.cc (posix_memalign): Remove always true nonnull check.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
This commit is contained in:
Peter Foley 2016-03-21 13:15:42 -04:00 committed by Corinna Vinschen
parent 6699e21ffb
commit 3ba2c39fb2
2 changed files with 2 additions and 3 deletions

View File

@ -253,7 +253,7 @@ int _EXFUN(_unsetenv_r,(struct _reent *, const char *__string));
#ifdef __rtems__ #ifdef __rtems__
#if __POSIX_VISIBLE >= 200112 #if __POSIX_VISIBLE >= 200112
int _EXFUN(posix_memalign,(void **, size_t, size_t)); int _EXFUN(__nonnull (1) posix_memalign,(void **, size_t, size_t));
#endif #endif
#endif #endif

View File

@ -126,8 +126,7 @@ posix_memalign (void **memptr, size_t alignment, size_t bytes)
__malloc_unlock (); __malloc_unlock ();
if (!res) if (!res)
return ENOMEM; return ENOMEM;
if (memptr) *memptr = res;
*memptr = res;
return 0; return 0;
} }