xiangzhai / dragonegg

DragonEgg has been migrated to GCC 8 and LLVM 6 but also able to work for GCC 4.8 and LLVM 3.3
https://gcc.gnu.org/ml/gcc/2017-08/msg00245.html
GNU General Public License v2.0
18 stars 6 forks source link

Migrate gimple_statement_d #11

Closed xiangzhai closed 7 years ago

xiangzhai commented 7 years ago

GCC v4.x:

union gimple_statement_d;                                                          
typedef union gimple_statement_d *gimple;

but after GCC v5.x as ChangeLog described:

2013-11-19  David Malcolm  <dmalcolm@redhat.com>                                

    Convert gimple types from a union to C++ inheritance.                       
    * Makefile.in (GIMPLE_H): Add dep on is-a.h.                                
    * coretypes.h (union gimple_statement_d): Remove declaration.               
    (gimple): Convert from being a "union gimple_statement_d *"                 
    to a "struct gimple_statement_base *"
...

Workaround by adding GimpleTy data type:

union gimple_statement_d;                                                          
#if (GCC_MAJOR > 4)                                                                
struct gimple;                                                                     
typedef struct gimple GimpleTy;                                                    
#else                                                                              
typedef union gimple_statement_d GimpleTy;                                         
#endif