当前位置:文档之家› cc编译器命令参考

cc编译器命令参考

CC编译器的使用文档VisualAge C++ Professional / C for AIX Compiler, Version 5Usage:xlC [ option | inputfile ]...xlc [ option | inputfile ]...cc [ option | inputfile ]...c89 [ option | inputfile ]...xlC128 [ option | inputfile ]...xlc128 [ option | inputfile ]...cc128 [ option | inputfile ]...xlC_r [ option | inputfile ]...xlc_r [ option | inputfile ]...cc_r [ option | inputfile ]...xlC_r4 [ option | inputfile ]...xlc_r4 [ option | inputfile ]...cc_r4 [ option | inputfile ]...CC_r4 [ option | inputfile ]...xlC_r7 [ option | inputfile ]...xlc_r7 [ option | inputfile ]...cc_r7 [ option | inputfile ]...Description:The xlC and related commands compile C and C++ source files.The xlC and related commands compile C and C++ source files.They also processes assembler source files and object files. Unless the -c option is specified, xlC calls the linkage editor to produce asingle object file. Input files may be any of the following:1. file name with .C suffix: C++ source file2. file name with .i suffix: preprocessed C or C++ source file3. file name with .c suffix: C source file4. file name with .o suffix: object file for ld command5. file name with .s suffix: assembler source file6. file name with .so suffix: shared object fileOptions:Options can be flag options or keyword options:1. Flag options:-# Display language processing commands but donot invoke them; output goes to stdout.-+ Treat .c files as C++ source code.-bdynamic, -bstaticDetermines which types of library files are searched bythe linkage editor.-brtl Tells the linkage editor to accept both .so and .alibrary file types.-B<prefix>Construct alternate compiler/assembler/linkage editorprogram names. <prefix> is added to the beginning ofthe standard program names.-c Do not send object files to the linkage editor.-C Write comments to output when doing preprocessing,used with -E and -P.-D<name>[=<def>]Define <name> as in #define directive. If <def> isnot specified, 1 is assumed.-E Preprocess but do not compile; output goes to stdout-f<filename>Passes to the linkage editor the filename of a filecontaining a list of input files to be processed.-F<x>[:<stanza>]Use alternate configuration file <x> with optional<stanza>. If <stanza> is not specified, the assumed stanza is the name of the command used to invoke the compiler.-g Produce information for the debugger.-G Tells the linkage editor to create a dynamic library.-I<dir> Search in directory <dir> for include files thatdo not start with an absolute path.-l<key> Search the specified library file,where <key> selects the file lib<key>.a.-L<dir> Search in directory <dir> for files specified by -l<key>. -ma Generate inline calls to the "alloca" function as if"#pragma alloca" directives were in the source file.-M Generate information to be included in a "make"description file; output goes to .u file.-o<name> Name the executable file <name> instead of a.out.When used with the -c option and one source file,name the object file <name> instead of filename.o.If <name> is the name of a directory, files generated by the compiler will be placed into that directory.-O Optimize generated code.-O2 Same as -O.-O3 Perform some memory and compile time intensiveoptimizations in addition to those executed with -O2.The -O3 specific optimizations have the potential toalter the semantics of a user's program.The compiler guards against these optimizations at -O2and the option -qstrict is provided at -O3 to turn offthese aggressive optimizations.-O4 (C) Equivalent to -O3 -qipa with automatic generation ofarchitecture and tuning option ideal for that platform.-O5 (C) Equivalent to -O3 -qipa=level=2 with automaticgeneration of architecture and tuning option ideal forthat platform.-p Generate profiling support code. Same as -qprofile=p.-pg Generate profiling support code including BSDprofiling support. Same as -qprofile=pg.-P Preprocess but do not compile; output goes to .i file.-Q (C++) Turns on inlining.-Q! (C++) Turns off inlining.-Q<x>, -qinline<x>(C) Inline all appropriate functions where x can beone of the following:! Not inline any function (equivalent to -qnoinline) =<lc> Inline if number of source statement infunction is less than the number specifiedin <lc>.-<nm> Not inline function listed by names in <nm>+<nm> Attempt to inline function listed by namesin <nm>.-S Produce a .s file for any source file processed by thecompiler.-t<x> Apply prefix from the -B option to the specified program <x>, where x can be one or more of the following:p = preprocessorc = compiler frontendb = compiler backendi = compiler inlinera = assemblerl = linkage editorm = 'munch' utility (C++)f = C++ name demangler utility (C++)I = inter-procedural analysis - compile phaseL = inter-procedural analysis - link phase.-U<name> Undefine name as in #undef directive.-v Displays language processing commands as theyare invoked by xlC; output goes to stdout.-w Suppress informational, language-level, andwarning messages.-W<x,y> Give the options <y> to the compiler program <x>where x can be one or more of the following:<p,c,b,i,a,l,I,m,f>-y<x> Specify compile-time rounding of constant floating-point expressions, where <x> can be one of the following:n = round to nearestm = round toward minus infinityp = round toward positive infinityz = round toward zero.2. Keyword options:Keyword options are specified in one of the following ways:-q<option>-q<option>=<parameter>-q<option>=<parameter>:<parameter>where <option> is an option name and <parameter> is aparameter value.Keyword options with no parameters represent switchesthat may be either on or off. The keyword by itself turnsthe switch on, and the keyword preceded by the letters NOturns the switch off. For example, -qLIST tells thecompiler to produce a listing and -qNOLIST tells thecompiler not to produce a listing. If an option thatrepresents a switch is set more than once, the compileruses the last setting.Keyword option and parameter names may appear in eitherUPPER CASE or lower case letters in the xlC command.Options without parameters:32 Selects 32-bit compiler mode.64 Selects 64-bit compiler mode.ansialias Use type-based aliasing during optimization.attr Produce an attribute listing containing onlyreferenced names; output goes to .lst file.compact Reduce code size where possible, at the expenseof execution speed. Code size is reduced byinhibiting optimizations that replicate or expandcode inline.cpluscmt (C) Permit "//" to introduce a comment that lastsuntil the end of the current source line, as in C++.dbcs String literals and comments can contain DBCScharacters (same as mbcs option).dbxextra Generate symbol table information for unreferencedvariables. By default such information is not generatedthus reducing the size of the executable compiled withthe "-g" option. Same as -qsymtab=unref.digraph Allow special digraphdollar Allow '$' as an identifier characterdpcl Generates symbols for tools based on the DynamicProbe Class Library (DPCL)extchk Perform external name type-checking and functioncall checking.fdpr Collect information about programs for use withthe AIX fdpr (Feedback Directed Program Restructuring)performance-tuning utility.funcsect Place instructions for each function in a separate csect. flttrap Generate instructions to trap floating-pointexceptions.fold Specifies that constant floating-point expressionsare to be evaluated at compile time.fullpath Specifies the path information stored for files whenyou use "-g" and the symbolic debugger.heapdebug Enables debug versions of memory management functions.idirfirst Specify the search order for files included withthe #include "file_name" directive. Use -qidirfirstwith the -Idirectory option. If -qidirfirst optionis specified, the directories specified by the-Idirectory option are searched before the directorywhere the current file resides.ignerrno Tell the optimizer that the program will neverrefer to or set errno. This allows additionaloptimizations.inlglue Generate fast external linkage by inlining thecode (pointer glue code) necessary at callsvia a function pointer and calls to externalprocedures.ldbl128 Increase long double size from 64 to 128 bits.libansi Assumes that all functions with the name of anANSI C library functions are in fact the system functions. linedebug Generates abbreviated line number and source file nameinformation for the debugger.list Produce an object listing; output goes to .lst file.listopt Display the settings of all options; output goesto .lst file.longdouble Increase long double size from 64 to 128 bits.longlit Changes implicit type selection for integer constants in 64-bit mode.longlong Allow long long integers.macpstr Allow '\p' as the first character of a string constantwhich will be replaced by the length in bytes.makedep Creates an output file that contains targets suitable for inclusion in a description file for the AIX make command. mbcs String literals and comments can contain DBCScharacters (same as dbcs option).mkshrobj Create a shared object from generated object files.noprint Direct listing to /dev/null.nostdinc Specify which files are included with the #include"file_name" and #include <file_name> directives.If -qnostdinc is specified, the /usr/include directoryis not searched.once Only process each include file one time.The default is -qnoonce.optimize Same as O and O2. Perform optimization that is themix between speed and size. (If -qnooptimize isspecified, it is equivalent to -qoptimize=0.)pascal Accept and ignore the keyword 'pascal' as atype modifier.pdf1, pdf2 Perform aggressive optimizations with profiledirected feedback.phsinfo Produce compiler phase information; output goes tostdout.proto (C) Assert that procedure call points agreewith their declarations even if the procedure hasnot been prototyped. This allows the caller topass floating point arguments in floating pointregisters instead of general purpose registers.ro Put string literals in read only area.roconst Put constant values in read only area.rwvftable (C++) Place virtual function tables intoread/write memory.showinc Include the source of all included files in thesource listing, if the SOURCE option is in effect.source Produce a source listing; output goes to .lst file.srcmsg Reconstruct source lines in error along with thediagnostic messages in the stderr file.staticinlineTreat inline functions as static. The defaultis -qnostaticinline, which is necessary forANSI C++ 'extern inline' behaviour.-qnostaticinline may produce linker warningmessages about duplicate definitions. This isexpected.statsym Adds user-defined, nonexternal names that have apersistent storage class, such as initialized anduninitialized static variables, to the name list(the symbol table of xcoff objects). Same as-qsymtab=static.strict Turns off aggresive optimizations which have thepotential to alter the semantics of a user's program.This option also sets -qfloat=nofltint:norsqrt.strict_inductionTurns off induction variable optimizationsthat have the potential to alter the semantics of auser's program. The default is "nostrict_induction" at-O2 or higher and "strict_induction" otherwise."nostrict_induction" is recomended if your program does not have overflows or wrap arounds of loop inductionvariables.syntaxonly Causes the compiler to perform syntax checking withoutgenerating an object file.threaded Indicates to the compiler that the program will execute in multi-threaded environment.tempinc (C++) Automatically generate template functions in the"tempinc" subdirectory. Use the "notempinc" option tosuppress this behaviour.twolink (C++) Link twice in order to minimize the numberof static constructors included from libraries.unique (C++) Generates unique names for staticconstructor/destructor file compilation units.upconv (C) Preserves the unsigned specification when performing integral promotions.vftable (C++) Force virtual function tables to be generatedin this compilation unit. The default is to define the virtual function table for a class where the firstnon-inline virtual member function is declared. If-qnovftable is specified, then no virtual function tables are produced.warn64 Enables checking for possible long-to-integer orpointer-to-integer truncation.xcall Generate code to static routines within a compilationunit as if they were external routines.xref Produce a cross-reference listing containingonly referenced names.Options with parameters:aggrcopy=[no]overlapAsserts whether source and destination of aggregateassignments overlap.alias=<option>Specifies the aliasing assertion to be applied toyour compilation unit.The available options are:typ Pointers to different types are never aliased. allp Pointers are never aliased.addr Variables are disjoint from pointersunless their address is taken.ansi Pointers can only point to an object of thesame type. Require -O option.align=<algnopt>power The compiler uses the RISC System/6000alignment rules.full The compiler uses the RISC System/6000alignment rules. This is the same as power.mac68k The compiler uses the Macintosh**alignment rules.twobyte The compiler uses the Macintosh alignment rules. The mac68k option is the same as twobyte.packed The compiler uses the packed alignment rules.natural The compiler maps structure members totheir natural boundaries.bit_packedThe same as packed. In addition, bit-fields are packed as tight as possible.arch=<option>Specifies the architecture on which the executableprogram will be run.The available options are:com Produce an object that contains instructionsthat will run on all the POWER and PowerPChardware platforms.pwr Produce an object that contains instructionsthat will run on the POWER hardwareplatform.pwr2 Produce an object that contains instructionsthat will run on the POWER2 hardwareplatform.pwrx Same as pwr2.ppc Produce an object that contains instructionsthat will run on any of the 32-bit PowerPChardware platforms.ppcgr Produce an object that contains optionalgraphics instructions for PowerPC processors. pwr2s Produce an object that contains instructions that will run on a pwr2s chip.p2sc Produce an object that contains instructions that will run on a p2sc chip.601 Produce an object that contains instructions that will run on a 601 chip.602 Produce an object that contains instructions that will run on a 602 chip.603 Produce an object that contains instructions that will run on a 603 chip.604 Produce an object that contains instructions that will run on a 604 chip.403 Produce an object that contains instructions that will run on a 403 chip.rs64a Produce an object that contains instructions that will run on a rs64a chip.rs64b Produce an object that contains instructions that will run on a rs64b chip.rs64c Produce an object that contains instructions that will run on a rs64c chip.pwr3 Produce an object that contains instructions that will run on a POWER3 chip.The default is -qarch=com. If the -qarch option isspecified without the -qtune=<option>, the compileruses the default -qtune value for the specifiedarchitecture. Refer to online documentation to findactual default setting of -qtune for a given -qarch. assert=<option>Specifies the aliasing assertion to be applied toyour compilation unit.The available options are:typ Pointers to different types are never aliased. allp Pointers are never aliased.addr Variables are disjoint from pointersunless their address is taken.attr=full Produce an attribute listing containing all names,whether referenced or not; output goes to .lst file. bitfields=signedbitfields=unsignedSpecify whether bitfields will be signed or unsigned. cache=<suboption>:<suboption>...Describe the cache configuration for a specific targetexecution machine. See online documentation for details. chars=signedchars=unsignedSpecify whether the data type char will be signedor unsigned.check=<option>Generate code to check for run-time checks.nullptr Runtime checking of addressescontained in pointer variables used toreference storage.bounds Runtime checking of addresses whensubscripting within an object of known size.divzero Runtime checking of integer division.A trap will occur if an attempt is made todivide by zero.all Switches on all the above suboptions.cinc=<prefix>(C++) Include files from directories starting with<prefix> have the tokens 'extern "C" {' insertedbefore the file and '}' after it.dataimported=<name1>:<name2>: ...Specify which data items are imported. If no names are specified, all data items are assumed to be imported.This is the default.datalocal=<name1>:<name2>: ...Specify which data items are local. If no names arespecified, all data items are assumed to be local.enum=<enumopt>Specify whether minimum-sized enumerated types will be produced or not. <enumopt> can be either small, int,(C++)intlong, 1, 2, 4 or 8.small denotes that either one, two, four or eight (valid in 64-bit mode only) bytes of storage will be allocated for enum variables based on the range of the enumconstants.int is the default, and causes enum variables to betreated as though they were of type signed intdepending on the range of the enum constants.intlong (C++) specifies that enumerations occupy 8bytes of storage and are represented by long,if -q64 is specified and the range of theenum constants exceed the limit for int.1 will cause enum variables to be packed into 1 byte.2 will cause enum variables to be packed into 2 bytes. 4 will cause enum variables to be packed into 4 bytes.8 will cause enum variables to be packed into 8 bytes. (enum=8 is valid in 64-bit mode only)flag=<sev1>Specify severity level of diagnostics to be reported in source listing and stderr; the severity levelis one of <i,w,e,s,u>.flag=<sev1>:<sev2>Specify severity level of diagnostics to be reported in source listing (<sev1>), and stderr (<sev2>);the severity levels are one of <i,w,e,s,u>.float=<opt1>:<opt2>:...:<optN>The available options are:emulate Function calls are emitted in place ofPowerPC floating-point instructions.Use this option only in a single-threadedstand-alone environment, targeting thePowerPC 403 processor.Do not use this suboption with any of thefollowing:o -qarch=pwr, -qarch=pwr2, -qarch=pwrxo -qlongdouble, -qldbl128o xlC128, xlc128 invocation commandsfltint Specify whether range checking of floatingpoint to integer conversions is done.Default at -O2: -qfloat=nofltint.Default at -O3: -qfloat=fltint.hsflt Never round single-precision expressions,and don't perform range checking forfloating-point to integer conversions.hssngl Round single-precision expressions onlywhen the results are stored into float memory locations.nans Detect conversion of single-precision NaNS to double precision call checking.nomaf Suppress generation of multiply-addinstructions.nofold Suppress compile-time evaluation of constant floating-point expressions.rndsngl Ensure strict adherence to IEEE standard.all operations on single-precision valuesproduce results that remain in singleprecision.rrm Specify run-time rounding mode. Compile with this option if the run-time rounding modeis round toward minus infinity, round towardpositive infinity, or not known.rsqrt Specify whether a division by the result of asquare root can be replaced with a multiplyby the reciprocal of the square root.Default at -O2: -qfloat=norsqrt.Default at -O3: -qfloat=rsqrt.spnans Generate extra instructions to detect signalling NaN on conversion from single precision todouble precision. Obsolete; use the equivalent -qfloat=nans option.flttrap=<opt1>:<opt2>:...:<optN>Generate instructions to detect and trap floating-point. The available options are: overflow, underflow,zerodivide, invalid, inexact, enable, imprecise.halt=<sev> Stop compiler after first phase if severity of errorsdetected equals or exceeds <sev>; the severitylevel is one of i, w, e, s, u.genpcomp[=dirname](C) Generate precompiled include files. See onlinedocumentation for details.genproto=<parmnames>Produces ANSI prototypes from K&R function definitions. ignprag=<option>The available options are:disjointIgnore pragma disjoint.isolatedIgnore pragma isolated_call.omp (C) Ignore OpenMP parallel processing pragmas. ibm (C) Ignore IBM parallel processing pragmas.all Ignore all the above pragmas.infoinfo=allProduce additional lint-like messages. For C, it turns on all diagnostic messages for all groups. For C++, it turns on all diagnostic messages for all groups, except ppt.info=<group>Produce additional lint-like messages based on <group>. cmp Possible redundancies in unsigned comparisonscnd Possible redundancies or problems in conditional expressionscns Operations involving constants.cnv Conversionsdcl Consistency of declarationseff Statements with no effectenu Consistency of enum variablesext Unused external definitionsgen General diagnostic messagesgnr Generation of temporary variablesgot Use of goto statementsini Possible problems with initializationinl Functions not inlinedlan Language level effectsobs Obsolete featuresord Unspecified order of evaluationpar Unused parameterspor Nonportable language constructsppc Possible problems with using the preprocessorppt Trace of preprocessor actionspro Missing function prototypesrea Code that cannot be reachedret Consistency of return statementstrd Possible truncation or loss of data or precision tru Variable names truncated by the compileruni Unitialized variablesuse Unused auto and static variablesvft (C++) Generation of virtual function tablesprivate (C) Lists shared variables made private to aparallel loop.reduction(C) Lists all variables that are recognized as reduction variables inside a parallel loop.initauto=<hh>Initialialize automatic storage to <hh>. <hh> is ahexadecimal value. This generates extra code andshould only be used for error determination.inline[=<x>]This is functionally equivalent to the -Q option.ipa[=<ipa_options>](C) Turn on inter-procedural analysis. See onlinedocumentation for details.isolated_call=<name1>:<name2>: ...Specify that the calls to the functions listed have no side effects. <name1> and <name2> are function names.The user may specify as many function names asnecessary.langlvl=<langlvl>:<feature>:...Specify language level and/or features to be enabledduring compilation.<langlvl>(C) can be ansi, saal2, saa, extended, orclassic.<langlvl>(C++) can be ansi/strict98, compat366, orextended.<feature>can be:[no]ucs enables or disables support foruniversal character names.<feature>(C++) can be:typedefclass allows typedef names to be used in base specifiers and in memory initializers.anonstruct allows anonymous structs.ansifor allows new ANSI scopes are to be used for variables declared infor-init-statements.oldfriend allows friend declarationswithout elaborated classnames.oldmath prevents the inclusion of newANSI math functions in <math.h>. oldstr prevents the inclusion of newstring functions in <cstring>.oldtempacc suppresses copy-constructoraccess checking for eliminatedtemporaries.oldtmplspec allows old-style templatespecializations.anonunion allows non-data members inanonymous unions. Memberfunctions are not allowed.illptom allows ill-formed pointer tomember expressions.implicitint allows implicit intnewexcp determines whether the systemoperator new (other than thenothrow variants) throw thestandard exception std::bad_alloc when the requested allocationfails.offsetnonpod allows offsetof() to be used with non-POD (plain ol' data) classes. olddigraph support old-style digraphsredefmac specifies whether a macro can beredefined without a prior #undefor an undefine() optiontrailenum allows trailing enum commas.zeroextarray allows a zero-extent array asthe last non-static data memberof a struct.maxerr=<num>[:<sev>]Instructs the compiler to halt compilation when <num>errors of <sev> or greater severity is reached. Thedefault for <sev> is current value of the -qhalt option. maxmem=<num>Limit the amount of memory used by space intensiveoptimizations to <num>. <num> specified in kilobytes.mkshrobj=<num>(C++) Create a shared object from generated object files. The optional number specifies the priority level for the file.priority=<num>(C++) Specifies the priority level for the initialization of static constructors.optimize=<level>Enables different levels of optimization.2 Same as -O and -qoptimize.3 Same as -O3. Aggresive optimization.4 (C) Same as -O4. Internally generates -O3 -qipa with automatic architecture and tuning optiongeneration.5 (C) Same as -O5. Internally generates -O3-qipa=level=2 with automatic architecture andtuning option generation.proclocal=<name1>:<name2>: ...Specify which functions are local.If no filenames are specified, all invoked functionsare assumed to be defined within the current file.The last explicit specification for a function takesprecedence.procimported=<name1>:<name2>: ...Specify which functions are imported. If no filenamesare specified, all invoked functions are assumed to bedefined outside the current file. The last explicitspecification for a function takes precedence.procunknown=<name1>:<name2>: ...Specify which functions are unknown to be local orimported. If no filenames are specified, all functions。

相关主题