svn commit: r232721 - head/sys/x86/include

Dimitry Andric dim at FreeBSD.org
Fri Mar 9 12:58:56 UTC 2012


On 2012-03-09 12:48, Tijl Coosemans wrote:
> Author: tijl
> Date: Fri Mar  9 11:48:56 2012
> New Revision: 232721
> URL: http://svn.freebsd.org/changeset/base/232721
> 
> Log:
>   Clean up x86 endian.h:
>   - Remove extern "C". There are no functions with external linkage here. [1]
>   - Rename bswapNN_const(x) to bswapNN_gen(x) to indicate that these macros
>     are generic implementations that can take non-constant arguments. [1]
>   - Split up __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P and deal with
>     each separately.
>   - Replace _LP64 with __amd64__ because asm instructions are machine
>     dependent, not ABI dependent.
...
> +#ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
> +#define	__bswap16(x)			\
> +	(__builtin_constant_p(x) ?	\
> +	    __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x))

Shall we now add a cast to __uint16_t to this ternary expression?  That
should solve the problems with clang warnings about ntohs() etc once and
for all.


More information about the svn-src-all mailing list