diff mbox

Update: RFA: Fix PR testsuite/42843

Message ID 20100608164934.akp4w232mo8oco08-nzlynne@webmail.spamcop.net
State New
Headers show

Commit Message

Joern Rennecke June 8, 2010, 8:49 p.m. UTC
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  <amylaar@spamcop.net>

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 .

Comments

Richard Biener June 9, 2010, 9:49 a.m. UTC | #1
On Tue, Jun 8, 2010 at 10:49 PM, Joern Rennecke <amylaar@spamcop.net> wrote:
> 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.

Ok.

Thanks,
Richard.

> 2010-01-22  Joern Rennecke  <amylaar@spamcop.net>
>
> 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 <name> 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@
>
>
diff mbox

Patch

Index: gcc/doc/plugins.texi
===================================================================
--- gcc/doc/plugins.texi	(revision 160389)
+++ gcc/doc/plugins.texi	(working copy)
@@ -50,8 +50,10 @@  fatal error: plugin <name> 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@