From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: Packing of union fields and bool_bf Date: Sat, 13 Oct 2018 11:22:31 -0500 Message-ID: References: <838t31vpwy.fsf@gnu.org> <87h8hpbzzr.fsf@tromey.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------7B62DCF4A47FC70689B77A9A" X-Trace: blaine.gmane.org 1539447651 20859 195.159.176.226 (13 Oct 2018 16:20:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 13 Oct 2018 16:20:51 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 Cc: emacs-devel@gnu.org To: Tom Tromey , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 13 18:20:46 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gBMej-0005Jg-NA for ged-emacs-devel@m.gmane.org; Sat, 13 Oct 2018 18:20:45 +0200 Original-Received: from localhost ([::1]:45573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBMgq-00076o-AR for ged-emacs-devel@m.gmane.org; Sat, 13 Oct 2018 12:22:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBMgk-00076f-76 for emacs-devel@gnu.org; Sat, 13 Oct 2018 12:22:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gBMgj-00018t-CR for emacs-devel@gnu.org; Sat, 13 Oct 2018 12:22:50 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:60286) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gBMgZ-000128-Rl; Sat, 13 Oct 2018 12:22:40 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F23DB1616E0; Sat, 13 Oct 2018 09:22:35 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id h-swCpDacdUf; Sat, 13 Oct 2018 09:22:34 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6E5D1161774; Sat, 13 Oct 2018 09:22:34 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id NrdUXm77yWNk; Sat, 13 Oct 2018 09:22:34 -0700 (PDT) Original-Received: from [172.20.5.240] (unknown [64.55.146.34]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 191F11616E0; Sat, 13 Oct 2018 09:22:34 -0700 (PDT) In-Reply-To: <87h8hpbzzr.fsf@tromey.com> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:230371 Archived-At: This is a multi-part message in MIME format. --------------7B62DCF4A47FC70689B77A9A Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 10/13/2018 10:58 AM, Tom Tromey wrote: > From https://docs.microsoft.com/en-us/cpp/c-language/padding-and-alignment-of-structure-members?view=vs-2017: > > Adjacent bit fields are packed into the same 1-, 2-, or 4-byte > allocation unit if the integral types are the same size It's silly to require the integral types to be the same size, since the actual size is given by the number of bits in the bitfield. But if it's the Microsoft API we can't change it. Does the attached patch work around the problem? --------------7B62DCF4A47FC70689B77A9A Content-Type: text/x-patch; name="emacs.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="emacs.diff" diff --git a/src/conf_post.h b/src/conf_post.h index 683a96f936..dbe5befcf9 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -54,10 +54,10 @@ along with GNU Emacs. If not, see . */ ((v) < __GNUC__ + ((w) < __GNUC_MINOR__ + ((x) <= __GNUC_PATCHLEVEL__))) #endif -/* The type of bool bitfields. Needed to compile Objective-C with - standard GCC. It was also needed to port to pre-C99 compilers, - although we don't care about that any more. */ -#if NS_IMPL_GNUSTEP +/* The type of bool bitfields. Preferably bool for better debugging, + bu unsigned int on MS-Windows to avoid struct bloat, and unsigned + int for Objective-C with standard GCC. */ +#if defined DOS_NT || NS_IMPL_GNUSTEP typedef unsigned int bool_bf; #else typedef bool bool_bf; --------------7B62DCF4A47FC70689B77A9A--