Suppressing Warnings in GCC and Clang
阿新 • • 發佈:2022-12-13
#pragma GCC diagnostic ignored "-Wunused-parameter"和#pragma GCC diagnostic ignored "-Wdeprecated-declarations"極其有用
Suppressing Warnings in GCC and Clang (nelkinda.com)
GCC Command Line Options 下面列出一些有趣的:
--help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...] Display specific types of command line options -dumpspecs Display all of the built in spec strings -print-search-dirs Display the directories in the compiler's search path -print-sysroot Display the target libraries directory -pipe Use pipes rather than intermediate files -time Time the execution of each subprocess --sysroot=<directory> Use <directory> as the root directory for headers and libraries -B <directory> Add <directory> to the compiler's search paths -v Display the programs invoked by the compiler -E Preprocess only; do not compile, assemble or link -S Compile only; do not assemble or link -m128bit-long-double sizeof(long double) is 16 -m96bit-long-double sizeof(long double) is 12 -m32 Generate 32bit i386 code -m3dnow Support 3DNow! built-in functions -m3dnowa Support Athlon 3Dnow! built-in functions -m64 Generate 64bit x86-64 code -mabm Support code generation of Advanced Bit Manipulation (ABM) instructions. -mavx Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX built-in functions and code generation -mwin32 Set Windows defines -mwindows Create GUI application -fPIC Generate position-independent code if possible (large mode) -fPIE Generate position-independent code for executables if possible (large mode) -pie Create a position independent executable -shared Create a shared library -g Generate debug information in default format -ggdb Generate debug information in default extended format -p Enable function profiling -O<number> Set optimization level to <number> -Os Optimize for space rather than speed -Ofast Disregard strict standards compliance. -Ofast enables all -O3 optimizations.
Optimize Options (Using the GNU Compiler Collection (GCC)) 沒有-O4,最高就是3: