Hi,大家好,我是编程小6,很荣幸遇见你,我把这些年在开发过程中遇到的问题或想法写出来,今天说一说
ubuntu 20.04 gcc_ubuntu桌面环境哪个好,希望能够帮助你!!!。
GCC是每个从事Linux,以及嵌入式开发等必备的编译器,由于帮助手册较多,这里使用了分页的形式进行分享,如下为Ubuntu Server 22.04操作系统平台和GCC编译器的基本信息。
GCC帮助手册的第9小节,第1888~2288行。
1888 struct S { S(int); };
1889 void f(double a) {
1890 S x(int(a)); // extern struct S x (int);
1891 S y(int()); // extern struct S y (int (*) (void));
1892 S z(); // extern struct S z (void);
1893 }
1894 The warning will suggest options how to deal with such an ambiguity; e.g., it can suggest removing the
1895 parentheses or using braces instead.
1896 This warning is enabled by default.
1897 -Wno-class-conversion (C++ and Objective-C++ only)
1898 Do not warn when a conversion function converts an object to the same type, to a base class of that type,
1899 or to void; such a conversion function will never be called.
1900 -Wvolatile (C++ and Objective-C++ only)
1901 Warn about deprecated uses of the "volatile" qualifier. This includes postfix and prefix "++" and "--"
1902 expressions of "volatile"-qualified types, using simple assignments where the left operand is a
1903 "volatile"-qualified non-class type for their value, compound assignments where the left operand is a
1904 "volatile"-qualified non-class type, "volatile"-qualified function return type, "volatile"-qualified
1905 parameter type, and structured bindings of a "volatile"-qualified type. This usage was deprecated in
1906 C++20.
1907 Enabled by default with -std=c++20.
1908 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
1909 Warn when a literal 0 is used as null pointer constant. This can be useful to facilitate the conversion to
1910 "nullptr" in C++11.
1911 -Waligned-new
1912 Warn about a new-expression of a type that requires greater alignment than the "alignof(std::max_align_t)"
1913 but uses an allocation function without an explicit alignment parameter. This option is enabled by -Wall.
1914 Normally this only warns about global allocation functions, but -Waligned-new=all also warns about class
1915 member allocation functions.
1916 -Wno-placement-new
1917 -Wplacement-new=n
1918 Warn about placement new expressions with undefined behavior, such as constructing an object in a buffer
1919 that is smaller than the type of the object. For example, the placement new expression below is diagnosed
1920 because it attempts to construct an array of 64 integers in a buffer only 64 bytes large.
1921 char buf [64];
1922 new (buf) int[64];
1923 This warning is enabled by default.
1924 -Wplacement-new=1
1925 This is the default warning level of -Wplacement-new. At this level the warning is not issued for some
1926 strictly undefined constructs that GCC allows as extensions for compatibility with legacy code. For
1927 example, the following "new" expression is not diagnosed at this level even though it has undefined
1928 behavior according to the C++ standard because it writes past the end of the one-element array.
1929 struct S { int n, a[1]; };
1930 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
1931 new (s->a)int [32]();
1932 -Wplacement-new=2
1933 At this level, in addition to diagnosing all the same constructs as at level 1, a diagnostic is also
1934 issued for placement new expressions that construct an object in the last member of structure whose
1935 type is an array of a single element and whose size is less than the size of the object being
1936 constructed. While the previous example would be diagnosed, the following construct makes use of the
1937 flexible member array extension to avoid the warning at level 2.
1938 struct S { int n, a[]; };
1939 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
1940 new (s->a)int [32]();
1941 -Wcatch-value
1942 -Wcatch-value=n (C++ and Objective-C++ only)
1943 Warn about catch handlers that do not catch via reference. With -Wcatch-value=1 (or -Wcatch-value for
1944 short) warn about polymorphic class types that are caught by value. With -Wcatch-value=2 warn about all
1945 class types that are caught by value. With -Wcatch-value=3 warn about all types that are not caught by
1946 reference. -Wcatch-value is enabled by -Wall.
1947 -Wconditionally-supported (C++ and Objective-C++ only)
1948 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
1949 -Wno-delete-incomplete (C++ and Objective-C++ only)
1950 Do not warn when deleting a pointer to incomplete type, which may cause undefined behavior at runtime.
1951 This warning is enabled by default.
1952 -Wextra-semi (C++, Objective-C++ only)
1953 Warn about redundant semicolons after in-class function definitions.
1954 -Wno-inaccessible-base (C++, Objective-C++ only)
1955 This option controls warnings when a base class is inaccessible in a class derived from it due to
1956 ambiguity. The warning is enabled by default. Note that the warning for ambiguous virtual bases is
1957 enabled by the -Wextra option.
1958 struct A { int a; };
1959 struct B : A { };
1960 struct C : B, A { };
1961 -Wno-inherited-variadic-ctor
1962 Suppress warnings about use of C++11 inheriting constructors when the base class inherited from has a C
1963 variadic constructor; the warning is on by default because the ellipsis is not inherited.
1964 -Wno-invalid-offsetof (C++ and Objective-C++ only)
1965 Suppress warnings from applying the "offsetof" macro to a non-POD type. According to the 2014 ISO C++
1966 standard, applying "offsetof" to a non-standard-layout type is undefined. In existing C++ implementations,
1967 however, "offsetof" typically gives meaningful results. This flag is for users who are aware that they are
1968 writing nonportable code and who have deliberately chosen to ignore the warning about it.
1969 The restrictions on "offsetof" may be relaxed in a future version of the C++ standard.
1970 -Wsized-deallocation (C++ and Objective-C++ only)
1971 Warn about a definition of an unsized deallocation function
1972 void operator delete (void *) noexcept;
1973 void operator delete[] (void *) noexcept;
1974 without a definition of the corresponding sized deallocation function
1975 void operator delete (void *, std::size_t) noexcept;
1976 void operator delete[] (void *, std::size_t) noexcept;
1977 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
1978 -Wsuggest-final-types
1979 Warn about types with virtual methods where code quality would be improved if the type were declared with
1980 the C++11 "final" specifier, or, if possible, declared in an anonymous namespace. This allows GCC to more
1981 aggressively devirtualize the polymorphic calls. This warning is more effective with link-time
1982 optimization, where the information about the class hierarchy graph is more complete.
1983 -Wsuggest-final-methods
1984 Warn about virtual methods where code quality would be improved if the method were declared with the C++11
1985 "final" specifier, or, if possible, its type were declared in an anonymous namespace or with the "final"
1986 specifier. This warning is more effective with link-time optimization, where the information about the
1987 class hierarchy graph is more complete. It is recommended to first consider suggestions of
1988 -Wsuggest-final-types and then rebuild with new annotations.
1989 -Wsuggest-override
1990 Warn about overriding virtual functions that are not marked with the "override" keyword.
1991 -Wuseless-cast (C++ and Objective-C++ only)
1992 Warn when an expression is casted to its own type.
1993 -Wno-conversion-null (C++ and Objective-C++ only)
1994 Do not warn for conversions between "NULL" and non-pointer types. -Wconversion-null is enabled by default.
1995 Options Controlling Objective-C and Objective-C++ Dialects
1996 (NOTE: This manual does not describe the Objective-C and Objective-C++ languages themselves.
1997 This section describes the command-line options that are only meaningful for Objective-C and Objective-C++
1998 programs. You can also use most of the language-independent GNU compiler options. For example, you might
1999 compile a file some_class.m like this:
2000 gcc -g -fgnu-runtime -O -c some_class.m
2001 In this example, -fgnu-runtime is an option meant only for Objective-C and Objective-C++ programs; you can use
2002 the other options with any language supported by GCC.
2003 Note that since Objective-C is an extension of the C language, Objective-C compilations may also use options
2004 specific to the C front-end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may use C++-specific
2005 options (e.g., -Wabi).
2006 Here is a list of options that are only for compiling Objective-C and Objective-C++ programs:
2007 -fconstant-string-class=class-name
2008 Use class-name as the name of the class to instantiate for each literal string specified with the syntax
2009 "@"..."". The default class name is "NXConstantString" if the GNU runtime is being used, and
2010 "NSConstantString" if the NeXT runtime is being used (see below). The -fconstant-cfstrings option, if also
2011 present, overrides the -fconstant-string-class setting and cause "@"..."" literals to be laid out as
2012 constant CoreFoundation strings.
2013 -fgnu-runtime
2014 Generate object code compatible with the standard GNU Objective-C runtime. This is the default for most
2015 types of systems.
2016 -fnext-runtime
2017 Generate output compatible with the NeXT runtime. This is the default for NeXT-based systems, including
2018 Darwin and Mac OS X. The macro "__NEXT_RUNTIME__" is predefined if (and only if) this option is used.
2019 -fno-nil-receivers
2020 Assume that all Objective-C message dispatches ("[receiver message:arg]") in this translation unit ensure
2021 that the receiver is not "nil". This allows for more efficient entry points in the runtime to be used.
2022 This option is only available in conjunction with the NeXT runtime and ABI version 0 or 1.
2023 -fobjc-abi-version=n
2024 Use version n of the Objective-C ABI for the selected runtime. This option is currently supported only for
2025 the NeXT runtime. In that case, Version 0 is the traditional (32-bit) ABI without support for properties
2026 and other Objective-C 2.0 additions. Version 1 is the traditional (32-bit) ABI with support for properties
2027 and other Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If nothing is specified, the
2028 default is Version 0 on 32-bit target machines, and Version 2 on 64-bit target machines.
2029 -fobjc-call-cxx-cdtors
2030 For each Objective-C class, check if any of its instance variables is a C++ object with a non-trivial
2031 default constructor. If so, synthesize a special "- (id) .cxx_construct" instance method which runs non-
2032 trivial default constructors on any such instance variables, in order, and then return "self". Similarly,
2033 check if any instance variable is a C++ object with a non-trivial destructor, and if so, synthesize a
2034 special "- (void) .cxx_destruct" method which runs all such default destructors, in reverse order.
2035 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods thusly generated only operate on instance
2036 variables declared in the current Objective-C class, and not those inherited from superclasses. It is the
2037 responsibility of the Objective-C runtime to invoke all such methods in an object's inheritance hierarchy.
2038 The "- (id) .cxx_construct" methods are invoked by the runtime immediately after a new object instance is
2039 allocated; the "- (void) .cxx_destruct" methods are invoked immediately before the runtime deallocates an
2040 object instance.
2041 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has support for invoking the "- (id)
2042 .cxx_construct" and "- (void) .cxx_destruct" methods.
2043 -fobjc-direct-dispatch
2044 Allow fast jumps to the message dispatcher. On Darwin this is accomplished via the comm page.
2045 -fobjc-exceptions
2046 Enable syntactic support for structured exception handling in Objective-C, similar to what is offered by
2047 C++. This option is required to use the Objective-C keywords @try, @throw, @catch, @finally and
2048 @synchronized. This option is available with both the GNU runtime and the NeXT runtime (but not available
2049 in conjunction with the NeXT runtime on Mac OS X 10.2 and earlier).
2050 -fobjc-gc
2051 Enable garbage collection (GC) in Objective-C and Objective-C++ programs. This option is only available
2052 with the NeXT runtime; the GNU runtime has a different garbage collection implementation that does not
2053 require special compiler flags.
2054 -fobjc-nilcheck
2055 For the NeXT runtime with version 2 of the ABI, check for a nil receiver in method invocations before doing
2056 the actual method call. This is the default and can be disabled using -fno-objc-nilcheck. Class methods
2057 and super calls are never checked for nil in this way no matter what this flag is set to. Currently this
2058 flag does nothing when the GNU runtime, or an older version of the NeXT runtime ABI, is used.
2059 -fobjc-std=objc1
2060 Conform to the language syntax of Objective-C 1.0, the language recognized by GCC 4.0. This only affects
2061 the Objective-C additions to the C/C++ language; it does not affect conformance to C/C++ standards, which
2062 is controlled by the separate C/C++ dialect option flags. When this option is used with the Objective-C or
2063 Objective-C++ compiler, any Objective-C syntax that is not recognized by GCC 4.0 is rejected. This is
2064 useful if you need to make sure that your Objective-C code can be compiled with older versions of GCC.
2065 -freplace-objc-classes
2066 Emit a special marker instructing ld(1) not to statically link in the resulting object file, and allow
2067 dyld(1) to load it in at run time instead. This is used in conjunction with the Fix-and-Continue debugging
2068 mode, where the object file in question may be recompiled and dynamically reloaded in the course of program
2069 execution, without the need to restart the program itself. Currently, Fix-and-Continue functionality is
2070 only available in conjunction with the NeXT runtime on Mac OS X 10.3 and later.
2071 -fzero-link
2072 When compiling for the NeXT runtime, the compiler ordinarily replaces calls to "objc_getClass("...")" (when
2073 the name of the class is known at compile time) with static class references that get initialized at load
2074 time, which improves run-time performance. Specifying the -fzero-link flag suppresses this behavior and
2075 causes calls to "objc_getClass("...")" to be retained. This is useful in Zero-Link debugging mode, since
2076 it allows for individual class implementations to be modified during program execution. The GNU runtime
2077 currently always retains calls to "objc_get_class("...")" regardless of command-line options.
2078 -fno-local-ivars
2079 By default instance variables in Objective-C can be accessed as if they were local variables from within
2080 the methods of the class they're declared in. This can lead to shadowing between instance variables and
2081 other variables declared either locally inside a class method or globally with the same name. Specifying
2082 the -fno-local-ivars flag disables this behavior thus avoiding variable shadowing issues.
2083 -fivar-visibility=[public|protected|private|package]
2084 Set the default instance variable visibility to the specified option so that instance variables declared
2085 outside the scope of any access modifier directives default to the specified visibility.
2086 -gen-decls
2087 Dump interface declarations for all classes seen in the source file to a file named sourcename.decl.
2088 -Wassign-intercept (Objective-C and Objective-C++ only)
2089 Warn whenever an Objective-C assignment is being intercepted by the garbage collector.
2090 -Wno-property-assign-default (Objective-C and Objective-C++ only)
2091 Do not warn if a property for an Objective-C object has no assign semantics specified.
2092 -Wno-protocol (Objective-C and Objective-C++ only)
2093 If a class is declared to implement a protocol, a warning is issued for every method in the protocol that
2094 is not implemented by the class. The default behavior is to issue a warning for every method not
2095 explicitly implemented in the class, even if a method implementation is inherited from the superclass. If
2096 you use the -Wno-protocol option, then methods inherited from the superclass are considered to be
2097 implemented, and no warning is issued for them.
2098 -Wobjc-root-class (Objective-C and Objective-C++ only)
2099 Warn if a class interface lacks a superclass. Most classes will inherit from "NSObject" (or "Object") for
2100 example. When declaring classes intended to be root classes, the warning can be suppressed by marking
2101 their interfaces with "__attribute__((objc_root_class))".
2102 -Wselector (Objective-C and Objective-C++ only)
2103 Warn if multiple methods of different types for the same selector are found during compilation. The check
2104 is performed on the list of methods in the final stage of compilation. Additionally, a check is performed
2105 for each selector appearing in a "@selector(...)" expression, and a corresponding method for that selector
2106 has been found during compilation. Because these checks scan the method table only at the end of
2107 compilation, these warnings are not produced if the final stage of compilation is not reached, for example
2108 because an error is found during compilation, or because the -fsyntax-only option is being used.
2109 -Wstrict-selector-match (Objective-C and Objective-C++ only)
2110 Warn if multiple methods with differing argument and/or return types are found for a given selector when
2111 attempting to send a message using this selector to a receiver of type "id" or "Class". When this flag is
2112 off (which is the default behavior), the compiler omits such warnings if any differences found are confined
2113 to types that share the same size and alignment.
2114 -Wundeclared-selector (Objective-C and Objective-C++ only)
2115 Warn if a "@selector(...)" expression referring to an undeclared selector is found. A selector is
2116 considered undeclared if no method with that name has been declared before the "@selector(...)" expression,
2117 either explicitly in an @interface or @protocol declaration, or implicitly in an @implementation section.
2118 This option always performs its checks as soon as a "@selector(...)" expression is found, while -Wselector
2119 only performs its checks in the final stage of compilation. This also enforces the coding style convention
2120 that methods and selectors must be declared before being used.
2121 -print-objc-runtime-info
2122 Generate C header describing the largest structure that is passed by value, if any.
2123 Options to Control Diagnostic Messages Formatting
2124 Traditionally, diagnostic messages have been formatted irrespective of the output device's aspect (e.g. its
2125 width, ...). You can use the options described below to control the formatting algorithm for diagnostic
2126 messages, e.g. how many characters per line, how often source location information should be reported. Note
2127 that some language front ends may not honor these options.
2128 -fmessage-length=n
2129 Try to format error messages so that they fit on lines of about n characters. If n is zero, then no line-
2130 wrapping is done; each error message appears on a single line. This is the default for all front ends.
2131 Note - this option also affects the display of the #error and #warning pre-processor directives, and the
2132 deprecated function/type/variable attribute. It does not however affect the pragma GCC warning and pragma
2133 GCC error pragmas.
2134 -fdiagnostics-plain-output
2135 This option requests that diagnostic output look as plain as possible, which may be useful when running
2136 dejagnu or other utilities that need to parse diagnostics output and prefer that it remain more stable over
2137 time. -fdiagnostics-plain-output is currently equivalent to the following options:
2138 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers -fdiagnostics-color=never
2139 -fdiagnostics-urls=never -fdiagnostics-path-format=separate-events In the future, if GCC changes the
2140 default appearance of its diagnostics, the corresponding option to disable the new behavior will be added
2141 to this list.
2142 -fdiagnostics-show-location=once
2143 Only meaningful in line-wrapping mode. Instructs the diagnostic messages reporter to emit source location
2144 information once; that is, in case the message is too long to fit on a single physical line and has to be
2145 wrapped, the source location won't be emitted (as prefix) again, over and over, in subsequent continuation
2146 lines. This is the default behavior.
2147 -fdiagnostics-show-location=every-line
2148 Only meaningful in line-wrapping mode. Instructs the diagnostic messages reporter to emit the same source
2149 location information (as prefix) for physical lines that result from the process of breaking a message
2150 which is too long to fit on a single line.
2151 -fdiagnostics-color[=WHEN]
2152 -fno-diagnostics-color
2153 Use color in diagnostics. WHEN is never, always, or auto. The default depends on how the compiler has
2154 been configured, it can be any of the above WHEN options or also never if GCC_COLORS environment variable
2155 isn't present in the environment, and auto otherwise. auto makes GCC use color only when the standard
2156 error is a terminal, and when not executing in an emacs shell. The forms -fdiagnostics-color and
2157 -fno-diagnostics-color are aliases for -fdiagnostics-color=always and -fdiagnostics-color=never,
2158 respectively.
2159 The colors are defined by the environment variable GCC_COLORS. Its value is a colon-separated list of
2160 capabilities and Select Graphic Rendition (SGR) substrings. SGR commands are interpreted by the terminal or
2161 terminal emulator. (See the section in the documentation of your text terminal for permitted values and
2162 their meanings as character attributes.) These substring values are integers in decimal representation and
2163 can be concatenated with semicolons. Common values to concatenate include 1 for bold, 4 for underline, 5
2164 for blink, 7 for inverse, 39 for default foreground color, 30 to 37 for foreground colors, 90 to 97 for
2165 16-color mode foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color modes foreground colors, 49
2166 for default background color, 40 to 47 for background colors, 100 to 107 for 16-color mode background
2167 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes background colors.
2168 The default GCC_COLORS is
2169 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
2170 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
2171 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
2172 type-diff=01;32
2173 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan, 32 is green, 34 is blue, 01 is bold,
2174 and 31 is red. Setting GCC_COLORS to the empty string disables colors. Supported capabilities are as
2175 follows.
2176 "error="
2177 SGR substring for error: markers.
2178 "warning="
2179 SGR substring for warning: markers.
2180 "note="
2181 SGR substring for note: markers.
2182 "path="
2183 SGR substring for colorizing paths of control-flow events as printed via -fdiagnostics-path-format=,
2184 such as the identifiers of individual events and lines indicating interprocedural calls and returns.
2185 "range1="
2186 SGR substring for first additional range.
2187 "range2="
2188 SGR substring for second additional range.
2189 "locus="
2190 SGR substring for location information, file:line or file:line:column etc.
2191 "quote="
2192 SGR substring for information printed within quotes.
2193 "fixit-insert="
2194 SGR substring for fix-it hints suggesting text to be inserted or replaced.
2195 "fixit-delete="
2196 SGR substring for fix-it hints suggesting text to be deleted.
2197 "diff-filename="
2198 SGR substring for filename headers within generated patches.
2199 "diff-hunk="
2200 SGR substring for the starts of hunks within generated patches.
2201 "diff-delete="
2202 SGR substring for deleted lines within generated patches.
2203 "diff-insert="
2204 SGR substring for inserted lines within generated patches.
2205 "type-diff="
2206 SGR substring for highlighting mismatching types within template arguments in the C++ frontend.
2207 -fdiagnostics-urls[=WHEN]
2208 Use escape sequences to embed URLs in diagnostics. For example, when -fdiagnostics-show-option emits text
2209 showing the command-line option controlling a diagnostic, embed a URL for documentation of that option.
2210 WHEN is never, always, or auto. auto makes GCC use URL escape sequences only when the standard error is a
2211 terminal, and when not executing in an emacs shell or any graphical terminal which is known to be
2212 incompatible with this feature, see below.
2213 The default depends on how the compiler has been configured. It can be any of the above WHEN options.
2214 GCC can also be configured (via the --with-diagnostics-urls=auto-if-env configure-time option) so that the
2215 default is affected by environment variables. Under such a configuration, GCC defaults to using auto if
2216 either GCC_URLS or TERM_URLS environment variables are present and non-empty in the environment of the
2217 compiler, or never if neither are.
2218 However, even with -fdiagnostics-urls=always the behavior is dependent on those environment variables: If
2219 GCC_URLS is set to empty or no, do not embed URLs in diagnostics. If set to st, URLs use ST escape
2220 sequences. If set to bel, the default, URLs use BEL escape sequences. Any other non-empty value enables
2221 the feature. If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is an ANSI escape sequence,
2222 string terminator ESC \, BEL is an ASCII character, CTRL-G that usually sounds like a beep.
2223 At this time GCC tries to detect also a few terminals that are known to not implement the URL feature, and
2224 have bugs or at least had bugs in some versions that are still in use, where the URL escapes are likely to
2225 misbehave, i.e. print garbage on the screen. That list is currently xfce4-terminal, certain known to be
2226 buggy gnome-terminal versions, the linux console, and mingw. This check can be skipped with the
2227 -fdiagnostics-urls=always.
2228 -fno-diagnostics-show-option
2229 By default, each diagnostic emitted includes text indicating the command-line option that directly controls
2230 the diagnostic (if such an option is known to the diagnostic machinery). Specifying the
2231 -fno-diagnostics-show-option flag suppresses that behavior.
2232 -fno-diagnostics-show-caret
2233 By default, each diagnostic emitted includes the original source line and a caret ^ indicating the column.
2234 This option suppresses this information. The source line is truncated to n characters, if the
2235 -fmessage-length=n option is given. When the output is done to the terminal, the width is limited to the
2236 width given by the COLUMNS environment variable or, if not set, to the terminal width.
2237 -fno-diagnostics-show-labels
2238 By default, when printing source code (via -fdiagnostics-show-caret), diagnostics can label ranges of
2239 source code with pertinent information, such as the types of expressions:
2240 printf ("foo %s bar", long_i + long_j);
2241 ~^ ~~~~~~~~~~~~~~~
2242 | |
2243 char * long int
2244 This option suppresses the printing of these labels (in the example above, the vertical bars and the "char
2245 *" and "long int" text).
2246 -fno-diagnostics-show-cwe
2247 Diagnostic messages can optionally have an associated @url{https://cwe.mitre.org/index.html, CWE}
2248 identifier. GCC itself only provides such metadata for some of the -fanalyzer diagnostics. GCC plugins
2249 may also provide diagnostics with such metadata. By default, if this information is present, it will be
2250 printed with the diagnostic. This option suppresses the printing of this metadata.
2251 -fno-diagnostics-show-line-numbers
2252 By default, when printing source code (via -fdiagnostics-show-caret), a left margin is printed, showing
2253 line numbers. This option suppresses this left margin.
2254 -fdiagnostics-minimum-margin-width=width
2255 This option controls the minimum width of the left margin printed by -fdiagnostics-show-line-numbers. It
2256 defaults to 6.
2257 -fdiagnostics-parseable-fixits
2258 Emit fix-it hints in a machine-parseable format, suitable for consumption by IDEs. For each fix-it, a line
2259 will be printed after the relevant diagnostic, starting with the string "fix-it:". For example:
2260 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
2261 The location is expressed as a half-open range, expressed as a count of bytes, starting at byte 1 for the
2262 initial column. In the above example, bytes 3 through 20 of line 45 of "test.c" are to be replaced with
2263 the given string:
2264 00000000011111111112222222222
2265 12345678901234567890123456789
2266 gtk_widget_showall (dlg);
2267 ^^^^^^^^^^^^^^^^^^
2268 gtk_widget_show_all
2269 The filename and replacement string escape backslash as "\\", tab as "\t", newline as "\n", double quotes
2270 as "\"", non-printable characters as octal (e.g. vertical tab as "\013").
2271 An empty replacement string indicates that the given range is to be removed. An empty range (e.g.
2272 "45:3-45:3") indicates that the string is to be inserted at the given position.
2273 -fdiagnostics-generate-patch
2274 Print fix-it hints to stderr in unified diff format, after any diagnostics are printed. For example:
2275 --- test.c
2276 +++ test.c
2277 @ -42,5 +42,5 @
2278 void show_cb(GtkDialog *dlg)
2279 {
2280 - gtk_widget_showall(dlg);
2281 + gtk_widget_show_all(dlg);
2282 }
2283 The diff may or may not be colorized, following the same rules as for diagnostics (see
2284 -fdiagnostics-color).
2285 -fdiagnostics-show-template-tree
2286 In the C++ frontend, when printing diagnostics showing mismatching template types, such as:
2287 could not convert 'std::map<int, std::vector<double> >()'
2288 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
今天的分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。
上一篇
已是最后文章
下一篇
已是最新文章