This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] [wwwdocs] Add a "Plugin issues" section to the GCC 6 porting guide


I've (mostly) ported gcc-python-plugin to gcc 6.  The attached patch
for the gcc website starts a new "Plugin issues" section, and covers
the biggest issue I ran into (FWIW the suggested compatibility typedef
is the one I committed to gcc-python-plugin).

Validates.

OK to commit?
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)
 }
 </code></pre>
 
+<h2>Plugin issues</h2>
+
+<p>
+The internals of GCC have seen various improvements, and these may affect
+plugins.  Some notes on porting GCC plugins to GCC 6 follow.
+</p>
+
+<h3>"gimple" became a struct, rather than a pointer</h3>
+
+<p>
+Prior to GCC 6, "gimple" meant a <b>pointer</b> to a statement.  It was a
+typedef aliasing the type <code>struct gimple_statement_base *</code>:
+</p>
+
+<pre><code>
+/* 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;
+</code></pre>
+
+<p>
+As of GCC 6, the code above became:
+</p>
+
+<pre><code>
+/* Excerpt from GCC 6's coretypes.h.  */
+struct gimple;
+typedef gimple *gimple_seq;
+</code></pre>
+
+<p>"gimple" is now the statement <b>struct</b> itself, not a pointer.
+The "gimple" struct is now the base class of the gimple statement class
+hierarchy, and throughout gcc every <code>gimple</code> was changed to a
+<code>gimple *</code>
+(revision
+<a href="https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=42acab1cd6812e2d9e49f4132176f5505f49a0e5";>r227941</a>
+was the commit in question).  The typedef <code>const_gimple</code> is no more;
+use <code>const gimple *</code> if you need to represent a pointer
+to a unmodifiable gimple statement.
+</p>
+
+<p>
+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:
+</p>
+
+<pre><code>
+#if (GCC_VERSION >= 6000)
+typedef gimple *gimple_stmt_ptr;
+#else
+typedef gimple gimple_stmt_ptr;
+#end
+</code></pre>
+
 <h3>Links</h3>
 
 </body>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]