From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24449 invoked by alias); 12 Jun 2012 21:24:40 -0000 Received: (qmail 24432 invoked by uid 22791); 12 Jun 2012 21:24:38 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Jun 2012 21:24:25 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id F26021C617A; Tue, 12 Jun 2012 17:24:24 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id sBIq761w3tqM; Tue, 12 Jun 2012 17:24:24 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id C0E441C615F; Tue, 12 Jun 2012 17:24:24 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 1351C145616; Tue, 12 Jun 2012 14:24:13 -0700 (PDT) Date: Tue, 12 Jun 2012 21:24:00 -0000 From: Joel Brobecker To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch] Fix Sun compiler compat. for empty structs (PR build/14003) Message-ID: <20120612212413.GS2687@adacore.com> References: <20120612204751.GA13700@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120612204751.GA13700@host2.jankratochvil.net> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00372.txt.bz2 > Tom suggested putting there 'char dummy;' but this degrade normal systems > because of some worse systems. Actually, the compiler is somewhat correct in this case. In C89, it's really fuzzy whether empty structs are allowed or not, but my understanding is that it is forbidden with C99: A structure type describes a sequentially allocated nonempty set of member objects [...] So I think that we shouldn't be defining empty structs anyway (to my dismay - I don't know what would be wrong with empty structures, but ISTR seeing a discussion about something similar with Ada, whereby two distinct objects must have distinct addresses, and thus must have a non-zero size). > Providing autoconf check for it seems excessive for me. In light of the above, agreed. > 2012-06-12 Jan Kratochvil > > PR build/14003 > * inferior.h (struct inferior_suspend_state): Comment out. > (struct inferior): Comment out the field suspend. > * infrun.c (struct infcall_suspend_state): Comment out the field > inferior_suspend. > (save_infcall_suspend_state, restore_infcall_suspend_state): Comment > out its assignment. Just my 2 cents: Given the number of such structs being allocated, I'd rather waste the few bytes than making the code uglier. But it's not a strong opinion, and I'd accept this patch too. Perhaps using #if 0 instead might make it looks like a little less unusual, not sure... -- Joel