
I Built a GCC Plugin for Struct Inheritance
If you have entered the world of programming, there is a fair chance that you have heard of C or learned C. As a language, C is very robust and simple language but it is lagging behind the newer languages that have more features and buttons. Which is why I took it upon myself to begin a journey of adding more features via GCC Plugins. Boilerplate To begin with, we need a c file to contain all our plugin code. So we will begin with the basic plugin boilerplate. // plugin.c #include "gcc-plugin.h" #include "plugin-version.h" #include "diagnostic.h" // This is required for GCC to accept the plugin int plugin_is_GPL_compatible ; // This is where we will register the plugin hooks int plugin_init ( struct plugin_name_args * plugin_info , struct plugin_gcc_version * version ) { // It's good practice to check for a compatible gcc version if ( ! plugin_default_version_check ( version , & gcc_version )) { return 1 ; } // A little message so that we know the plugin loads warning ( UNKNOWN_LOCATIO
Continue reading on Dev.to
Opens in a new tab



