From owner-svn-src-all@FreeBSD.ORG Thu Mar 29 14:35:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F03F71065674; Thu, 29 Mar 2012 14:35:03 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw03.mail.saunalahti.fi (gw03.mail.saunalahti.fi [195.197.172.111]) by mx1.freebsd.org (Postfix) with ESMTP id 9C7948FC14; Thu, 29 Mar 2012 14:35:03 +0000 (UTC) Received: from jh (a91-153-115-208.elisa-laajakaista.fi [91.153.115.208]) by gw03.mail.saunalahti.fi (Postfix) with SMTP id 72B9A216671; Thu, 29 Mar 2012 17:25:40 +0300 (EEST) Date: Thu, 29 Mar 2012 17:25:40 +0300 From: Jaakko Heinonen To: Dimitry Andric Message-ID: <20120329142539.GA51516@jh> References: <201203241007.q2OA7MtS024789@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201203241007.q2OA7MtS024789@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r233419 - head/sys/x86/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 29 Mar 2012 14:35:04 -0000 Hi, On 2012-03-24, Dimitry Andric wrote: > Fix the following clang warning in sys/dev/dcons/dcons.c, caused by the > recent changes in sys/x86/include/endian.h: > > sys/dev/dcons/dcons.c:190:15: error: implicit conversion from '__uint32_t' (aka 'unsigned int') to '__uint16_t' (aka 'unsigned short') changes value from 1684238190 to 28526 [-Werror,-Wconstant-conversion] > buf->magic = ntohl(DCONS_MAGIC); > ^~~~~~~~~~~~~~~~~~ > sys/sys/param.h:306:18: note: expanded from: > #define ntohl(x) __ntohl(x) > ^ > ./x86/endian.h:128:20: note: expanded from: > #define __ntohl(x) __bswap32(x) > ^ > ./x86/endian.h:78:20: note: expanded from: > __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x)) > ^ > ./x86/endian.h:68:26: note: expanded from: > (((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16)) > ^ > ./x86/endian.h:75:53: note: expanded from: > __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x))) > ~~~~~~~~~~~~~ ^ > > This is because the __bswapXX_gen() macros (for x86) call the regular > __bswapXX() macros. Since the __bswapXX_gen() variants are only called > when their arguments are constant, there is no need to do that constancy > check recursively. Also, it causes the above error with clang. > > Fix it by calling __bswap16_gen() from __bswap32_gen(), and similarly, > __bswap32_gen() from __bswap64_gen(). > > While here, add extra parentheses around the __bswap16_gen() macro > expansion, to prevent unexpected side effects. > > Modified: > head/sys/x86/include/endian.h This commit seems to have broken kernel dumping for me. I always get: # savecore savecore: error reading first dump header at offset 4143647740 in /dev/ada0s1b: Invalid argument The offset varies. FreeBSD x 10.0-CURRENT FreeBSD 10.0-CURRENT #826 r233419M: Thu Mar 29 15:46:12 EEST 2012 x@x:X i386 Dumping works with r233418. -- Jaakko