⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 running-protoize.html

📁 自己收集的linux入门到学懂高级编程书集 包括linux程序设计第三版
💻 HTML
字号:
<html lang="en"><head><title>Using the GNU Compiler Collection (GCC)</title><meta http-equiv="Content-Type" content="text/html"><meta name="description" content="Using the GNU Compiler Collection (GCC)"><meta name="generator" content="makeinfo 4.6"><!--Copyright &copy; 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.   <p>Permission is granted to copy, distribute and/or modify this documentunder the terms of the GNU Free Documentation License, Version 1.2 orany later version published by the Free Software Foundation; with theInvariant Sections being "GNU General Public License" and "FundingFree Software", the Front-Cover texts being (a) (see below), and withthe Back-Cover Texts being (b) (see below).  A copy of the license isincluded in the section entitled "GNU Free Documentation License".   <p>(a) The FSF's Front-Cover Text is:   <p>A GNU Manual   <p>(b) The FSF's Back-Cover Text is:   <p>You have freedom to copy and modify this GNU Manual, like GNU     software.  Copies published by the Free Software Foundation raise     funds for GNU development.--><meta http-equiv="Content-Style-Type" content="text/css"><style type="text/css"><!--  pre.display { font-family:inherit }  pre.format  { font-family:inherit }  pre.smalldisplay { font-family:inherit; font-size:smaller }  pre.smallformat  { font-family:inherit; font-size:smaller }  pre.smallexample { font-size:smaller }  pre.smalllisp    { font-size:smaller }--></style></head><body><div class="node"><p>Node:&nbsp;<a name="Running%20Protoize">Running Protoize</a>,Previous:&nbsp;<a rel="previous" accesskey="p" href="Precompiled-Headers.html#Precompiled%20Headers">Precompiled Headers</a>,Up:&nbsp;<a rel="up" accesskey="u" href="Invoking-GCC.html#Invoking%20GCC">Invoking GCC</a><hr><br></div><h3 class="section">Running Protoize</h3><p>The program <code>protoize</code> is an optional part of GCC.  You can useit to add prototypes to a program, thus converting the program to ISOC in one respect.  The companion program <code>unprotoize</code> does thereverse: it removes argument types from any prototypes that are found.   <p>When you run these programs, you must specify a set of source files ascommand line arguments.  The conversion programs start out by compilingthese files to see what functions they define.  The information gatheredabout a file <var>foo</var> is saved in a file named <code></code><var>foo</var><code>.X</code>.   <p>After scanning comes actual conversion.  The specified files are alleligible to be converted; any files they include (whether sources orjust headers) are eligible as well.   <p>But not all the eligible files are converted.  By default,<code>protoize</code> and <code>unprotoize</code> convert only source and headerfiles in the current directory.  You can specify additional directorieswhose files should be converted with the <code>-d </code><var>directory</var><code></code>option.  You can also specify particular files to exclude with the<code>-x </code><var>file</var><code></code> option.  A file is converted if it is eligible, itsdirectory name matches one of the specified directory names, and itsname within the directory has not been excluded.   <p>Basic conversion with <code>protoize</code> consists of rewriting mostfunction definitions and function declarations to specify the types ofthe arguments.  The only ones not rewritten are those for varargsfunctions.   <p><code>protoize</code> optionally inserts prototype declarations at thebeginning of the source file, to make them available for any calls thatprecede the function's definition.  Or it can insert prototypedeclarations with block scope in the blocks where undeclared functionsare called.   <p>Basic conversion with <code>unprotoize</code> consists of rewriting mostfunction declarations to remove any argument types, and rewritingfunction definitions to the old-style pre-ISO form.   <p>Both conversion programs print a warning for any function declaration ordefinition that they can't convert.  You can suppress these warningswith <code>-q</code>.   <p>The output from <code>protoize</code> or <code>unprotoize</code> replaces theoriginal source file.  The original file is renamed to a name endingwith <code>.save</code> (for DOS, the saved filename ends in <code>.sav</code>without the original <code>.c</code> suffix).  If the <code>.save</code> (<code>.sav</code>for DOS) file already exists, then the source file is simply discarded.   <p><code>protoize</code> and <code>unprotoize</code> both depend on GCC itself toscan the program and collect information about the functions it uses. So neither of these programs will work until GCC is installed.   <p>Here is a table of the options you can use with <code>protoize</code> and<code>unprotoize</code>.  Each option works with both programs unlessotherwise stated.     <dl><dt><code>-B </code><var>directory</var><code></code>     <dd>Look for the file <code>SYSCALLS.c.X</code> in <var>directory</var>, instead of theusual directory (normally <code>/usr/local/lib</code>).  This file containsprototype information about standard system functions.  This optionapplies only to <code>protoize</code>.     <br><dt><code>-c </code><var>compilation-options</var><code></code>     <dd>Use <var>compilation-options</var> as the options when running <code>gcc</code> toproduce the <code>.X</code> files.  The special option <code>-aux-info</code> isalways passed in addition, to tell <code>gcc</code> to write a <code>.X</code> file.     <p>Note that the compilation options must be given as a single argument to<code>protoize</code> or <code>unprotoize</code>.  If you want to specify several<code>gcc</code> options, you must quote the entire set of compilation optionsto make them a single word in the shell.     <p>There are certain <code>gcc</code> arguments that you cannot use, because theywould produce the wrong kind of output.  These include <code>-g</code>,<code>-O</code>, <code>-c</code>, <code>-S</code>, and <code>-o</code> If you include these inthe <var>compilation-options</var>, they are ignored.     <br><dt><code>-C</code>     <dd>Rename files to end in <code>.C</code> (<code>.cc</code> for DOS-based filesystems) instead of <code>.c</code>.  This is convenient if you are convertinga C program to C++.  This option applies only to <code>protoize</code>.     <br><dt><code>-g</code>     <dd>Add explicit global declarations.  This means inserting explicitdeclarations at the beginning of each source file for each functionthat is called in the file and was not declared.  These declarationsprecede the first function definition that contains a call to anundeclared function.  This option applies only to <code>protoize</code>.     <br><dt><code>-i </code><var>string</var><code></code>     <dd>Indent old-style parameter declarations with the string <var>string</var>. This option applies only to <code>protoize</code>.     <p><code>unprotoize</code> converts prototyped function definitions to old-stylefunction definitions, where the arguments are declared between theargument list and the initial <code>{</code>.  By default, <code>unprotoize</code>uses five spaces as the indentation.  If you want to indent with justone space instead, use <code>-i " "</code>.     <br><dt><code>-k</code>     <dd>Keep the <code>.X</code> files.  Normally, they are deleted after conversionis finished.     <br><dt><code>-l</code>     <dd>Add explicit local declarations.  <code>protoize</code> with <code>-l</code> insertsa prototype declaration for each function in each block which calls thefunction without any declaration.  This option applies only to<code>protoize</code>.     <br><dt><code>-n</code>     <dd>Make no real changes.  This mode just prints information about the conversionsthat would have been done without <code>-n</code>.     <br><dt><code>-N</code>     <dd>Make no <code>.save</code> files.  The original files are simply deleted. Use this option with caution.     <br><dt><code>-p </code><var>program</var><code></code>     <dd>Use the program <var>program</var> as the compiler.  Normally, the name<code>gcc</code> is used.     <br><dt><code>-q</code>     <dd>Work quietly.  Most warnings are suppressed.     <br><dt><code>-v</code>     <dd>Print the version number, just like <code>-v</code> for <code>gcc</code>. </dl>   <p>If you need special compiler options to compile one of your program'ssource files, then you should generate that file's <code>.X</code> filespecially, by running <code>gcc</code> on that source file with theappropriate options and the option <code>-aux-info</code>.  Then run<code>protoize</code> on the entire set of files.  <code>protoize</code> will usethe existing <code>.X</code> file because it is newer than the source file. For example:<pre class="smallexample">     gcc -Dfoo=bar file1.c -aux-info file1.X     protoize *.c     </pre><p>You need to include the special files along with the rest in the<code>protoize</code> command, even though their <code>.X</code> files alreadyexist, because otherwise they won't get converted.   <p>See <a href="Protoize-Caveats.html#Protoize%20Caveats">Protoize Caveats</a>, for more information on how to use<code>protoize</code> successfully.   </body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -