From patchwork Tue Jun 8 20:49:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 55033 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 6A4DCB7D61 for ; Wed, 9 Jun 2010 06:49:48 +1000 (EST) Received: (qmail 11784 invoked by alias); 8 Jun 2010 20:49:46 -0000 Received: (qmail 11758 invoked by uid 22791); 8 Jun 2010 20:49:43 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, MIME_QP_LONG_LINE, 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 20:49:36 +0000 Received: from unknown (HELO epsilon2) ([192.168.1.60]) by c60.cesmail.net with ESMTP; 08 Jun 2010 16:49:34 -0400 Received: from 78.146.185.72 ([78.146.185.72]) by webmail.spamcop.net (Horde MIME library) with HTTP; Tue, 08 Jun 2010 16:49:34 -0400 Message-ID: <20100608164934.akp4w232mo8oco08-nzlynne@webmail.spamcop.net> Date: Tue, 08 Jun 2010 16:49:34 -0400 From: Joern Rennecke To: gcc-patches@gcc.gnu.org Subject: Update: RFA: Fix PR testsuite/42843 References: <20100122185524.06uho17jks0ggc4c-nzlynne@webmail.spamcop.net> In-Reply-To: <20100122185524.06uho17jks0ggc4c-nzlynne@webmail.spamcop.net> 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 This is an update of the patch to trunk revision 160389, which takes changes in Makefile.in and lib/plugin-support.exp into account. I've also added changes to gcc-plugin.h / doc/plugins.texi to prevent potential problems with name mangling of plugin_is_GPL_compatible, as diccussed in this thread: http://gcc.gnu.org/ml/gcc/2010-06/msg00319.html Bootstrapped and regression tested in revision 160389; there are no regressions for an --enable-build-with-cxx build with this patch compared with a C of unmodified revision 160389 trunk. 2010-01-22 Joern Rennecke gcc: PR testsuite/42843 * gcc-plugin.h (int plugin_is_GPL_compatible): Declare as extern "C". * doc/plugins.texi (Plugin license check): Update information on type of plugin_is_GPL_compatible. * Makefile.in (PLUGINCC): Define as $(COMPILER). (PLUGINCFLAGS): Define as $(COMPILER_FLAGS). gcc/testsuite: PR testsuite/42843 * gcc.dg/plugin/selfassign.c (pass_warn_self_assign): Use enumerator TV_NONE to initialize tv_id field. * g++.dg/plugin/selfassign.c (pass_warn_self_assign): Likewise. * gcc.dg/plugin/one_time_plugin.c (one_pass): Likewise. * g++.dg/plugin/dumb_plugin.c (pass_dumb_plugin_example): Likewise. Include toplev.h . * gcc.dg/plugin/finish_unit_plugin.c: Include cgraph.h. * g++.dg/plugin/attribute_plugin.c: Include toplev.h and plugin.h . * g++.dg/plugin/pragma_plugin.c: Include toplev.h . Index: gcc/doc/plugins.texi =================================================================== --- gcc/doc/plugins.texi (revision 160389) +++ gcc/doc/plugins.texi (working copy) @@ -50,8 +50,10 @@ fatal error: plugin is not licens compilation terminated @end smallexample -The type of the symbol is irrelevant. The compiler merely asserts that -it exists in the global scope. Something like this is enough: +The declared type of the symbol should be int, to match a forward declaration +in @file{gcc-plugin.h} that suppresses C++ mangling. It does not need to be in +any allocated section, though. The compiler merely asserts that +the symbol exists in the global scope. Something like this is enough: @smallexample int plugin_is_GPL_compatible; Index: gcc/testsuite/gcc.dg/plugin/selfassign.c =================================================================== --- gcc/testsuite/gcc.dg/plugin/selfassign.c (revision 160389) +++ gcc/testsuite/gcc.dg/plugin/selfassign.c (working copy) @@ -275,7 +275,7 @@ static struct gimple_opt_pass pass_warn_ NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ - 0, /* tv_id */ + TV_NONE, /* tv_id */ PROP_ssa, /* properties_required */ 0, /* properties_provided */ 0, /* properties_destroyed */ Index: gcc/testsuite/gcc.dg/plugin/one_time_plugin.c =================================================================== --- gcc/testsuite/gcc.dg/plugin/one_time_plugin.c (revision 160389) +++ gcc/testsuite/gcc.dg/plugin/one_time_plugin.c (working copy) @@ -37,7 +37,7 @@ struct gimple_opt_pass one_pass = NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ - 0, /* tv_id */ + TV_NONE, /* tv_id */ PROP_gimple_any, /* properties_required */ 0, /* properties_provided */ 0, /* properties_destroyed */ Index: gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c =================================================================== --- gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c (revision 160389) +++ gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c (working copy) @@ -12,6 +12,7 @@ #include "tree.h" #include "tree-pass.h" #include "intl.h" +#include "cgraph.h" int plugin_is_GPL_compatible; Index: gcc/testsuite/g++.dg/plugin/selfassign.c =================================================================== --- gcc/testsuite/g++.dg/plugin/selfassign.c (revision 160389) +++ gcc/testsuite/g++.dg/plugin/selfassign.c (working copy) @@ -275,7 +275,7 @@ static struct gimple_opt_pass pass_warn_ NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ - 0, /* tv_id */ + TV_NONE, /* tv_id */ PROP_ssa, /* properties_required */ 0, /* properties_provided */ 0, /* properties_destroyed */ Index: gcc/testsuite/g++.dg/plugin/attribute_plugin.c =================================================================== --- gcc/testsuite/g++.dg/plugin/attribute_plugin.c (revision 160389) +++ gcc/testsuite/g++.dg/plugin/attribute_plugin.c (working copy) @@ -8,6 +8,8 @@ #include "tree.h" #include "tree-pass.h" #include "intl.h" +#include "toplev.h" +#include "plugin.h" int plugin_is_GPL_compatible; Index: gcc/testsuite/g++.dg/plugin/dumb_plugin.c =================================================================== --- gcc/testsuite/g++.dg/plugin/dumb_plugin.c (revision 160389) +++ gcc/testsuite/g++.dg/plugin/dumb_plugin.c (working copy) @@ -9,6 +9,7 @@ #include "tree.h" #include "tree-pass.h" #include "intl.h" +#include "toplev.h" int plugin_is_GPL_compatible; @@ -65,7 +66,7 @@ static struct gimple_opt_pass pass_dumb_ NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ - 0, /* tv_id */ + TV_NONE, /* tv_id */ PROP_cfg, /* properties_required */ 0, /* properties_provided */ 0, /* properties_destroyed */ Index: gcc/testsuite/g++.dg/plugin/pragma_plugin.c =================================================================== --- gcc/testsuite/g++.dg/plugin/pragma_plugin.c (revision 160389) +++ gcc/testsuite/g++.dg/plugin/pragma_plugin.c (working copy) @@ -13,6 +13,7 @@ #include "cpplib.h" #include "tree-pass.h" #include "intl.h" +#include "toplev.h" int plugin_is_GPL_compatible; Index: gcc/gcc-plugin.h =================================================================== --- gcc/gcc-plugin.h (revision 160389) +++ gcc/gcc-plugin.h (working copy) @@ -147,4 +147,15 @@ extern int unregister_callback (const ch -iplugindir program argument to cc1. */ extern const char* default_plugin_dir_name (void); +/* In case the C++ compiler does name mangling for globals, declare + plugin_is_GPL_compatible extern "C" so that a later definition + in a plugin file will have this linkage. */ +#ifdef __cplusplus +extern "C" { +#endif +extern int plugin_is_GPL_compatible; +#ifdef __cplusplus +} +#endif + #endif /* GCC_PLUGIN_H */ Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 160389) +++ gcc/Makefile.in (working copy) @@ -331,10 +331,10 @@ LTO_BINARY_READER = @LTO_BINARY_READER@ LTO_USE_LIBELF = @LTO_USE_LIBELF@ # Compiler needed for plugin support -PLUGINCC = @CC@ +PLUGINCC = $(COMPILER) # Flags needed for plugin support -PLUGINCFLAGS = @CFLAGS@ +PLUGINCFLAGS = $(COMPILER_FLAGS) # Libs and linker options needed for plugin support PLUGINLIBS = @pluginlibs@