Skip to content

Commit cf7340d

Browse files
committed
Compat fix for building against 4.9
c_sizeof_or_alignof_type changed signature in 4.9; update accordingly.
1 parent ef48966 commit cf7340d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

gcc-python-compat.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
Copyright 2011, 2012 David Malcolm <dmalcolm@redhat.com>
3-
Copyright 2011, 2012 Red Hat, Inc.
2+
Copyright 2011, 2012, 2014 David Malcolm <dmalcolm@redhat.com>
3+
Copyright 2011, 2012, 2014 Red Hat, Inc.
44
55
This is free software: you can redistribute it and/or modify it
66
under the terms of the GNU General Public License as published by
@@ -54,7 +54,9 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
5454
extern bool ggc_force_collect;
5555

5656
/* From c-family/c-common.h */
57+
#if GCC_VERSION < 4008
5758
extern tree c_sizeof_or_alignof_type (location_t, tree, bool, int);
59+
#endif
5860

5961

6062
/*

gcc-python-tree.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,15 @@ PyGccType_get_sizeof(struct PyGccTree *self, void *closure)
471471
/*
472472
c_sizeof_or_alignof_type wants a location; we use a fake one
473473
*/
474-
tree t_sizeof = c_sizeof_or_alignof_type(input_location, self->t.inner, true, 0);
474+
tree t_sizeof = c_sizeof_or_alignof_type(input_location, self->t.inner, true,
475+
#if (GCC_VERSION >= 4009)
476+
false,
477+
#endif
478+
0);
475479
PyObject *str;
476480

481+
/* Did TREE_INT_CST go away in 5.0? (wide-int?) */
482+
477483
/* This gives us either an INTEGER_CST or the dummy error type: */
478484
if (INTEGER_CST == TREE_CODE(t_sizeof)) {
479485
return PyGcc_int_from_double_int(TREE_INT_CST(t_sizeof),

0 commit comments

Comments
 (0)