From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2304 invoked by alias); 12 May 2009 09:48:08 -0000 Received: (qmail 2291 invoked by uid 22791); 12 May 2009 09:48:06 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 May 2009 09:47:58 +0000 Received: from zps18.corp.google.com (zps18.corp.google.com [172.25.146.18]) by smtp-out.google.com with ESMTP id n4C9loQV000874 for ; Tue, 12 May 2009 10:47:50 +0100 Received: from bwz11 (bwz11.prod.google.com [10.188.26.11]) by zps18.corp.google.com with ESMTP id n4C9lgHX003037 for ; Tue, 12 May 2009 02:47:43 -0700 Received: by bwz11 with SMTP id 11so3418904bwz.32 for ; Tue, 12 May 2009 02:47:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.182.3 with SMTP id j3mr5098889mup.107.1242121662288; Tue, 12 May 2009 02:47:42 -0700 (PDT) In-Reply-To: <4A093468.9010504@starynkevitch.net> References: <4A093468.9010504@starynkevitch.net> Date: Tue, 12 May 2009 11:51:00 -0000 Message-ID: <38a0d8450905120247r390c4c71na22c95dd8eb873c4@mail.gmail.com> Subject: Re: plugins callbacks and data From: Rafael Espindola To: Basile STARYNKEVITCH Cc: GCC Mailing List , Le-Chun Wu Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-05/txt/msg00298.txt.bz2 2009/5/12 Basile STARYNKEVITCH : > Hello All > > In the current plugin API, the function register_callback is used to > register callback routines (eg PLUGIN_FINISH_UNIT) in which case the > callback is expected to be a routine. But this same function > register_callback is used also to register some data to plugins, without = any > call back functions, eg for PLUGIN_PASS_MANAGER_SETUP. > > Perhaps we could have two different functions: > > 1. =C2=A0register_callback like before for true callbacks > > and > > 2. =C2=A0register_data for registering data, like for PLUGIN_PASS_MANAGER= _SETUP > or PLUGIN_INFO, declared as > =C2=A0void register_data (const char *plugin_name, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0enum plugin= _event event,, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0void* user_= data); > ? > > What do you think? No strong preference one way or the other. One small advantage of the current model is that we have only switch statement over all "enum plugin_event" values. The function already existed when I joined, maybe Le-Chu has some opinion about your proposal. > > Regards. Cheers, --=20 Rafael Avila de Espindola Google | Gordon House | Barrow Street | Dublin 4 | Ireland Registered in Dublin, Ireland | Registration Number: 368047