GCC FIXINCLUDES

AutoGen-erated Fixincludes:
How to Fix a System Header File

i

This is just a brief summary. The detailed information can be found in the gcc sources: gcc/fixinc/README.

  1. Define a new fix in the file, "gcc/fixinc/inclhack.def".
  2. Run, "genfixes" to regenerate "fixincl.x".
  3. Rebuild the compiler.

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.



The AutoGen tool can do other things, too, of course. The interested are invited to read its doc and, please, let me know if they put it to work, even if it is only for Automated Option Processing. (AutoOpts is included with AutoGen).


top Viewable With Any Browser Valid XHTML 1.0!


AutoGen, AutoOpts, columns, getdefs, AutoFSM, AutoXDR and these web pages copyright (c) 1999-2012 Bruce Korb, all rights reserved.

fixincludes copyright (c) 1999-2012 the Free Software Foundation, all rights reserved.
Return to GNU's home page.

Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to contact the FSF.

Please send comments on these web pages to webmasters@www.gnu.org, send other questions to gnu@gnu.org.

This article, Copyright © 2000-2002 by Bruce Korb

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. Last modified: Sat Aug 30 11:01:40 PDT 2014

AltStyle によって変換されたページ (->オリジナル) /