Skip to content

Commit 9e88100

Browse files
committed
GCC 6: "gimple" changed from a ptr to the base class
1 parent 33d88ce commit 9e88100

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

gcc-c-api/gcc-cfg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ gcc_cfg_block_for_each_gimple_phi (gcc_cfg_block block,
202202
!gsi_end_p (gsi); gsi_next (&gsi))
203203
{
204204

205-
gimple stmt = gsi_stmt (gsi);
205+
gimple_stmt_ptr stmt = gsi_stmt (gsi);
206206
if (cb (gcc_private_make_gimple_phi (stmt), user_data))
207207
{
208208
return true;
@@ -231,7 +231,7 @@ gcc_cfg_block_for_each_gimple (gcc_cfg_block block,
231231
!gsi_end_p (gsi); gsi_next (&gsi))
232232
{
233233

234-
gimple stmt = gsi_stmt (gsi);
234+
gimple_stmt_ptr stmt = gsi_stmt (gsi);
235235
if (cb (gcc_private_make_gimple (stmt), user_data))
236236
{
237237
return true;

gcc-c-api/gcc-common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
#define GCC_PUBLIC_API(RETURN_TYPE) extern RETURN_TYPE
2828
#define GCC_PRIVATE_API(RETURN_TYPE) extern RETURN_TYPE
2929

30+
#if (GCC_VERSION >= 6000)
31+
typedef gimple *gimple_stmt_ptr;
32+
#else
33+
typedef gimple gimple_stmt_ptr;
34+
#endif
35+
3036
#include "gcc-public-types.h"
3137

3238
/* For internal use: */

gcc-c-api/gcc-gimple.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,21 @@ GCC_IMPLEMENT_PUBLIC_API (void) gcc_gimple_mark_in_use (gcc_gimple stmt)
5353

5454
/* GCC 4.9 converted gimple to a class hierarchy */
5555
#if (GCC_VERSION >= 4009)
56+
57+
/* GCC 6 converted the base class from "gimple_statement_base" to
58+
"gimple". */
59+
# if (GCC_VERSION >= 6000)
60+
gt_ggc_mx_gimple (stmt.inner);
61+
# else
5662
gt_ggc_mx_gimple_statement_base (stmt.inner);
57-
#else
63+
# endif
64+
#else /* #if (GCC_VERSION >= 4009) */
5865
gt_ggc_mx_gimple_statement_d (stmt.inner);
59-
#endif
66+
#endif /* #if (GCC_VERSION >= 4009) */
6067
}
6168

6269
GCC_IMPLEMENT_PRIVATE_API (struct gcc_gimple_phi)
63-
gcc_private_make_gimple_phi (gimple inner)
70+
gcc_private_make_gimple_phi (gimple_stmt_ptr inner)
6471
{
6572
struct gcc_gimple_phi result;
6673
GIMPLE_CHECK (inner, GIMPLE_PHI);
@@ -69,7 +76,7 @@ gcc_private_make_gimple_phi (gimple inner)
6976
}
7077

7178
GCC_IMPLEMENT_PRIVATE_API (struct gcc_gimple_call)
72-
gcc_private_make_gimple_call (gimple inner)
79+
gcc_private_make_gimple_call (gimple_stmt_ptr inner)
7380
{
7481
struct gcc_gimple_call result;
7582
GIMPLE_CHECK (inner, GIMPLE_CALL);
@@ -78,7 +85,7 @@ gcc_private_make_gimple_call (gimple inner)
7885
}
7986

8087
GCC_IMPLEMENT_PRIVATE_API (struct gcc_gimple)
81-
gcc_private_make_gimple (gimple inner)
88+
gcc_private_make_gimple (gimple_stmt_ptr inner)
8289
{
8390
struct gcc_gimple result;
8491
result.inner = inner;

gcc-c-api/gimple.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<doc>GIMPLE statements</doc>
2323

24-
<type name="gimple" varname="stmt" inner="gimple">
24+
<type name="gimple" varname="stmt" inner="gimple_stmt_ptr">
2525
<attribute name="location" kind="location">
2626
<doc>Source code location of this statement</doc>
2727
</attribute>

0 commit comments

Comments
 (0)