This is just a brief summary. The detailed information can be found in the gcc sources: gcc/fixinc/README.
There is no need to comprehend immensly complex shell scripting. There is a little bit of effort required to "define a new fix", but the syntax and examples are fairly simple and straight forward. Here is a very simple example that changes a reserved word used as a prototype argument into a non-reserved word. For the real details, see the README:
/*
 *  class in Xm/BaseClassI.h
 */
fix = {
    hackname  = x11_class_usage;
    files     = Xm/BaseClassI.h;
    bypass    = "__cplusplus"; /* skip fix if C++ aware */
    select    = " class\\)";   /* apply fix if found */
    c_fix     = format;
    c_fix_arg = " c_class)";
    test_text = "extern mumble (int  class);\n";
};
This "include hack" will replace every occurrance of " class)"
in the file ``/usr/include/Xm/BaseClassI.h'' with
" c_class)", thus converting the test_text
to:
    extern mumble (int  c_class);
The "select" expression is
a regex regular expression.