Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 May 2012 21:53:32 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Hartmut Brandt <harti@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r235780 - head/include
Message-ID:  <20120522214349.I1971@besplex.bde.org>
In-Reply-To: <201205220959.q4M9xoB2095552@svn.freebsd.org>
References:  <201205220959.q4M9xoB2095552@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 22 May 2012, Hartmut Brandt wrote:

> Log:
>  Fix a compilation error with some compilers: __attribute__
>  requires two parenthesis for its argument, but instead of using
>  __attribute__ directly, use the appropriate __nonnull macro
>  from cdefs.h.

This also fixes:
- the style bug of hard-coding __attribute__(())
- the namespace pollution of using nonnull() instead of __nonnull__().

> Modified: head/include/malloc_np.h
> ==============================================================================
> --- head/include/malloc_np.h	Tue May 22 09:27:57 2012	(r235779)
> +++ head/include/malloc_np.h	Tue May 22 09:59:49 2012	(r235780)
> @@ -55,13 +55,11 @@ int	mallctlbymib(const size_t *mib, size
> #define	ALLOCM_ERR_OOM		1
> #define	ALLOCM_ERR_NOT_MOVED	2
>
> -int	allocm(void **ptr, size_t *rsize, size_t size, int flags)
> -    __attribute__(nonnull(1));
> +int	allocm(void **ptr, size_t *rsize, size_t size, int flags) __nonnull(1);
> int	rallocm(void **ptr, size_t *rsize, size_t size, size_t extra,
> -    int flags) __attribute__(nonnull(1));
> -int	sallocm(const void *ptr, size_t *rsize, int flags)
> -    __attribute__(nonnull(1));
> -int	dallocm(void *ptr, int flags) __attribute__(nonnull(1));
> +    int flags) __nonnull(1);
> +int	sallocm(const void *ptr, size_t *rsize, int flags) __nonnull(1);
> +int	dallocm(void *ptr, int flags) __nonnull(1);
> int	nallocm(size_t *rsize, size_t size, int flags);
> __END_DECLS

Many unfixed bugs are visible nearby, starting with the namespace pollution
of parameter names in the application namespace.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120522214349.I1971>