When compiling with '-Wall -pedantic', the byte swapping macros gave the

following warning:
  warning: ANSI C forbids braced-groups within expressions

Adding __extension__ before the statement-expression seems to work right.

Submitted by:	bde (a *long* time ago)
This commit is contained in:
Nate Williams 1996-10-21 17:15:05 +00:00
parent 425b5191a4
commit bbabe47be8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19071

View file

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)endian.h 7.8 (Berkeley) 4/3/91
* $Id: endian.h,v 1.5 1994/09/10 20:03:14 csgr Exp $
* $Id: endian.h,v 1.6 1995/02/12 08:31:31 jkh Exp $
*/
#ifndef _MACHINE_ENDIAN_H_
@ -65,13 +65,13 @@
__X; })
#if __GNUC__ >= 2
#define __byte_swap_long(x) \
({ register u_long __X = (x); \
__extension__ ({ register u_long __X = (x); \
__asm ("xchgb %h1, %b1\n\trorl $16, %1\n\txchgb %h1, %b1" \
: "=q" (__X) \
: "0" (__X)); \
__X; })
#define __byte_swap_word(x) \
({ register u_short __X = (x); \
__extension__ ({ register u_short __X = (x); \
__asm ("xchgb %h1, %b1" \
: "=q" (__X) \
: "0" (__X)); \