From patchwork Tue Jun 8 12:36:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 54968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 8A2B8B7D59 for ; Tue, 8 Jun 2010 22:37:05 +1000 (EST) Received: (qmail 6545 invoked by alias); 8 Jun 2010 12:36:59 -0000 Received: (qmail 6526 invoked by uid 22791); 8 Jun 2010 12:36:58 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL, BAYES_40, RCVD_IN_DNSWL_LOW, TW_CX X-Spam-Check-By: sourceware.org Received: from c60.cesmail.net (HELO c60.cesmail.net) (216.154.195.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Jun 2010 12:36:48 +0000 Received: from unknown (HELO epsilon2) ([192.168.1.60]) by c60.cesmail.net with ESMTP; 08 Jun 2010 08:36:46 -0400 Received: from 78.146.185.72 ([78.146.185.72]) by webmail.spamcop.net (Horde MIME library) with HTTP; Tue, 08 Jun 2010 08:36:46 -0400 Message-ID: <20100608083646.xy0ergvgroskoogk-nzlynne@webmail.spamcop.net> Date: Tue, 08 Jun 2010 08:36:46 -0400 From: Joern Rennecke To: gcc-patches@gcc.gnu.org Subject: RFA: Fix plugins/44459 1/2 MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org I have divided the patch set for this PR into two parts to allow separate review: This one, the first part, changes only gcc-plugin.h ; the purpose of this file is quite obviously to provide a part of the plugin interface. Bootstrapped and regression tested in 160389 with --enable-build-with-cxx This patch by itself allows testsuite/gcc.dg/plugin/one_time_plugin.c to be compiled with gcc into a functioning gcc plugin. I would consider this patch alone a possible fix for PR 44459, although I'd prefer to have more functionality supported, as would be available by combining both parts of this patch set, or this part with a modified second part. 2010-06-08 Joern Rennecke PR plugins/44459: * gcc-plugin.h: Encapsulate all declarations in extern "C". Index: gcc-plugin.h =================================================================== --- gcc-plugin.h (revision 160389) +++ gcc-plugin.h (working copy) @@ -38,6 +38,12 @@ enum plugin_event PLUGIN_EVENT_FIRST_DYNAMIC }; +/* All globals declared here have C linkage to reduce link compatibility + issues with implementation language choice and mangling. */ +#ifdef __cplusplus +extern "C" { +#endif + extern const char **plugin_event_name; struct plugin_argument @@ -96,16 +102,10 @@ extern bool plugin_default_version_check typedef int (*plugin_init_func) (struct plugin_name_args *plugin_info, struct plugin_gcc_version *version); -#ifdef __cplusplus -extern "C" { -#endif /* Declaration for "plugin_init" function so that it doesn't need to be duplicated in every plugin. */ extern int plugin_init (struct plugin_name_args *plugin_info, struct plugin_gcc_version *version); -#ifdef __cplusplus -} -#endif /* Function type for a plugin callback routine. @@ -147,4 +147,8 @@ extern int unregister_callback (const ch -iplugindir program argument to cc1. */ extern const char* default_plugin_dir_name (void); +#ifdef __cplusplus +} +#endif + #endif /* GCC_PLUGIN_H */