Index: htdocs/gcc-6/porting_to.html =================================================================== RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-6/porting_to.html,v retrieving revision 1.10 diff -u -p -r1.10 porting_to.html --- htdocs/gcc-6/porting_to.html 11 Feb 2016 10:37:00 -0000 1.10 +++ htdocs/gcc-6/porting_to.html 11 Feb 2016 15:02:29 -0000 @@ -350,6 +350,63 @@ foo (void *p) } +

Plugin issues

+ +

+The internals of GCC have seen various improvements, and these may affect +plugins. Some notes on porting GCC plugins to GCC 6 follow. +

+ +

"gimple" became a struct, rather than a pointer

+ +

+Prior to GCC 6, "gimple" meant a pointer to a statement. It was a +typedef aliasing the type struct gimple_statement_base *: +

+ +

+/* Excerpt from GCC 5's coretypes.h.  */
+typedef struct gimple_statement_base *gimple;
+typedef const struct gimple_statement_base *const_gimple;
+typedef gimple gimple_seq;
+
+ +

+As of GCC 6, the code above became: +

+ +

+/* Excerpt from GCC 6's coretypes.h.  */
+struct gimple;
+typedef gimple *gimple_seq;
+
+ +

"gimple" is now the statement struct itself, not a pointer. +The "gimple" struct is now the base class of the gimple statement class +hierarchy, and throughout gcc every gimple was changed to a +gimple * +(revision +r227941 +was the commit in question). The typedef const_gimple is no more; +use const gimple * if you need to represent a pointer +to a unmodifiable gimple statement. +

+ +

+Plugins that work with gimple will need to be updated to reflect this +change. If you aim for compatibility between both gcc 6 and earlier +releases of gcc, it may be cleanest to introduce a compatibility typedef +in your plugin, such as: +

+ +

+#if (GCC_VERSION >= 6000)
+typedef gimple *gimple_stmt_ptr;
+#else
+typedef gimple gimple_stmt_ptr;
+#end
+
+

Links