gcc.1 (219639) | gcc.1 (220755) |
---|---|
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 2.\" 3.\" Standard preamble: 4.\" ======================================================================== 5.de Sh \" Subsection heading 6.br 7.if t .Sp 8.ne 5 --- 205 unchanged lines hidden (view full) --- 214\&\fB\-fno\-threadsafe\-statics \-fuse\-cxa\-atexit \-fno\-weak \-nostdinc++ 215\&\-fno\-default\-inline \-fvisibility\-inlines\-hidden 216\&\-Wabi \-Wctor\-dtor\-privacy 217\&\-Wnon\-virtual\-dtor \-Wreorder 218\&\-Weffc++ \-Wno\-deprecated \-Wstrict\-null\-sentinel 219\&\-Wno\-non\-template\-friend \-Wold\-style\-cast 220\&\-Woverloaded\-virtual \-Wno\-pmf\-conversions 221\&\-Wsign\-promo\fR | 1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 2.\" 3.\" Standard preamble: 4.\" ======================================================================== 5.de Sh \" Subsection heading 6.br 7.if t .Sp 8.ne 5 --- 205 unchanged lines hidden (view full) --- 214\&\fB\-fno\-threadsafe\-statics \-fuse\-cxa\-atexit \-fno\-weak \-nostdinc++ 215\&\-fno\-default\-inline \-fvisibility\-inlines\-hidden 216\&\-Wabi \-Wctor\-dtor\-privacy 217\&\-Wnon\-virtual\-dtor \-Wreorder 218\&\-Weffc++ \-Wno\-deprecated \-Wstrict\-null\-sentinel 219\&\-Wno\-non\-template\-friend \-Wold\-style\-cast 220\&\-Woverloaded\-virtual \-Wno\-pmf\-conversions 221\&\-Wsign\-promo\fR |
222.IP "\fIObjective-C and Objective\-\*(C+ Language Options\fR" 4 223.IX Item "Objective-C and Objective- Language Options" 224\&\fB\-fconstant\-string\-class=\fR\fIclass-name\fR 225\&\fB\-fgnu\-runtime \-fnext\-runtime 226\&\-fno\-nil\-receivers 227\&\-fobjc\-call\-cxx\-cdtors 228\&\-fobjc\-direct\-dispatch 229\&\-fobjc\-exceptions 230\&\-fobjc\-gc 231\&\-freplace\-objc\-classes 232\&\-fzero\-link 233\&\-gen\-decls 234\&\-Wassign\-intercept 235\&\-Wno\-protocol \-Wselector 236\&\-Wstrict\-selector\-match 237\&\-Wundeclared\-selector\fR | |
238.IP "\fILanguage Independent Options\fR" 4 239.IX Item "Language Independent Options" 240\&\fB\-fmessage\-length=\fR\fIn\fR 241\&\fB\-fdiagnostics\-show\-location=\fR[\fBonce\fR|\fBevery-line\fR] 242\&\fB\-fdiagnostics\-show\-option\fR 243.IP "\fIWarning Options\fR" 4 244.IX Item "Warning Options" 245\&\fB\-fsyntax\-only \-pedantic \-pedantic\-errors --- 564 unchanged lines hidden (view full) --- 810.IX Item "file.c" 811C source code which must be preprocessed. 812.IP "\fIfile\fR\fB.i\fR" 4 813.IX Item "file.i" 814C source code which should not be preprocessed. 815.IP "\fIfile\fR\fB.ii\fR" 4 816.IX Item "file.ii" 817\&\*(C+ source code which should not be preprocessed. | 222.IP "\fILanguage Independent Options\fR" 4 223.IX Item "Language Independent Options" 224\&\fB\-fmessage\-length=\fR\fIn\fR 225\&\fB\-fdiagnostics\-show\-location=\fR[\fBonce\fR|\fBevery-line\fR] 226\&\fB\-fdiagnostics\-show\-option\fR 227.IP "\fIWarning Options\fR" 4 228.IX Item "Warning Options" 229\&\fB\-fsyntax\-only \-pedantic \-pedantic\-errors --- 564 unchanged lines hidden (view full) --- 794.IX Item "file.c" 795C source code which must be preprocessed. 796.IP "\fIfile\fR\fB.i\fR" 4 797.IX Item "file.i" 798C source code which should not be preprocessed. 799.IP "\fIfile\fR\fB.ii\fR" 4 800.IX Item "file.ii" 801\&\*(C+ source code which should not be preprocessed. |
818.IP "\fIfile\fR\fB.m\fR" 4 819.IX Item "file.m" 820Objective-C source code. Note that you must link with the \fIlibobjc\fR 821library to make an Objective-C program work. 822.IP "\fIfile\fR\fB.mi\fR" 4 823.IX Item "file.mi" 824Objective-C source code which should not be preprocessed. 825.IP "\fIfile\fR\fB.mm\fR" 4 826.IX Item "file.mm" 827.PD 0 828.IP "\fIfile\fR\fB.M\fR" 4 829.IX Item "file.M" 830.PD 831Objective\-\*(C+ source code. Note that you must link with the \fIlibobjc\fR 832library to make an Objective\-\*(C+ program work. Note that \fB.M\fR refers 833to a literal capital M. 834.IP "\fIfile\fR\fB.mii\fR" 4 835.IX Item "file.mii" 836Objective\-\*(C+ source code which should not be preprocessed. | |
837.IP "\fIfile\fR\fB.h\fR" 4 838.IX Item "file.h" | 802.IP "\fIfile\fR\fB.h\fR" 4 803.IX Item "file.h" |
839C, \*(C+, Objective-C or Objective\-\*(C+ header file to be turned into a 840precompiled header. | 804C, or \*(C+ header file to be turned into a precompiled header. |
841.IP "\fIfile\fR\fB.cc\fR" 4 842.IX Item "file.cc" 843.PD 0 844.IP "\fIfile\fR\fB.cp\fR" 4 845.IX Item "file.cp" 846.IP "\fIfile\fR\fB.cxx\fR" 4 847.IX Item "file.cxx" 848.IP "\fIfile\fR\fB.cpp\fR" 4 849.IX Item "file.cpp" 850.IP "\fIfile\fR\fB.CPP\fR" 4 851.IX Item "file.CPP" 852.IP "\fIfile\fR\fB.c++\fR" 4 853.IX Item "file.c++" 854.IP "\fIfile\fR\fB.C\fR" 4 855.IX Item "file.C" 856.PD 857\&\*(C+ source code which must be preprocessed. Note that in \fB.cxx\fR, 858the last two letters must both be literally \fBx\fR. Likewise, 859\&\fB.C\fR refers to a literal capital C. | 805.IP "\fIfile\fR\fB.cc\fR" 4 806.IX Item "file.cc" 807.PD 0 808.IP "\fIfile\fR\fB.cp\fR" 4 809.IX Item "file.cp" 810.IP "\fIfile\fR\fB.cxx\fR" 4 811.IX Item "file.cxx" 812.IP "\fIfile\fR\fB.cpp\fR" 4 813.IX Item "file.cpp" 814.IP "\fIfile\fR\fB.CPP\fR" 4 815.IX Item "file.CPP" 816.IP "\fIfile\fR\fB.c++\fR" 4 817.IX Item "file.c++" 818.IP "\fIfile\fR\fB.C\fR" 4 819.IX Item "file.C" 820.PD 821\&\*(C+ source code which must be preprocessed. Note that in \fB.cxx\fR, 822the last two letters must both be literally \fBx\fR. Likewise, 823\&\fB.C\fR refers to a literal capital C. |
860.IP "\fIfile\fR\fB.mm\fR" 4 861.IX Item "file.mm" 862.PD 0 863.IP "\fIfile\fR\fB.M\fR" 4 864.IX Item "file.M" 865.PD 866Objective\-\*(C+ source code which must be preprocessed. 867.IP "\fIfile\fR\fB.mii\fR" 4 868.IX Item "file.mii" 869Objective\-\*(C+ source code which should not be preprocessed. | |
870.IP "\fIfile\fR\fB.hh\fR" 4 871.IX Item "file.hh" 872.PD 0 873.IP "\fIfile\fR\fB.H\fR" 4 874.IX Item "file.H" 875.PD 876\&\*(C+ header file to be turned into a precompiled header. 877.IP "\fIfile\fR\fB.f\fR" 4 --- 58 unchanged lines hidden (view full) --- 936Specify explicitly the \fIlanguage\fR for the following input files 937(rather than letting the compiler choose a default based on the file 938name suffix). This option applies to all following input files until 939the next \fB\-x\fR option. Possible values for \fIlanguage\fR are: 940.Sp 941.Vb 9 942\& c c-header c-cpp-output 943\& c++ c++-header c++-cpp-output | 824.IP "\fIfile\fR\fB.hh\fR" 4 825.IX Item "file.hh" 826.PD 0 827.IP "\fIfile\fR\fB.H\fR" 4 828.IX Item "file.H" 829.PD 830\&\*(C+ header file to be turned into a precompiled header. 831.IP "\fIfile\fR\fB.f\fR" 4 --- 58 unchanged lines hidden (view full) --- 890Specify explicitly the \fIlanguage\fR for the following input files 891(rather than letting the compiler choose a default based on the file 892name suffix). This option applies to all following input files until 893the next \fB\-x\fR option. Possible values for \fIlanguage\fR are: 894.Sp 895.Vb 9 896\& c c-header c-cpp-output 897\& c++ c++-header c++-cpp-output |
944\& objective-c objective-c-header objective-c-cpp-output 945\& objective-c++ objective-c++-header objective-c++-cpp-output | |
946\& assembler assembler-with-cpp 947\& ada 948\& f95 f95-cpp-input 949\& java 950\& treelang 951.Ve 952.IP "\fB\-x none\fR" 4 953.IX Item "-x none" --- 136 unchanged lines hidden (view full) --- 1090.PP 1091When you compile \*(C+ programs, you may specify many of the same 1092command-line options that you use for compiling programs in any 1093language; or command-line options meaningful for C and related 1094languages; or options that are meaningful only for \*(C+ programs. 1095.Sh "Options Controlling C Dialect" 1096.IX Subsection "Options Controlling C Dialect" 1097The following options control the dialect of C (or languages derived | 898\& assembler assembler-with-cpp 899\& ada 900\& f95 f95-cpp-input 901\& java 902\& treelang 903.Ve 904.IP "\fB\-x none\fR" 4 905.IX Item "-x none" --- 136 unchanged lines hidden (view full) --- 1042.PP 1043When you compile \*(C+ programs, you may specify many of the same 1044command-line options that you use for compiling programs in any 1045language; or command-line options meaningful for C and related 1046languages; or options that are meaningful only for \*(C+ programs. 1047.Sh "Options Controlling C Dialect" 1048.IX Subsection "Options Controlling C Dialect" 1049The following options control the dialect of C (or languages derived |
1098from C, such as \*(C+, Objective-C and Objective\-\*(C+) that the compiler 1099accepts: | 1050from C, such as \*(C+) that the compiler accepts: |
1100.IP "\fB\-ansi\fR" 4 1101.IX Item "-ansi" 1102In C mode, support all \s-1ISO\s0 C90 programs. In \*(C+ mode, 1103remove \s-1GNU\s0 extensions that conflict with \s-1ISO\s0 \*(C+. 1104.Sp 1105This turns off certain features of \s-1GCC\s0 that are incompatible with \s-1ISO\s0 1106C90 (when compiling C code), or of standard \*(C+ (when compiling \*(C+ code), 1107such as the \f(CW\*(C`asm\*(C'\fR and \f(CW\*(C`typeof\*(C'\fR keywords, and --- 727 unchanged lines hidden (view full) --- 1835\& { 1836\& A a,b; 1837\& a = b; 1838\& } 1839.Ve 1840.Sp 1841In this example, G++ will synthesize a default \fBA& operator = 1842(const A&);\fR, while cfront will use the user-defined \fBoperator =\fR. | 1051.IP "\fB\-ansi\fR" 4 1052.IX Item "-ansi" 1053In C mode, support all \s-1ISO\s0 C90 programs. In \*(C+ mode, 1054remove \s-1GNU\s0 extensions that conflict with \s-1ISO\s0 \*(C+. 1055.Sp 1056This turns off certain features of \s-1GCC\s0 that are incompatible with \s-1ISO\s0 1057C90 (when compiling C code), or of standard \*(C+ (when compiling \*(C+ code), 1058such as the \f(CW\*(C`asm\*(C'\fR and \f(CW\*(C`typeof\*(C'\fR keywords, and --- 727 unchanged lines hidden (view full) --- 1786\& { 1787\& A a,b; 1788\& a = b; 1789\& } 1790.Ve 1791.Sp 1792In this example, G++ will synthesize a default \fBA& operator = 1793(const A&);\fR, while cfront will use the user-defined \fBoperator =\fR. |
1843.Sh "Options Controlling Objective-C and Objective\-\*(C+ Dialects" 1844.IX Subsection "Options Controlling Objective-C and Objective- Dialects" 1845(\s-1NOTE:\s0 This manual does not describe the Objective-C and Objective\-\*(C+ 1846languages themselves. See 1847.PP 1848This section describes the command-line options that are only meaningful 1849for Objective-C and Objective\-\*(C+ programs, but you can also use most of 1850the language-independent \s-1GNU\s0 compiler options. 1851For example, you might compile a file \f(CW\*(C`some_class.m\*(C'\fR like this: 1852.PP 1853.Vb 1 1854\& gcc -g -fgnu-runtime -O -c some_class.m 1855.Ve 1856.PP 1857In this example, \fB\-fgnu\-runtime\fR is an option meant only for 1858Objective-C and Objective\-\*(C+ programs; you can use the other options with 1859any language supported by \s-1GCC\s0. 1860.PP 1861Note that since Objective-C is an extension of the C language, Objective-C 1862compilations may also use options specific to the C front-end (e.g., 1863\&\fB\-Wtraditional\fR). Similarly, Objective\-\*(C+ compilations may use 1864\&\*(C+\-specific options (e.g., \fB\-Wabi\fR). 1865.PP 1866Here is a list of options that are \fIonly\fR for compiling Objective-C 1867and Objective\-\*(C+ programs: 1868.IP "\fB\-fconstant\-string\-class=\fR\fIclass-name\fR" 4 1869.IX Item "-fconstant-string-class=class-name" 1870Use \fIclass-name\fR as the name of the class to instantiate for each 1871literal string specified with the syntax \f(CW\*(C`@"..."\*(C'\fR. The default 1872class name is \f(CW\*(C`NXConstantString\*(C'\fR if the \s-1GNU\s0 runtime is being used, and 1873\&\f(CW\*(C`NSConstantString\*(C'\fR if the NeXT runtime is being used (see below). The 1874\&\fB\-fconstant\-cfstrings\fR option, if also present, will override the 1875\&\fB\-fconstant\-string\-class\fR setting and cause \f(CW\*(C`@"..."\*(C'\fR literals 1876to be laid out as constant CoreFoundation strings. 1877.IP "\fB\-fgnu\-runtime\fR" 4 1878.IX Item "-fgnu-runtime" 1879Generate object code compatible with the standard \s-1GNU\s0 Objective-C 1880runtime. This is the default for most types of systems. 1881.IP "\fB\-fnext\-runtime\fR" 4 1882.IX Item "-fnext-runtime" 1883Generate output compatible with the NeXT runtime. This is the default 1884for NeXT-based systems, including Darwin and Mac \s-1OS\s0 X. The macro 1885\&\f(CW\*(C`_\|_NEXT_RUNTIME_\|_\*(C'\fR is predefined if (and only if) this option is 1886used. 1887.IP "\fB\-fno\-nil\-receivers\fR" 4 1888.IX Item "-fno-nil-receivers" 1889Assume that all Objective-C message dispatches (e.g., 1890\&\f(CW\*(C`[receiver message:arg]\*(C'\fR) in this translation unit ensure that the receiver 1891is not \f(CW\*(C`nil\*(C'\fR. This allows for more efficient entry points in the runtime 1892to be used. Currently, this option is only available in conjunction with 1893the NeXT runtime on Mac \s-1OS\s0 X 10.3 and later. 1894.IP "\fB\-fobjc\-call\-cxx\-cdtors\fR" 4 1895.IX Item "-fobjc-call-cxx-cdtors" 1896For each Objective-C class, check if any of its instance variables is a 1897\&\*(C+ object with a non-trivial default constructor. If so, synthesize a 1898special \f(CW\*(C`\- (id) .cxx_construct\*(C'\fR instance method that will run 1899non-trivial default constructors on any such instance variables, in order, 1900and then return \f(CW\*(C`self\*(C'\fR. Similarly, check if any instance variable 1901is a \*(C+ object with a non-trivial destructor, and if so, synthesize a 1902special \f(CW\*(C`\- (void) .cxx_destruct\*(C'\fR method that will run 1903all such default destructors, in reverse order. 1904.Sp 1905The \f(CW\*(C`\- (id) .cxx_construct\*(C'\fR and/or \f(CW\*(C`\- (void) .cxx_destruct\*(C'\fR methods 1906thusly generated will only operate on instance variables declared in the 1907current Objective-C class, and not those inherited from superclasses. It 1908is the responsibility of the Objective-C runtime to invoke all such methods 1909in an object's inheritance hierarchy. The \f(CW\*(C`\- (id) .cxx_construct\*(C'\fR methods 1910will be invoked by the runtime immediately after a new object 1911instance is allocated; the \f(CW\*(C`\- (void) .cxx_destruct\*(C'\fR methods will 1912be invoked immediately before the runtime deallocates an object instance. 1913.Sp 1914As of this writing, only the NeXT runtime on Mac \s-1OS\s0 X 10.4 and later has 1915support for invoking the \f(CW\*(C`\- (id) .cxx_construct\*(C'\fR and 1916\&\f(CW\*(C`\- (void) .cxx_destruct\*(C'\fR methods. 1917.IP "\fB\-fobjc\-direct\-dispatch\fR" 4 1918.IX Item "-fobjc-direct-dispatch" 1919Allow fast jumps to the message dispatcher. On Darwin this is 1920accomplished via the comm page. 1921.IP "\fB\-fobjc\-exceptions\fR" 4 1922.IX Item "-fobjc-exceptions" 1923Enable syntactic support for structured exception handling in Objective\-C, 1924similar to what is offered by \*(C+ and Java. This option is 1925unavailable in conjunction with the NeXT runtime on Mac \s-1OS\s0 X 10.2 and 1926earlier. 1927.Sp 1928.Vb 23 1929\& @try { 1930\& ... 1931\& @throw expr; 1932\& ... 1933\& } 1934\& @catch (AnObjCClass *exc) { 1935\& ... 1936\& @throw expr; 1937\& ... 1938\& @throw; 1939\& ... 1940\& } 1941\& @catch (AnotherClass *exc) { 1942\& ... 1943\& } 1944\& @catch (id allOthers) { 1945\& ... 1946\& } 1947\& @finally { 1948\& ... 1949\& @throw expr; 1950\& ... 1951\& } 1952.Ve 1953.Sp 1954The \f(CW@throw\fR statement may appear anywhere in an Objective-C or 1955Objective\-\*(C+ program; when used inside of a \f(CW@catch\fR block, the 1956\&\f(CW@throw\fR may appear without an argument (as shown above), in which case 1957the object caught by the \f(CW@catch\fR will be rethrown. 1958.Sp 1959Note that only (pointers to) Objective-C objects may be thrown and 1960caught using this scheme. When an object is thrown, it will be caught 1961by the nearest \f(CW@catch\fR clause capable of handling objects of that type, 1962analogously to how \f(CW\*(C`catch\*(C'\fR blocks work in \*(C+ and Java. A 1963\&\f(CW\*(C`@catch(id ...)\*(C'\fR clause (as shown above) may also be provided to catch 1964any and all Objective-C exceptions not caught by previous \f(CW@catch\fR 1965clauses (if any). 1966.Sp 1967The \f(CW@finally\fR clause, if present, will be executed upon exit from the 1968immediately preceding \f(CW\*(C`@try ... @catch\*(C'\fR section. This will happen 1969regardless of whether any exceptions are thrown, caught or rethrown 1970inside the \f(CW\*(C`@try ... @catch\*(C'\fR section, analogously to the behavior 1971of the \f(CW\*(C`finally\*(C'\fR clause in Java. 1972.Sp 1973There are several caveats to using the new exception mechanism: 1974.RS 4 1975.IP "*" 4 1976Although currently designed to be binary compatible with \f(CW\*(C`NS_HANDLER\*(C'\fR\-style 1977idioms provided by the \f(CW\*(C`NSException\*(C'\fR class, the new 1978exceptions can only be used on Mac \s-1OS\s0 X 10.3 (Panther) and later 1979systems, due to additional functionality needed in the (NeXT) Objective-C 1980runtime. 1981.IP "*" 4 1982As mentioned above, the new exceptions do not support handling 1983types other than Objective-C objects. Furthermore, when used from 1984Objective\-\*(C+, the Objective-C exception model does not interoperate with \*(C+ 1985exceptions at this time. This means you cannot \f(CW@throw\fR an exception 1986from Objective-C and \f(CW\*(C`catch\*(C'\fR it in \*(C+, or vice versa 1987(i.e., \f(CW\*(C`throw ... @catch\*(C'\fR). 1988.RE 1989.RS 4 1990.Sp 1991The \fB\-fobjc\-exceptions\fR switch also enables the use of synchronization 1992blocks for thread-safe execution: 1993.Sp 1994.Vb 3 1995\& @synchronized (ObjCClass *guard) { 1996\& ... 1997\& } 1998.Ve 1999.Sp 2000Upon entering the \f(CW@synchronized\fR block, a thread of execution shall 2001first check whether a lock has been placed on the corresponding \f(CW\*(C`guard\*(C'\fR 2002object by another thread. If it has, the current thread shall wait until 2003the other thread relinquishes its lock. Once \f(CW\*(C`guard\*(C'\fR becomes available, 2004the current thread will place its own lock on it, execute the code contained in 2005the \f(CW@synchronized\fR block, and finally relinquish the lock (thereby 2006making \f(CW\*(C`guard\*(C'\fR available to other threads). 2007.Sp 2008Unlike Java, Objective-C does not allow for entire methods to be marked 2009\&\f(CW@synchronized\fR. Note that throwing exceptions out of 2010\&\f(CW@synchronized\fR blocks is allowed, and will cause the guarding object 2011to be unlocked properly. 2012.RE 2013.IP "\fB\-fobjc\-gc\fR" 4 2014.IX Item "-fobjc-gc" 2015Enable garbage collection (\s-1GC\s0) in Objective-C and Objective\-\*(C+ programs. 2016.IP "\fB\-freplace\-objc\-classes\fR" 4 2017.IX Item "-freplace-objc-classes" 2018Emit a special marker instructing \fB\f(BIld\fB\|(1)\fR not to statically link in 2019the resulting object file, and allow \fB\f(BIdyld\fB\|(1)\fR to load it in at 2020run time instead. This is used in conjunction with the Fix-and-Continue 2021debugging mode, where the object file in question may be recompiled and 2022dynamically reloaded in the course of program execution, without the need 2023to restart the program itself. Currently, Fix-and-Continue functionality 2024is only available in conjunction with the NeXT runtime on Mac \s-1OS\s0 X 10.3 2025and later. 2026.IP "\fB\-fzero\-link\fR" 4 2027.IX Item "-fzero-link" 2028When compiling for the NeXT runtime, the compiler ordinarily replaces calls 2029to \f(CW\*(C`objc_getClass("...")\*(C'\fR (when the name of the class is known at 2030compile time) with static class references that get initialized at load time, 2031which improves run-time performance. Specifying the \fB\-fzero\-link\fR flag 2032suppresses this behavior and causes calls to \f(CW\*(C`objc_getClass("...")\*(C'\fR 2033to be retained. This is useful in Zero-Link debugging mode, since it allows 2034for individual class implementations to be modified during program execution. 2035.IP "\fB\-gen\-decls\fR" 4 2036.IX Item "-gen-decls" 2037Dump interface declarations for all classes seen in the source file to a 2038file named \fI\fIsourcename\fI.decl\fR. 2039.IP "\fB\-Wassign\-intercept\fR" 4 2040.IX Item "-Wassign-intercept" 2041Warn whenever an Objective-C assignment is being intercepted by the 2042garbage collector. 2043.IP "\fB\-Wno\-protocol\fR" 4 2044.IX Item "-Wno-protocol" 2045If a class is declared to implement a protocol, a warning is issued for 2046every method in the protocol that is not implemented by the class. The 2047default behavior is to issue a warning for every method not explicitly 2048implemented in the class, even if a method implementation is inherited 2049from the superclass. If you use the \fB\-Wno\-protocol\fR option, then 2050methods inherited from the superclass are considered to be implemented, 2051and no warning is issued for them. 2052.IP "\fB\-Wselector\fR" 4 2053.IX Item "-Wselector" 2054Warn if multiple methods of different types for the same selector are 2055found during compilation. The check is performed on the list of methods 2056in the final stage of compilation. Additionally, a check is performed 2057for each selector appearing in a \f(CW\*(C`@selector(...)\*(C'\fR 2058expression, and a corresponding method for that selector has been found 2059during compilation. Because these checks scan the method table only at 2060the end of compilation, these warnings are not produced if the final 2061stage of compilation is not reached, for example because an error is 2062found during compilation, or because the \fB\-fsyntax\-only\fR option is 2063being used. 2064.IP "\fB\-Wstrict\-selector\-match\fR" 4 2065.IX Item "-Wstrict-selector-match" 2066Warn if multiple methods with differing argument and/or return types are 2067found for a given selector when attempting to send a message using this 2068selector to a receiver of type \f(CW\*(C`id\*(C'\fR or \f(CW\*(C`Class\*(C'\fR. When this flag 2069is off (which is the default behavior), the compiler will omit such warnings 2070if any differences found are confined to types which share the same size 2071and alignment. 2072.IP "\fB\-Wundeclared\-selector\fR" 4 2073.IX Item "-Wundeclared-selector" 2074Warn if a \f(CW\*(C`@selector(...)\*(C'\fR expression referring to an 2075undeclared selector is found. A selector is considered undeclared if no 2076method with that name has been declared before the 2077\&\f(CW\*(C`@selector(...)\*(C'\fR expression, either explicitly in an 2078\&\f(CW@interface\fR or \f(CW@protocol\fR declaration, or implicitly in 2079an \f(CW@implementation\fR section. This option always performs its 2080checks as soon as a \f(CW\*(C`@selector(...)\*(C'\fR expression is found, 2081while \fB\-Wselector\fR only performs its checks in the final stage of 2082compilation. This also enforces the coding style convention 2083that methods and selectors must be declared before being used. 2084.IP "\fB\-print\-objc\-runtime\-info\fR" 4 2085.IX Item "-print-objc-runtime-info" 2086Generate C header describing the largest structure that is passed by 2087value, if any. | |
2088.Sh "Options to Control Diagnostic Messages Formatting" 2089.IX Subsection "Options to Control Diagnostic Messages Formatting" 2090Traditionally, diagnostic messages have been formatted irrespective of 2091the output device's aspect (e.g. its width, ...). The options described 2092below can be used to control the diagnostic messages formatting 2093algorithm, e.g. how many characters per line, how often source location 2094information should be reported. Right now, only the \*(C+ front end can 2095honor these options. However it is expected, in the near future, that --- 35 unchanged lines hidden (view full) --- 2131for example \fB\-Wimplicit\fR to request warnings on implicit 2132declarations. Each of these specific warning options also has a 2133negative form beginning \fB\-Wno\-\fR to turn off warnings; 2134for example, \fB\-Wno\-implicit\fR. This manual lists only one of the 2135two forms, whichever is not the default. 2136.PP 2137The following options control the amount and kinds of warnings produced 2138by \s-1GCC\s0; for further, language-specific options also refer to | 1794.Sh "Options to Control Diagnostic Messages Formatting" 1795.IX Subsection "Options to Control Diagnostic Messages Formatting" 1796Traditionally, diagnostic messages have been formatted irrespective of 1797the output device's aspect (e.g. its width, ...). The options described 1798below can be used to control the diagnostic messages formatting 1799algorithm, e.g. how many characters per line, how often source location 1800information should be reported. Right now, only the \*(C+ front end can 1801honor these options. However it is expected, in the near future, that --- 35 unchanged lines hidden (view full) --- 1837for example \fB\-Wimplicit\fR to request warnings on implicit 1838declarations. Each of these specific warning options also has a 1839negative form beginning \fB\-Wno\-\fR to turn off warnings; 1840for example, \fB\-Wno\-implicit\fR. This manual lists only one of the 1841two forms, whichever is not the default. 1842.PP 1843The following options control the amount and kinds of warnings produced 1844by \s-1GCC\s0; for further, language-specific options also refer to |
2139\&\fB\*(C+ Dialect Options\fR and \fBObjective-C and Objective\-\*(C+ Dialect 2140Options\fR. | 1845\&\fB\*(C+ Dialect Options\fR. |
2141.IP "\fB\-fsyntax\-only\fR" 4 2142.IX Item "-fsyntax-only" 2143Check the code for syntax errors, but don't do anything beyond that. 2144.IP "\fB\-pedantic\fR" 4 2145.IX Item "-pedantic" 2146Issue all the warnings demanded by strict \s-1ISO\s0 C and \s-1ISO\s0 \*(C+; 2147reject all programs that use forbidden extensions, and some other 2148programs that do not follow \s-1ISO\s0 C and \s-1ISO\s0 \*(C+. For \s-1ISO\s0 C, follows the --- 133 unchanged lines hidden (view full) --- 2282\&\-Wformat\-nonliteral \-Wformat\-security \-Wformat\-y2k\fR. 2283.IP "\fB\-Wnonnull\fR" 4 2284.IX Item "-Wnonnull" 2285Warn about passing a null pointer for arguments marked as 2286requiring a non-null value by the \f(CW\*(C`nonnull\*(C'\fR function attribute. 2287.Sp 2288\&\fB\-Wnonnull\fR is included in \fB\-Wall\fR and \fB\-Wformat\fR. It 2289can be disabled with the \fB\-Wno\-nonnull\fR option. | 1846.IP "\fB\-fsyntax\-only\fR" 4 1847.IX Item "-fsyntax-only" 1848Check the code for syntax errors, but don't do anything beyond that. 1849.IP "\fB\-pedantic\fR" 4 1850.IX Item "-pedantic" 1851Issue all the warnings demanded by strict \s-1ISO\s0 C and \s-1ISO\s0 \*(C+; 1852reject all programs that use forbidden extensions, and some other 1853programs that do not follow \s-1ISO\s0 C and \s-1ISO\s0 \*(C+. For \s-1ISO\s0 C, follows the --- 133 unchanged lines hidden (view full) --- 1987\&\-Wformat\-nonliteral \-Wformat\-security \-Wformat\-y2k\fR. 1988.IP "\fB\-Wnonnull\fR" 4 1989.IX Item "-Wnonnull" 1990Warn about passing a null pointer for arguments marked as 1991requiring a non-null value by the \f(CW\*(C`nonnull\*(C'\fR function attribute. 1992.Sp 1993\&\fB\-Wnonnull\fR is included in \fB\-Wall\fR and \fB\-Wformat\fR. It 1994can be disabled with the \fB\-Wno\-nonnull\fR option. |
2290.IP "\fB\-Winit\-self\fR (C, \*(C+, Objective-C and Objective\-\*(C+ only)" 4 2291.IX Item "-Winit-self (C, , Objective-C and Objective- only)" | 1995.IP "\fB\-Winit\-self\fR (C, \*(C+ only)" 4 1996.IX Item "-Winit-self (C, only)" |
2292Warn about uninitialized variables which are initialized with themselves. 2293Note this option can only be used with the \fB\-Wuninitialized\fR option, 2294which in turn only works with \fB\-O1\fR and above. 2295.Sp 2296For example, \s-1GCC\s0 will warn about \f(CW\*(C`i\*(C'\fR being uninitialized in the 2297following snippet only when \fB\-Winit\-self\fR has been specified: 2298.Sp 2299.Vb 5 --- 34 unchanged lines hidden (view full) --- 2334bracketed, but that for \fBb\fR is fully bracketed. 2335.Sp 2336.Vb 2 2337\& int a[2][2] = { 0, 1, 2, 3 }; 2338\& int b[2][2] = { { 0, 1 }, { 2, 3 } }; 2339.Ve 2340.Sp 2341This warning is enabled by \fB\-Wall\fR. | 1997Warn about uninitialized variables which are initialized with themselves. 1998Note this option can only be used with the \fB\-Wuninitialized\fR option, 1999which in turn only works with \fB\-O1\fR and above. 2000.Sp 2001For example, \s-1GCC\s0 will warn about \f(CW\*(C`i\*(C'\fR being uninitialized in the 2002following snippet only when \fB\-Winit\-self\fR has been specified: 2003.Sp 2004.Vb 5 --- 34 unchanged lines hidden (view full) --- 2039bracketed, but that for \fBb\fR is fully bracketed. 2040.Sp 2041.Vb 2 2042\& int a[2][2] = { 0, 1, 2, 3 }; 2043\& int b[2][2] = { { 0, 1 }, { 2, 3 } }; 2044.Ve 2045.Sp 2046This warning is enabled by \fB\-Wall\fR. |
2342.IP "\fB\-Wmissing\-include\-dirs\fR (C, \*(C+, Objective-C and Objective\-\*(C+ only)" 4 2343.IX Item "-Wmissing-include-dirs (C, , Objective-C and Objective- only)" | 2047.IP "\fB\-Wmissing\-include\-dirs\fR (C and \*(C+ only)" 4 2048.IX Item "-Wmissing-include-dirs (C, only)" |
2344Warn if a user-supplied include directory does not exist. 2345.IP "\fB\-Wparentheses\fR" 4 2346.IX Item "-Wparentheses" 2347Warn if parentheses are omitted in certain contexts, such 2348as when there is an assignment in a context where a truth value 2349is expected, or when operators are nested whose precedence people 2350often get confused about. Only the warning for an assignment used as 2351a truth value is supported when compiling \*(C+; the other warnings are --- 318 unchanged lines hidden (view full) --- 2670.RS 4 2671.RE 2672.IP "\fB\-Wall\fR" 4 2673.IX Item "-Wall" 2674All of the above \fB\-W\fR options combined. This enables all the 2675warnings about constructions that some users consider questionable, and 2676that are easy to avoid (or modify to prevent the warning), even in 2677conjunction with macros. This also enables some language-specific | 2049Warn if a user-supplied include directory does not exist. 2050.IP "\fB\-Wparentheses\fR" 4 2051.IX Item "-Wparentheses" 2052Warn if parentheses are omitted in certain contexts, such 2053as when there is an assignment in a context where a truth value 2054is expected, or when operators are nested whose precedence people 2055often get confused about. Only the warning for an assignment used as 2056a truth value is supported when compiling \*(C+; the other warnings are --- 318 unchanged lines hidden (view full) --- 2375.RS 4 2376.RE 2377.IP "\fB\-Wall\fR" 4 2378.IX Item "-Wall" 2379All of the above \fB\-W\fR options combined. This enables all the 2380warnings about constructions that some users consider questionable, and 2381that are easy to avoid (or modify to prevent the warning), even in 2382conjunction with macros. This also enables some language-specific |
2678warnings described in \fB\*(C+ Dialect Options\fR and 2679\&\fBObjective-C and Objective\-\*(C+ Dialect Options\fR. | 2383warnings described in \fB\*(C+ Dialect Options\fR. |
2680.PP 2681The following \fB\-W...\fR options are not implied by \fB\-Wall\fR. 2682Some of them warn about constructions that users generally do not 2683consider questionable, but which occasionally you might wish to check 2684for; others warn about constructions that are necessary or hard to avoid 2685in some cases, and there is no simple way to modify the code to suppress 2686the warning. 2687.IP "\fB\-Wextra\fR" 4 --- 531 unchanged lines hidden (view full) --- 3219not generally indicate that there is anything wrong with your code; it 3220merely indicates that \s-1GCC\s0's optimizers were unable to handle the code 3221effectively. Often, the problem is that your code is too big or too 3222complex; \s-1GCC\s0 will refuse to optimize programs when the optimization 3223itself is likely to take inordinate amounts of time. 3224.IP "\fB\-Wpointer\-sign\fR" 4 3225.IX Item "-Wpointer-sign" 3226Warn for pointer argument passing or assignment with different signedness. | 2384.PP 2385The following \fB\-W...\fR options are not implied by \fB\-Wall\fR. 2386Some of them warn about constructions that users generally do not 2387consider questionable, but which occasionally you might wish to check 2388for; others warn about constructions that are necessary or hard to avoid 2389in some cases, and there is no simple way to modify the code to suppress 2390the warning. 2391.IP "\fB\-Wextra\fR" 4 --- 531 unchanged lines hidden (view full) --- 2923not generally indicate that there is anything wrong with your code; it 2924merely indicates that \s-1GCC\s0's optimizers were unable to handle the code 2925effectively. Often, the problem is that your code is too big or too 2926complex; \s-1GCC\s0 will refuse to optimize programs when the optimization 2927itself is likely to take inordinate amounts of time. 2928.IP "\fB\-Wpointer\-sign\fR" 4 2929.IX Item "-Wpointer-sign" 2930Warn for pointer argument passing or assignment with different signedness. |
3227This option is only supported for C and Objective\-C. It is implied by 3228\&\fB\-Wall\fR and by \fB\-pedantic\fR, which can be disabled with | 2931This option is only supported for C. It is implied by \&\fB\-Wall\fR 2932and by \fB\-pedantic\fR, which can be disabled with |
3229\&\fB\-Wno\-pointer\-sign\fR. 3230.IP "\fB\-Werror\fR" 4 3231.IX Item "-Werror" 3232Make all warnings into errors. 3233.IP "\fB\-Werror=\fR" 4 3234.IX Item "-Werror=" 3235Make the specified warning into an errors. The specifier for a 3236warning is appended, for example \fB\-Werror=switch\fR turns the --- 3052 unchanged lines hidden (view full) --- 6289safe to edit the filename if the \s-1PCH\s0 file is available in a different 6290location. The filename may be absolute or it may be relative to \s-1GCC\s0's 6291current directory. 6292.IP "\fB\-x c\fR" 4 6293.IX Item "-x c" 6294.PD 0 6295.IP "\fB\-x c++\fR" 4 6296.IX Item "-x c++" | 2933\&\fB\-Wno\-pointer\-sign\fR. 2934.IP "\fB\-Werror\fR" 4 2935.IX Item "-Werror" 2936Make all warnings into errors. 2937.IP "\fB\-Werror=\fR" 4 2938.IX Item "-Werror=" 2939Make the specified warning into an errors. The specifier for a 2940warning is appended, for example \fB\-Werror=switch\fR turns the --- 3052 unchanged lines hidden (view full) --- 5993safe to edit the filename if the \s-1PCH\s0 file is available in a different 5994location. The filename may be absolute or it may be relative to \s-1GCC\s0's 5995current directory. 5996.IP "\fB\-x c\fR" 4 5997.IX Item "-x c" 5998.PD 0 5999.IP "\fB\-x c++\fR" 4 6000.IX Item "-x c++" |
6297.IP "\fB\-x objective-c\fR" 4 6298.IX Item "-x objective-c" | |
6299.IP "\fB\-x assembler-with-cpp\fR" 4 6300.IX Item "-x assembler-with-cpp" 6301.PD | 6001.IP "\fB\-x assembler-with-cpp\fR" 4 6002.IX Item "-x assembler-with-cpp" 6003.PD |
6302Specify the source language: C, \*(C+, Objective\-C, or assembly. This has | 6004Specify the source language: C, \*(C+, or assembly. This has |
6303nothing to do with standards conformance or extensions; it merely 6304selects which base syntax to expect. If you give none of these options, 6305cpp will deduce the language from the extension of the source file: 6306\&\fB.c\fR, \fB.cc\fR, \fB.m\fR, or \fB.S\fR. Some other common 6307extensions for \*(C+ and assembly are also recognized. If cpp does not 6308recognize the extension, it will treat the file as C; this is the most 6309generic mode. 6310.Sp --- 412 unchanged lines hidden (view full) --- 6723Normally the files found this way are library files\-\-\-archive files 6724whose members are object files. The linker handles an archive file by 6725scanning through it for members which define symbols that have so far 6726been referenced but not defined. But if the file that is found is an 6727ordinary object file, it is linked in the usual fashion. The only 6728difference between using an \fB\-l\fR option and specifying a file name 6729is that \fB\-l\fR surrounds \fIlibrary\fR with \fBlib\fR and \fB.a\fR 6730and searches several directories. | 6005nothing to do with standards conformance or extensions; it merely 6006selects which base syntax to expect. If you give none of these options, 6007cpp will deduce the language from the extension of the source file: 6008\&\fB.c\fR, \fB.cc\fR, \fB.m\fR, or \fB.S\fR. Some other common 6009extensions for \*(C+ and assembly are also recognized. If cpp does not 6010recognize the extension, it will treat the file as C; this is the most 6011generic mode. 6012.Sp --- 412 unchanged lines hidden (view full) --- 6425Normally the files found this way are library files\-\-\-archive files 6426whose members are object files. The linker handles an archive file by 6427scanning through it for members which define symbols that have so far 6428been referenced but not defined. But if the file that is found is an 6429ordinary object file, it is linked in the usual fashion. The only 6430difference between using an \fB\-l\fR option and specifying a file name 6431is that \fB\-l\fR surrounds \fIlibrary\fR with \fBlib\fR and \fB.a\fR 6432and searches several directories. |
6731.IP "\fB\-lobjc\fR" 4 6732.IX Item "-lobjc" 6733You need this special case of the \fB\-l\fR option in order to 6734link an Objective-C or Objective\-\*(C+ program. | |
6735.IP "\fB\-nostartfiles\fR" 4 6736.IX Item "-nostartfiles" 6737Do not use the standard system startup files when linking. 6738The standard system libraries are used normally, unless \fB\-nostdlib\fR 6739or \fB\-nodefaultlibs\fR is used. 6740.IP "\fB\-nodefaultlibs\fR" 4 6741.IX Item "-nodefaultlibs" 6742Do not use the standard system libraries when linking. --- 6287 unchanged lines hidden (view full) --- 13030preprocessor. 13031.IP "\fB\s-1CPATH\s0\fR" 4 13032.IX Item "CPATH" 13033.PD 0 13034.IP "\fBC_INCLUDE_PATH\fR" 4 13035.IX Item "C_INCLUDE_PATH" 13036.IP "\fB\s-1CPLUS_INCLUDE_PATH\s0\fR" 4 13037.IX Item "CPLUS_INCLUDE_PATH" | 6433.IP "\fB\-nostartfiles\fR" 4 6434.IX Item "-nostartfiles" 6435Do not use the standard system startup files when linking. 6436The standard system libraries are used normally, unless \fB\-nostdlib\fR 6437or \fB\-nodefaultlibs\fR is used. 6438.IP "\fB\-nodefaultlibs\fR" 4 6439.IX Item "-nodefaultlibs" 6440Do not use the standard system libraries when linking. --- 6287 unchanged lines hidden (view full) --- 12728preprocessor. 12729.IP "\fB\s-1CPATH\s0\fR" 4 12730.IX Item "CPATH" 12731.PD 0 12732.IP "\fBC_INCLUDE_PATH\fR" 4 12733.IX Item "C_INCLUDE_PATH" 12734.IP "\fB\s-1CPLUS_INCLUDE_PATH\s0\fR" 4 12735.IX Item "CPLUS_INCLUDE_PATH" |
13038.IP "\fB\s-1OBJC_INCLUDE_PATH\s0\fR" 4 13039.IX Item "OBJC_INCLUDE_PATH" | |
13040.PD 13041Each variable's value is a list of directories separated by a special 13042character, much like \fB\s-1PATH\s0\fR, in which to look for header files. 13043The special character, \f(CW\*(C`PATH_SEPARATOR\*(C'\fR, is target-dependent and 13044determined at \s-1GCC\s0 build time. For Microsoft Windows-based targets it is a 13045semicolon, and for almost all other targets it is a colon. 13046.Sp 13047\&\fB\s-1CPATH\s0\fR specifies a list of directories to be searched as if --- 86 unchanged lines hidden --- | 12736.PD 12737Each variable's value is a list of directories separated by a special 12738character, much like \fB\s-1PATH\s0\fR, in which to look for header files. 12739The special character, \f(CW\*(C`PATH_SEPARATOR\*(C'\fR, is target-dependent and 12740determined at \s-1GCC\s0 build time. For Microsoft Windows-based targets it is a 12741semicolon, and for almost all other targets it is a colon. 12742.Sp 12743\&\fB\s-1CPATH\s0\fR specifies a list of directories to be searched as if --- 86 unchanged lines hidden --- |