svn commit: r235780 - head/include

Bruce Evans brde at optusnet.com.au
Tue May 22 11:53:41 UTC 2012


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


More information about the svn-src-all mailing list