From owner-svn-src-all@FreeBSD.ORG Fri May 15 20:43:38 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B55EE8F; Fri, 15 May 2015 20:43:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8ACCD115A; Fri, 15 May 2015 20:43:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4FKhc8P072298; Fri, 15 May 2015 20:43:38 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4FKhcMR072296; Fri, 15 May 2015 20:43:38 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201505152043.t4FKhcMR072296@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 15 May 2015 20:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282988 - in head: include sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2015 20:43:38 -0000 Author: pfg Date: Fri May 15 20:43:37 2015 New Revision: 282988 URL: https://svnweb.freebsd.org/changeset/base/282988 Log: Make use of GCC alloc_align attribute This lets the compiler know about the alignment of pointers returned by aligned_alloc(3), posix_memalign(3). and contigmalloc(9) Currently this is only supported in recent gcc but we are ready to use it if clang implements it. Relnotes: yes Modified: head/include/stdlib.h head/sys/sys/malloc.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Fri May 15 19:51:05 2015 (r282987) +++ head/include/stdlib.h Fri May 15 20:43:37 2015 (r282988) @@ -156,7 +156,8 @@ _Noreturn void _Exit(int); * If we're in a mode greater than C99, expose C11 functions. */ #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L -void * aligned_alloc(size_t, size_t) __malloc_like __alloc_size(2); +void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1) + __alloc_size(2); int at_quick_exit(void (*)(void)); _Noreturn void quick_exit(int); @@ -171,7 +172,7 @@ char *realpath(const char * __restrict, int rand_r(unsigned *); /* (TSF) */ #endif #if __POSIX_VISIBLE >= 200112 -int posix_memalign(void **, size_t, size_t) __nonnull(1) +int posix_memalign(void **, size_t, size_t) __nonnull(1) __alloc_align(2) __alloc_size(3); /* (ADV) */ int setenv(const char *, const char *, int); int unsetenv(const char *); Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Fri May 15 19:51:05 2015 (r282987) +++ head/sys/sys/malloc.h Fri May 15 20:43:37 2015 (r282988) @@ -174,7 +174,7 @@ void contigfree(void *addr, unsigned lon void *contigmalloc(unsigned long size, struct malloc_type *type, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, vm_paddr_t boundary) __malloc_like __result_use_check - __alloc_size(1); + __alloc_size(1) __alloc_align(6); void free(void *addr, struct malloc_type *type); void *malloc(unsigned long size, struct malloc_type *type, int flags) __malloc_like __result_use_check __alloc_size(1);