From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6896 invoked by alias); 28 Feb 2003 16:39:55 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 6889 invoked from network); 28 Feb 2003 16:39:54 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by 172.16.49.205 with SMTP; 28 Feb 2003 16:39:54 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 18opRQ-0006Db-00 for ; Fri, 28 Feb 2003 12:41:05 -0600 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 18onY9-0006QJ-00 for ; Fri, 28 Feb 2003 11:39:53 -0500 Date: Fri, 28 Feb 2003 16:39:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: [commit] new observer.[hc] files Message-ID: <20030228163953.GB24652@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20030228072243.GD6112@gnat.com> <20030228152256.GB23109@nevyn.them.org> <3E5F8B86.9080902@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3E5F8B86.9080902@redhat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-02/txt/msg00817.txt.bz2 On Fri, Feb 28, 2003 at 11:17:10AM -0500, Andrew Cagney wrote: > >static void > >>observer_normal_stop_notification_stub (const void *data, > >> const void *unused_args) > >>{ > >> observer_normal_stop_ftype *notify = (observer_normal_stop_ftype *) > >> data; > >> (*notify) (); > >>} > > > > > >Is this extra indirection really necessary? Because I'm 99% sure it > >won't work on several 64-bit platforms. Function pointers and data > >pointers are not required to have the same size; on IA-64 I believe > >that a function pointer is 128 bits and a data pointer is 64 bits. > > Like the PowerABI? That has a 32 bit pointer but a 64 bit function > descriptor. void* ends up containing the address of the function > descriptor. Anyway, "defs.h" has the comment: > > /* NOTE: cagney/2000-03-04: This typedef is strictly for the > make_cleanup function declarations below. Do not use this typedef > as a cast when passing functions into the make_cleanup() code. > Instead either use a bounce function or add a wrapper function. > Calling a f(char*) function with f(void*) is non-portable. */ > typedef void (make_cleanup_ftype) (void *); > > Once the code gets converted into a SED script, it can always be changed > to something more strict. > > >Why not require all observer functions to take the same arguments > >instead? > > Per the original thread, it is to ensure strongly typed interfaces. OK, that makes good sense. Anyway, my concerns about casting a function pointer to void* seem to have be moot; we can eliminate some of the grossness when/if this becomes a generated file. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer