From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9962 invoked by alias); 12 Jun 2012 20:48:11 -0000 Received: (qmail 9953 invoked by uid 22791); 12 Jun 2012 20:48:10 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,TW_EG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Jun 2012 20:47:57 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5CKluZG021605 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 12 Jun 2012 16:47:57 -0400 Received: from host2.jankratochvil.net (ovpn-116-33.ams2.redhat.com [10.36.116.33]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5CKlqoR013308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Tue, 12 Jun 2012 16:47:54 -0400 Date: Tue, 12 Jun 2012 20:48:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Fix Sun compiler compat. for empty structs (PR build/14003) Message-ID: <20120612204751.GA13700@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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/msg00370.txt.bz2 Hi, build fails on solaris in infrun.c because of empty inferior_suspend_state struct http://sourceware.org/bugzilla/show_bug.cgi?id=14003 I do not think the struct should be completely removed as it may suggest where is appropriate to put some possible new fields. Tom suggested putting there 'char dummy;' but this degrade normal systems because of some worse systems. Providing autoconf check for it seems excessive for me. Any style issues with this fix? Thanks, Jan 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. diff --git a/gdb/inferior.h b/gdb/inferior.h index dfcbda4..c4ad434 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -395,11 +395,13 @@ struct inferior_control_state /* Inferior process specific part of `struct infcall_suspend_state'. - Inferior thread counterpart is `struct thread_suspend_state'. */ + Inferior thread counterpart is `struct thread_suspend_state'. struct inferior_suspend_state { + Currently unused and some compilers do not accept empty structures. }; + */ /* GDB represents the state of each program execution with an object called an inferior. An inferior typically corresponds to a process @@ -430,8 +432,11 @@ struct inferior struct inferior_control_state control; /* State of inferior process to restore after GDB is done with an inferior - call. See `struct inferior_suspend_state'. */ + call. See `struct inferior_suspend_state'. + + Currently unused and some compilers do not accept empty structures. struct inferior_suspend_state suspend; + */ /* True if this was an auto-created inferior, e.g. created from following a fork; false, if this inferior was manually added by diff --git a/gdb/infrun.c b/gdb/infrun.c index b98e379..81182c2 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -6639,7 +6639,10 @@ siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var, struct infcall_suspend_state { struct thread_suspend_state thread_suspend; + + /* Currently unused and some compilers do not accept empty structures. struct inferior_suspend_state inferior_suspend; + */ /* Other fields: */ CORE_ADDR stop_pc; @@ -6693,7 +6696,10 @@ save_infcall_suspend_state (void) } inf_state->thread_suspend = tp->suspend; + + /* Currently unused and some compilers do not accept empty structures. inf_state->inferior_suspend = inf->suspend; + */ /* run_inferior_call will not use the signal due to its `proceed' call with GDB_SIGNAL_0 anyway. */ @@ -6717,7 +6723,10 @@ restore_infcall_suspend_state (struct infcall_suspend_state *inf_state) struct gdbarch *gdbarch = get_regcache_arch (regcache); tp->suspend = inf_state->thread_suspend; + + /* Currently unused and some compilers do not accept empty structures. inf->suspend = inf_state->inferior_suspend; + */ stop_pc = inf_state->stop_pc;