![]() |
![]() |
![]() |
|
![]() | |
![]() |
![]() |
![]() |
![]() |
![]() |
Log In | Not a Member? |
Support
![]() |
![]() |
SYNTAX MrC[pp] sourceFile [options] DESCRIPTION The MrC tool compiles a C language source file. By convention, C language source filenames end with a .c extension. Once compiled, each file of the form name.c yields an object file of the form name.c.o. To change the object filename, use the -o option. The MrCpp tool compiles a C++ language source file. By convention, C++ language source filenames end with a .cp extension. Once compiled, each file of the form name.cp yields an object file of the form name.cp.o. To change the object filename, use the -o option. INPUT A single source file, which must be specified on the command line. Standard input is not used. Source filenames are limited to 29 characters. If the source language is C, use MrC. If the source language is C++, use MrCpp. If no input file is specified, the compiler displays help information. OUTPUT An XCOFF object file is generated unless the -e or -c option is specified. Errors and warnings are always written to standard error. Error messages from the compiler have the following format:
source line containing the error or when it was detected… The "^" is a pointer to the approximate location of the error. STATUS
MrC and MrCpp
can return the following status codes:
PARAMETERS sourceFile Specifies the C or C++ language source file to compile. If the source language is C, use MrC. If the source language is C++, use MrCpp. OPTIONS -alias off | [addr][,ansi][,type] Controls pointer alias analysis. off Disables pointer alias analysis. [addr] Enables pointer alias analysis by distinct address. ansi Enables pointer alias analysis by ANSI rules. type Enables pointer alias analysis by data type. -align power | mac68k | byte | packed Determines the alignment of data structures. Allows you to use either PowerPC, Macintosh 68K, or packed byte alignment rules. -alloca Recognizes alloca as a built-in function. -ansi off | on | relaxed | strict Controls certain language extensions and the degree of conformance to the ANSI standard. off Uses ANSI C or C++ language without enforcing the ANSI restrictions listed below. on | relaxed Uses the ANSI C or C++ language, enforcing the ANSI restrictions listed below, but allows the use of Apple C language extensions. strict Uses the ANSI C or C++ language, enforcing the ANSI restrictions listed below, and does not allow the use of Apple C language extensions. If you use strict, the base size of the enum type is always the same as the int type. You can override the size of the enum type with the -enum min option. If you do this, the compiler warns you that there is a possible conflict. -ansifor Limits a for-statement declared initializer to the for body. (MrCpp only) -aslm Reverts to the old vtable format for ASLM compatibility. Note that the old vtable format is incompatible with exceptions. (MrCpp only) -asm Generates an assembly listing of the generated code. -bool off | on Controls whether bool, true, and false are treated as standard keywords or normal identifiers. (MrCpp only) off Treats bool, true, and false as normal identifiers. on Treats bool, true, and false as standard keywords. -c Checks syntax only. Does not generate an XCOFF file. -char signed | unsigned | unsignedX Determines whether objects of type char (including character literals) are treated as signed or unsigned. The unsignedX option causes them to be treated as unsigned quantities that are sign extended.
Note -curdir Uses the current directory for the temporary file that the compiler generates. By default, this is the MPW temporary folder, "{TempFolder}". -d[efine] name | name=value Defines a preprocessor symbol name. The name form defines the specified name to have the value 1. The name=value form defines the specified name to have the specified value. If you use the name=value form, do not place a space before or after the equal sign (=). Also, if the name=value form contains any special characters, you must enclose the value in double quotes (for example, name="2 "). -dump[c] filename Saves the state of the compilation in the specified file. Only declarations and variable definitions are allowed in a dump file, no code is included. The state can then be loaded in a later compilation with the -load[c] option. This load/dump mechanism is used to load common definitions quickly.
Note -e Generates preprocessor expansion of source. Performs macro expansion and includes the specified header files in the resulting output. When you use this option, comments remain in the output and the compiler does not perform semantic analysis and code generation, which occur after the preprocessing phase.
Note -EH Enables C++ exception handling. This option is the same as -exceptions on. (MrCpp only) -enum int | min Determines the size of enumeration types. Specifying int causes all enums to be the same size as ints, while min indicates that the compiler should use the minimum size needed to store the values in the enum (1, 2, 3, or 4 bytes). The default is minimum-sized enums unless -ansi strict is specified. -ER Enables C++ run-time type indentification (RTTI). This option is the same as -rtti on. (MrCpp only) -exceptions on | off Enables or disables C++ exception handling. (MrCpp only) -export_list filename Sends the export list created by the -shared_lib_export option to a specified file. When creating a shared library, this list would be provided to the PowerPC linker, PPCLink. For more information, see the discussions of linking in Inside Macintosh: PowerPC System Software and Building and Managing Programs in MPW. -fatext Specifies that the output filename generated by the compiler is the input filename followed by the appended extension ".ppc.o". -fp_contract on | off Controls whether the compiler generates PowerPC multiply-add instructions. The -fp_contract or the -maf option specifies whether the compiler generates PowerPC multiply-add instructions (also known as multiply-add fused instructions). The default is to generate multiply-add instructions. A multiply-add instruction is a floating-point instruction that combines a multiplication operation with either an addition or a subtraction operation. The resulting single operation (also known as a contraction operation) offers several advantages. First, a single multiply-add instruction can perform a combined multiplication and addition operation in the same time that a multiplication operation takes, thus providing faster floating-point computations. Second, no more than a single rounding error occurs in the multiply-add computation, compared with two possible rounding errors that can occur for the two replaced instructions. As a result the computation can provide a more accurate result.
Note -i pathname[,pathname]… Searches for include files in the specified directories. Multiple -i options can be specified. The search order is as follows: • The include filename is used as specified. If a full pathname is given, then no other searching is applied. If the file isn't found, and the pathname used to specify the file is a partial pathname (no colons in the name or a leading colon), then the following directories are searched. • The directory containing the current input file. • The directories specified in the -i option, in the order listed. • The directories specified in the MPW Shell variable {CIncludes}. -ieee relaxed | strict Controls adherence to IEEE floating point semantics. -ignorepragma id[,id]… Ignores #pragmas with the specified #pragma IDs. -inclpath ignoresys[tem] | normal | nosys[tem] | standard | std Controls how system header files and included files are treated. normal | standard | std Distinguishes between system header files, which are given in angle brackets (< >), and include files in double quotes (""), the former being system includes, which are looked up in the {CIncludes} directory first. ignoresys[tem] | nosys[tem] Treats header files enclosed in angle brackets (< >) like header files in double quotes (""). -includes mac | dos | unix Controls how to interpret #include pathnames. mac Interprets #include pathnames as Macintosh pathnames. dos Interprets #include pathnames as DOS pathnames. unix Interprets #include pathnames as Unix pathnames. -inline all | none | off | on | value Controls the type of inlining performed by the compiler. The default depends on the -opt option setting. on | all Expands any function within the compilation unit where inlining provides speed optimization, including C++ functions not specified as candidates for inlining. off | none Does not perform any inline expansion of any function. value Sets the complexity limit on the functions to be inlined. The value must be between 0 and 5. This value does not affect the inlining of those functions that are defined as inline. The default complexity limit is 2, which is the same as specifying -inline on. Specifying a larger complexity limit causes larger functions to be inlined which may have an adverse effect on the size and speed of code. (There may also be an adverse effect on speed due to large inlined functions causing code to exceed the processor's code cache size.) Specifying -inline 0 causes only C++ functions that are explicitly defined as inline to be eligible for inlining. For C code, -inline 0 is equivalent to -inline off.
Note -ir pathname[,pathname]… This option is the same as -i except the listed directories are searched recursively. -j0 | -j1 | -j2 Controls the handling of 2-byte Asian characters. Use -j0 for Japanese, -j1 for Chinese or Taiwanese, or -j2 for Korean character recognition in string and character constants. -l filename Generates a listing file to the specified file. If the filename is specified as a null string, the name of the input file is used with the extension .lst added to it. For example, a C language file named name.c becomes name.c.lst; a C++ language file named name.cp becomes name.cp.lst. Use this option with the -e option to see the effect of macro expansions and conditionals. -ldsize 64 | 128 Determines whether the long double type uses a 128-bit format, which is not native to the PowerPC runtime architecture, or a 64-bit format, which is the same format used by the double type and is native.
Note For more information about the 128-bit format, see information about the double double data type in Inside Macintosh: PowerPC Numerics. -load[c] filename Restores the state of a compilation from filename. The file loaded should have been dumped in an earlier compilation with the -dump[c] option. This load/dump mechanism is used to load common definitions quickly.
Note -longlong on | off Enables or disables support of long long types. -maf on | off Controls whether the compiler generates PowerPC multiply-add instructions. This option is identical to the -fp_contract option. -make filename Generates Make dependency rules into the specified file. -noMapCR Tells the compiler to use the linefeed character for the newline escape sequence. Because Macintosh text files use the carriage return character to end lines, by default Macintosh C compilers generate a carriage return character for the \n newline escape sequence in character and string literals. However, on most other platforms, C compilers generate the linefeed character for the newline escape sequence. This option also controls what is generated by the \r escape sequence. By default, the compiler generates a linefeed character for the \r escape sequence. Using this option, the compiler generates a carriage return character, so \n and \r never generate the same character, which is useful if you are compiling for other platforms. -notOnce Allows the compiler to read multiple copies of header files. You cannot use this option to specify a specific header file. The default behavior of the compiler reads header files only once, unless the -notOnce option is specified. -o filename | dirname: Specifies the output filename or directory for the generated code. If only a directory is specified, the compiler assigns a default filename to the object file and puts it in the specified directory. The specified directory must already exist; the compiler does not create new directories. If this option is not used, the output file has the same name as the input file, but the compiler appends the source filename with a .o extension and places it in the same directory as the source file.
-opt off | none | local | Sets the level of optimization that the compiler performs.
Note local Performs local optimizations and global register allocation. off | none Suppresses all optimizations. size Performs optimizations for size, but not speed. In addition, the size argument can be modified using the following: warn_uninit Warns about variables which are definitely used before being set. warn_maybe_uninit Warns about variables which may be used before being set. ok_to_reduce_opt Warns about reducing optimization level due to low memory. speed Optimizes for highest performance. In addition, the speed argument can be modified using the following: nointer Inhibits interprocedural optimizations. norep Inhibits repeating global propagation and redundant store elimination. unroll Adds loop unrolling. unswitch Adds loop unswitching. warn_uninit Warns about variables which are definitely used before being set. warn_maybe_uninit Warns about variables which may be used before being set. ok_to_reduce_opt Warns about reducing optimization level due to low memory. -p Generates progress information about the compilation and sends it to diagnostic output. This information shows which files the compiler includes and the functions it processes. -poolstringsbyfunc Associates string constants with their functions instead of with their compilation unit. -prefix filename[,filename]… Includes the specified file(s) before reading the first source file. -proto strict | auto Specifies the requirements for function prototypes in source files. If the strict parameter is used, function prototypes are required. If the auto parameter is used, the compiler does not require function prototypes, but the number of parameters that are used when the function is called must be the same as the number used to declare it. -rtti on | off Enables or disables C++ run-time type information (RTTI). (MrCpp only) -shared_lib_export off | on Creates an export list file that can be provided to PPCLink to identify the items in the interface of a shared library. (The -export_list option is used to specify the file.) The off parameter causes no file to be created. During linking, these names indicate which items are to be exported from an import library. The -shared_lib_export option also turns off interprocedural optimizations, which are not appropriate for shared libraries. The default name of the export list file is the name of the source file with an .x extension added unless the -export_list option is used to specify a different filename. -sym off | on | full [,alltypes][,nolines][,notypes][,novars] Controls whether the compiler generates debugging information. off Suppresses the generation of debugging information. on | full Generates debugging information and uses the following modifiers: alltypes Generates debugging information for all types, even if they are not referenced in the compilation. Normally type information is emitted only for types referenced in the compilation. nolines Suppresses the generation of source line information. notypes Suppresses the generation of information about the data types of variables. novars Suppresses the generation of information about variables.
Note -t Displays compilation time. -target power | powerpc | ppc | 601 | 603 | 604 Generates code that depends on the characteristics of the target architecture that you specify. The architecture may affect which instructions are available, the optimal order of instructions in the compiled code, and instruction scheduling. powerpc | ppc Indicates the current architecture and therefore is appropriate for future PowerPC generations. power Specifies the POWER architecture, which is an ancestor of the PowerPC architecture and uses a different instruction set. 601 Specifies the 601 variant of the PowerPC architecture. 603 Specifies the 603 variant of the PowerPC architecture. 604 Specifies the 604 variant of the PowerPC architecture. -tb on | pragma | exp[ort] | outofline Controls the generation of IBM RS/6000 traceback tables. on Generates traceback tables. This option is the same as -traceback. pragma Generates traceback tables only for #pragma traceback functions. exp[ort] Generates traceback tables only for #pragma export functions. outofline Generates traceback tables only for #pragma outofline functions. -traceback Causes IBM RS/6000 traceback tables to be generated. The default is to not generate traceback tables. -typecheck strict | relaxed Controls whether the compiler performs strict or relaxed typechecking.
Note -u all | name[,name]… Contols the suppression of predefined non-ANSI macros. all Suppresses all predefined non-ANSI macros. name[,name]… Suppresses only the listed predefined non-ANSI macros. -unique_strings Forces all string constants to be unique. -vec[tor] off | on[,vrsave | ,novrsave] Controls how vector functions and types are handled. off Vector functions and types are not accepted. on Vector functions and types are accepted. The on argument can be modified using the following: vrsave Maintains VRsave in prologs and epilogs. This is the default if -vector on. novrsave Does not maintain VRsave in prologs and epilogs. -w off | [is]err[or] | value[,value…] Controls how warning messages are issued by the compiler. off Suppresses all warning messages. [is]err[or] Treats all warnings as errors. value[,value…]
Suppresses C language warnings using one or more of the following values:
Suppresses C++ language warnings using one or more of the following values:
-x Allows the compilation to continue, instead of terminating, if more than four errors are encountered. -xa extern | public | static Determines the accessibility of generated template functions. (MrCpp only) extern Inhibits template expansion. public Uses public scope. Functions are visible outside the compiled file. static Uses static scope. Functions remain local to the file. -xi template Instantiates the template specified by the template parameter. (MrCpp only) -y directory Sets the directory where compiler's temporary and object files are written. The directory must already exist. By default, the compiler's temporary and object files are written to the same directory as the source file. The -o option is used to explicitly specify an object file (or its directory) and always overrides the option for that file. ANSI RESTRICTIONS ANSI restrictions that apply to both the C and C++ languages: • The base size of the enum type is determined by the minimum size needed to store the values in the type. • The following keywords are not recognized: __handle, _inf, __nan, __nans, __machdl, asm, and pascal. • Predefined macros that do not start with a single or double underscore are not defined. • You cannot use arithmetic on pointers to functions. • Trigraphs are supported. Trigraphs are sequences of three letters that are treated as one. The sequence is ?? and an additional character. Trigraphs let computers without such characters as braces ({ and }), tildes (~), and carets (^) use C++. However, many Macintosh applications use character literals that resemble trigraphs. For example, the file type '????' is interpreted as '?^'. To write the file type '????', use '???\?'. • Text on the end of a preprocessor line is not ignored and is an error. For example, #endIf COMMENT needs to be #endif /* COMMENT */. • You cannot use binary numbers such as 0b10110. • At least one hexadecimal number must follow a \x escape sequence. • The program must end with a newline character. • You cannot get the size of a function using the sizeof operator. • You cannot use the unordered, floating comparisons operators !<=, <>, >=, !<=, !<, !>=, !>, and !<>. • You cannot use hexadecimal floating-point constants. • A non-integer expression is not converted to an integer expression where a constant expression is required. • The type of a case expression cannot be larger than the type of the switch expression. • Function prototypes for arguments must match the function definitions in number and type. • You cannot put a sizeof operator or a cast operator in a preprocessor expression. • You cannot use dimensionless arrays as the last member of struct definitions. • Empty member lists in enum declarations and member lists with a trailing comma are syntax errors. • You cannot place a void expression in a logical && or || expression. • Any case label constants must be of type int or unsigned int. • Declarators must declare at least one variable. • Function prototypes with ellipses (…) must have at least one other argument. • Macros must match previous definitions exactly when being redefined. • You cannot put commas in constant expressions. • Unrecognized # directives are in error. ANSI C language-specific restrictions: • You cannot use C++-style comments in C code. C++-style comments use the double slash (//) format. • You cannot have an empty struct or union definition. • A function declared with ellipsis (…) does not match a function declared without ellipsis. • Old-style function definitions must match promoted size of the arguments. ANSI C++ language-specific restrictions: • Anonymous unions must be static. • Member functions cannot be static. • You cannot generate a reference to a temporary variable. • You cannot convert to and from a void type. • You cannot use the preincrement or postincrement operator function as an overloaded function for postincrement or postdecrement. • Template class instantiations cannot introduce new nonlocal names. • You cannot use #ident. • You cannot cast an lvalue type to a different type. • You cannot type something void where a value is required. • The type void * is not compatible with other pointer types. • String literals used to initialize arrays of type char are always null terminated. • Function declarations with separate parameter lists never match functions with supplied prototypes.
• Non-prototype function declarations in which the actual declaration of the parameters follows the parameter list are not allowed. EXAMPLES For a C language source file: MrC sample.c -sym on For a C++ language source file: MrCpp sample.cp -opt speed SEE ALSO MrC/MrCpp: C/C++ Compiler for Power Macintosh
|