What version of GCC are you using, both to compile your plugin and to use the plugin? Just skip
gcc -v
without any other program argument to find out!
Has the appropriate package for developing GCC plugins been installed (on Debian or Ubuntu it can be gcc-4.7-plugin-dev , but adapt version 4.7 to your specific version of GCC)?
Have you installed all the dependencies needed to create GCC (on Debian or Ubuntu, apt-get build-dep gcc-4.7 gcc-4.7-plugin-dev )?
Recent versions of GCC (especially many GCC 4.7 shipped by distributions and all GCC 4.8) are compiled by the C ++ compiler, not the C compiler.
You can check how your GCC was created (in C or C ++) by running
nm -D -C $(gcc -print-file-name=cc1)
If this command shows C ++ typed names, for example, execute_ipa_pass_list(opt_pass*) instead of just execute_ipa_pass_list your GCC was compiled using the C ++ compiler (possibly g++ )
Thus, you may need to use g++ (not gcc ) to compile your GCC plugin.
As I commented, have you considered using MELT (a domain specific language for the GCC extension) to extend or customize your gcc compiler?
I suggest downloading the latest http://gcc-melt.org/melt-plugin-snapshot.tar.bz2 since I will release the next MELT in a few weeks for GCC 4.7 and 4.8
And don't expect parsing behavior to change in your GCC with the plugin. This is actually not possible (GCC provides only plugins to add your inline and pragmatic elements, and not to extend the parsing syntax).
Basile starynkevitch
source share