リナックスコマンド

gccのヘルプ・マニュアル

日本語 英語

  • help
  • man

gcc --help

使い方: gcc [オプション] ファイル... オプション: -pass-exit-codes フェーズからのエラーコードの最大値を exit コードとして返す --help このヘルプ情報を表示 --target-help ターゲット固有のコマンドラインオプションを表示 --help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...] Display specific types of command line options (`-v --help' を使うと、子プロセスのコマンドラインオプションを表示) --version Display compiler version information -dumpspecs 組み込まれた spec 文字列を全て表示 -dumpversion コンパイラのバージョンを表示 -dumpmachine コンパイラのターゲットプロセッサを表示 -print-search-dirs コンパイラのサーチパスにあるディレクトリを表示 -print-libgcc-file-name コンパイラのコンパニオンライブラリ名を表示 -print-file-name= ライブラリ へのフルパスを表示 -print-prog-name= コンパイラの部品 へのフルパスを表示 -print-multi-directory libgcc のバージョンディレクトリルートを表示 -print-multi-lib コマンドラインオプションと複数のライブラリ探索 ディレクトリとの対応を表示 -print-multi-os-directory Display the relative path to OS libraries -print-sysroot Display the target libraries directory -print-sysroot-headers-suffix Display the sysroot suffix used to find headers -Wa, カンマ区切りの をアセンブラに渡す -Wp, カンマ区切りの をプリプロセッサに渡す -Wl, カンマ区切りの をリンカに渡す -Xassembler Pass on to the assembler -Xpreprocessor Pass on to the preprocessor -Xlinker をリンカに渡す -combine Pass multiple source files to compiler at once -save-temps 中間ファイルを削除しない -pipe 中間ファイルではなくパイプを使う -time 子プロセスごとの実行時間を計測する -specs= Override built-in specs with the contents of -std= 入力ソースを と見なす --sysroot= Use as the root directory for headers and libraries -B をコンパイラの探索パスに追加する -b インストールされていればターゲット として gcc を実行する -V インストールされていれば バージョン番号の gcc として実行する -v コンパイラによって起動されるプログラムを表示 -### Like -v but options quoted and commands not executed -E プリプロセスのみ -- コンパイル、アセンブル、リンク を行なわない -S コンパイルのみ -- アセンブル、リンクを行なわない -c コンパイル、アセンブルするが、リンクを行なわない -o に出力を行なう -x Specify the language of the following input files Permissible languages include: c c++ assembler none 'none' means revert to the default behavior of guessing the language based on the file's extension -g, -f, -m, -O, -W で始まるオプションや、--param は gcc が起動するあらゆる 子プロセスに自動的に渡されます。こういったプロセスにその他のオプションを渡す には -W オプションを使わなければなりません。 バグレポートの手順は、以下を参照 .

Usage: gcc [options] file... Options: -pass-exit-codes Exit with highest error code from a phase --help Display this information --target-help Display target specific command line options --help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...] Display specific types of command line options (Use '-v --help' to display command line options of sub-processes) --version Display compiler version information -dumpspecs Display all of the built in spec strings -dumpversion Display the version of the compiler -dumpmachine Display the compiler's target processor -print-search-dirs Display the directories in the compiler's search path -print-libgcc-file-name Display the name of the compiler's companion library -print-file-name= Display the full path to library -print-prog-name= Display the full path to compiler component -print-multi-directory Display the root directory for versions of libgcc -print-multi-lib Display the mapping between command line options and multiple library search directories -print-multi-os-directory Display the relative path to OS libraries -print-sysroot Display the target libraries directory -print-sysroot-headers-suffix Display the sysroot suffix used to find headers -Wa, Pass comma-separated on to the assembler -Wp, Pass comma-separated on to the preprocessor -Wl, Pass comma-separated on to the linker -Xassembler Pass on to the assembler -Xpreprocessor Pass on to the preprocessor -Xlinker Pass on to the linker -combine Pass multiple source files to compiler at once -save-temps Do not delete intermediate files -pipe Use pipes rather than intermediate files -time Time the execution of each subprocess -specs= Override built-in specs with the contents of -std= Assume that the input sources are for --sysroot= Use as the root directory for headers and libraries -B Add to the compiler's search paths -b Run gcc for target , if installed -V Run gcc version number , if installed -v Display the programs invoked by the compiler -### Like -v but options quoted and commands not executed -E Preprocess only; do not compile, assemble or link -S Compile only; do not assemble or link -c Compile and assemble, but do not link -o Place the output into -x Specify the language of the following input files Permissible languages include: c c++ assembler none 'none' means revert to the default behavior of guessing the language based on the file's extension Options starting with -g, -f, -m, -O, -W, or --param are automatically passed on to the various sub-processes invoked by gcc. In order to pass other options on to these processes the -W options must be used. For bug reporting instructions, please see: .

man gcc

GCC(1) GNU Tools GCC(1) 名称 gcc, g++ - GNU プロジェクト C および C++ コンパイラ (gcc-2.95.3) 書式 gcc [ option | filename ]... 注意 このマニュアルに書かれた情報は GNU C コンパイラの完全なドキュメンテーシ ョンからの抜粋であり、オプションの意味の記述にとどめます。 このマニュアルはボランティアのメンテナンスが行なわれた時にのみ更新さ れ る もので、常に最新の情報を示しているわけではありません。もしこのマニュ アルと実際のソフトウェアの間に矛盾点があれば、正式なドキュメントであ る Info ファイルのほうを参照して下さい。 こ のマニュアル中の古い記述が重大な混乱や不具合をきたすことになれば、こ のマニュアルページの配布は中止します。 GNU CCのメンテナンス作業の都合上 、 Info ファイルを更新した時にマニュアルページも併せて更新することはで きません。マニュアルページは時代遅れであり、これに時間をかけるべきで は ないと GNU プロジェクトでは考えています。 完全な最新のドキュメンテーションが必要な場合は、Info ファイルの‘gcc’ ま たはマニュアルの Using and Porting GNU CC (for version 2.0) を参照し て 下 さい。この双方は Texinfo のソースファイル gcc.texinfo から生成されま す。 解説 C と C++ のコンパイラは統合されています。どちらの場合も、入力ファイルは 、プリプロセス、コンパイル、アセンブル、リンクの 4 つの処理ステージのう ちの 1 つ以上のステージを踏んで処理されます。ソースファイル名の拡張子に よ ってソースの言語を識別しますが、デフォルトの動作は、どちらの名前でコ ンパイラを使うかに依存しています: gcc プリプロセス済みの (.i) ファイルを C のファイルと仮定し、C ス タ イルのリンクを行います。 g++ プリプロセス済みの(.i) ファイルを C++ のファイルと仮定し、C++ ス タイルのリンクを行います。 ソースファイル名の拡張子は、その言語が何であるかと、どのような処理が 行 われるべきかを示します: .c C言語ソースです。プリプロセッサ、コンパイラ、アセンブラにかけられます。 .C C++言語ソースです。プリプロセッサ、コンパイラ、アセンブラにかけられます。 .cc C++言語ソースです。プリプロセッサ、コンパイラ、アセンブラにかけられます。 .cxx C++言語ソースです。プリプロセッサ、コンパイラ、アセンブラにかけられます。 .m Objective-C 言語ソースです。プリプロセッサ、コンパイラ、アセンブラにかけられます。 .i プリプロセッサにかけられたC言語ソースです。コンパイラ、アセンブラにかけられます。 .ii プリプロセッサにかけられたC++言語ソースです。コンパイラ、アセンブラにかけられます。 .s アセンブリ言語ソースです。アセンブラにかけられます。 .S アセンブリ言語ソースです。プリプロセッサ、アセンブラにかけられます。 .h プリプロセッサファイルです。通常はコマンドラインには現れません。 そ の他の拡張子を持つファイルはリンカに渡されます。以下のものがあります 。 .o オブジェクトファイルです。 .a アーカイブファイルです。 リンクは、オプション -c, -S, -E を指定して抑制しないかぎり(もしくはコン パイルエラーによってすべての処理が中断しないかぎり)、常に最終ステージで 実行されます。リンクのステージにおいては、ソースファイルに対応した全 て の .o ファイルと、 -l で指定したライブラリと、認識されなかったファイル 名 (名前に .o のついたオブジェクトファイルや .a のついたアーカイブを 含 む) は、コマンドラインに並べられた順番でリンカに渡されます。 オプション オ プションは分割されていなければなりません。すなわち ‘-dr’ は ‘-d -r ’ とは異なった扱いを受けます。 ほとんどの ‘-f’ と ‘-W’ 形式のオプションには、 -fname と -fno-name ( ま た は -Wname と -Wno-name) の形式の、対照的な表現があります。ここではデ フォルトでない形式のみを示します。 すべてのオプションを種類別に分けてまとめました。詳しい解説は以下の節 で 行ないます。 FreeBSD 固有のオプション -pthread スレッド化ユーザプロセスに libc の代りに libc_r をリンクします。 スレッド化ユーザプロセスにリ ン ク さ れ る オ ブ ジ ェ ク ト は -D_THREAD_SAFE 付きでコンパイルする必要があります。 -kthread スレッド化カーネルプロセスに libc に加えて libpthread をリンクし ます。スレッド化カーネルプロセスにリンクされるオブジ ェ ク ト は -D_THREAD_SAFE 付きでコンパイルする必要があります。 全体的なオプション -c -S -E -o file -pipe -v -x language 言語オプション -ansi -fall-virtual -fcond-mismatch -fdollars-in-identifiers -fenum-int-equiv -fexternal-templates -fno-asm -fno-builtin -fhosted -fno-hosted -ffreestanding -fno-freestanding -fno-strict-prototype -fsigned-bitfields -fsigned-char -fthis-is-variable -funsigned-bitfields -funsigned-char -fwritable-strings -traditional -traditional-cpp -trigraphs 警告オプション -fsyntax-only -pedantic -pedantic-errors -w -W -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscript -Wcomment -Wconversion -Wenum-clash -Werror -Wformat -Wid-clash-len -Wimplicit -Wimplicit-int -Wimplicit-function-declaration -Winline -Wlong-long -Wmain -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-import -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wshadow -Wstrict-prototypes -Wswitch -Wtemplate-debugging -Wtraditional -Wtrigraphs -Wuninitialized -Wunused -Wwrite-strings デバッグオプション -a -dletters -fpretend-float -g -glevel -gcoff -gxcoff -gxcoff+ -gdwarf -gdwarf+ -gstabs -gstabs+ -ggdb -p -pg -save-temps -print-file-name=library -print-libgcc-file-name 最適化オプション -fcaller-saves -fcse-follow-jumps -fcse-skip-blocks -fdelayed-branch -felide-constructors -fexpensive-optimizations -ffast-math -ffloat-store -fforce-addr -fforce-mem -finline-functions -fkeep-inline-functions -fmemoize-lookups -fno-default-inline -fno-defer-pop -fno-function-cse -fno-inline -fno-peephole -fomit-frame-pointer -frerun-cse-after-loop -fschedule-insns -fschedule-insns2 -fstrength-reduce -fthread-jumps -funroll-all-loops -funroll-loops -O -O2 -O3 -O0 -Os プリプロセッサオプション -Aassertion -C -dD -dM -dN -Dmacro[=defn] -E -H -idirafter dir -include file -imacros file -iprefix file -iwithprefix dir -M -MD -MM -MMD -nostdinc -P -Umacro -undef アセンブラオプション -Wa,option リンカオプション -llibrary -nostartfiles -nostdlib -static -shared -symbolic -Xlinker option -Wl,option -u symbol ディレクトリオプション -Bprefix -Idir -I- -Ldir ターゲットオプション -b machine -V version コンフィギュレーション依存オプション M680x0 オプション -m68000 -m68020 -m68020-40 -m68030 -m68040 -m68881 -mbitfield -mc68000 -mc68020 -mfpa -mnobitfield -mrtd -mshort -msoft-float VAX オプション -mg -mgnu -munix SPARC オプション -mepilogue -mfpu -mhard-float -mno-fpu -mno-epilogue -msoft-float -msparclite -mv8 -msupersparc -mcypress Convex オプション -margcount -mc1 -mc2 -mnoargcount AMD29K オプション -m29000 -m29050 -mbw -mdw -mkernel-registers -mlarge -mnbw -mnodw -msmall -mstack-check -muser-registers M88K オプション -m88000 -m88100 -m88110 -mbig-pic -mcheck-zero-division -mhandle-large-shift -midentify-revision -mno-check-zero-division -mno-ocs-debug-info -mno-ocs-frame-position -mno-optimize-arg-area -mno-serialize-volatile -mno-underscores -mocs-debug-info -mocs-frame-position -moptimize-arg-area -mserialize-volatile -mshort-data-num -msvr3 -msvr4 -mtrap-large-shift -muse-div-instruction -mversion-03.00 -mwarn-passed-structs RS6000 オプション -mfp-in-toc -mno-fop-in-toc RT オプション -mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs -mfull-fp-blocks -mhc-struct-return -min-line-mul -mminimum-fp-blocks -mnohc-struct-return MIPS オプション -mcpu=cpu type -mips2 -mips3 -mint64 -mlong64 -mlonglong128 -mmips-as -mgas -mrnames -mno-rnames -mgpopt -mno-gpopt -mstats -mno-stats -mmemcpy -mno-memcpy -mno-mips-tfile -mmips-tfile -msoft-float -mhard-float -mabicalls -mno-abicalls -mhalf-pic -mno-half-pic -G num -nocpp i386 オプション -m386 -m486 -mpentium -mpentiumpro -mno-486 -mcpu=cpu type -march=cpu type -msoft-float -mrtd -mregparm -msvr3-shlib -mno-ieee-fp -mno-fp-ret-in-387 -mfancy-math-387 -mno-wide-multiply -mdebug-addr -mno-move -mprofiler-epilogue -reg-alloc=LIST HPPA オプション -mpa-risc-1-0 -mpa-risc-1-1 -mkernel -mshared-libs -mno-shared-libs -mlong-calls -mdisable-fpregs -mdisable-indexing -mtrailing-colon i960 オプション -mcpu-type -mnumerics -msoft-float -mleaf-procedures -mno-leaf-procedures -mtail-call -mno-tail-call -mcomplex-addr -mno-complex-addr -mcode-align -mno-code-align -mic-compat -mic2.0-compat -mic3.0-compat -masm-compat -mintel-asm -mstrict-align -mno-strict-align -mold-align -mno-old-align DEC Alpha オプション -mfp-regs -mno-fp-regs -mno-soft-float -msoft-float System V オプション -G -Qy -Qn -YP,paths -Ym,dir コード生成オプション -fcall-saved-reg -fcall-used-reg -ffixed-reg -finhibit-size-directive -fnonnull-objects -fno-common -fno-ident -fno-gnu-linker -fpcc-struct-return -fpic -fPIC -freg-struct-return -fshared-data -fshort-enums -fshort-double -fvolatile -fvolatile-global -fverbose-asm 全体的なオプション -x language このオプションに続く入力ファイルの言語を language であると明示的 に 指定します (拡張子に基づくデフォルトの選択よりも優先されます) 。このオプションは、次の ‘-x’ オプションが出てくるまで、後続する 全ての入力ファイルに対して適用されます。language としては、 ‘c’, ‘objective-c’, ‘c-header’, ‘c++’, ‘cpp-output’, ‘assembler’, ‘assembler-with-cpp’ を指定することが可能です。 -x none 言語の指定を解除します。このオプションのあとに続くファイルは、そ れらの拡張子に基づいて (あたかも何の ‘-x’ オプションも使用された ことがないように) 処理されます。 も し、4 つのステージ (プリプロセス、コンパイル、アセンブル、リンク) の うちの一部のみが必要な場合は、 ‘-x’ オプション (またはファイル名の拡 張 子) を 使 用して gcc に対してどのステージから開始するかを伝え、さらに ‘-c’, ‘-S’, ‘-E’ のオプションのうちのどれかを使用して gcc に対してど こ で 処理を停止させるかを指定します。ここで、いくつかの組み合わせ (例えば ‘-x cpp-output -E’) は gcc に対して何の動作も行なわないように指定するこ とになることに注意してください。 -c ソースファイルを、コンパイルまたはアセンブルまではしますが、リン クはしません。コンパイラの出力は、それぞれのソースファイルに対応 したオブジェクトファイルとなります。 デフォルトでは、GCC はオブジェクトファイルのファイル名として、ソ ースファイルの拡張子 ‘.c’, ‘.i’, ‘.s’ 等を ‘.o’ で置き換えたもの を使用します。 -o オプションを使用することによって、他の名前を指 定することも可能です。 GCC は -c オプションを使用した場合は、理解できない入力ファイル ( コンパイルやアセンブルを必要としないファイル) を無視します。 -S コンパイルが終った所で処理を停止し、アセンブルは行いません。アセ ンブラコードではない入力ファイルが指定された場合は、出力はアセン ブラコードのファイルになります。 デフォルトでは、GCC はアセンブラファイルのファイル名として、ソー スファイルの拡張子 ‘.c’, ‘.i’ 等を ‘.s’ で置き換えたものを使用し ます。 -o オプションを使用することによって、他の名前を指定するこ とも可能です。 GCC はコンパイルを必要としない入力ファイルを全て無視します。 -E プリプロセス処理が終了したところで停止します。コンパイルはしませ ん。出力はプリプロセス済みのソースコードであり、標準出力へと送ら れます。 GCC はプリプロセスを必要としない入力ファイルを全て無視します。 -o file 出力先を file に指定します。このオプションは GCC が実行可能フ ァ イル、オブジェクトファイル、アセンブラファイル、プリプロセス済み C コードなどの、いかなる種類の出力を行なう場合にも適用可能です。 出 力ファイルは 1 つしか指定できないため、 ‘-o’ を複数の入力ファ イルをコンパイルする際に使用することは、実行ファイルを出力する時 以外は無意味です。 ‘-o’オプションを指定しなかった場合のデフォルトは、実行ファイルを 作る場合は ‘a.out’ という名前であり、‘source.suffix’ の形式の フ ァ イ ル 名 を 持 っ た ソ ー スファイルのオブジェクトファイルは ‘source.o’ であり、アセンブラのファイルは ‘source.s’ です。プ リ プロセス済みの C 言語は、全て標準出力に送られます。 -v ( 標準エラー出力に対して) コンパイルの各ステージで実行されるコマ ンドを表示します。コンパイラドライバ、プリプロセッサおよび本来の コンパイラの各バージョン番号も表示します。 -pipe コンパイル時のステージの間のデータの受け渡しに、テンポラリファイ ルではなくパイプを使用します。いくつかのシステムではアセンブラが パイプからの入力を受け付けることができないために、このオプション を指定すると失敗します。 GNU アセンブラでは問題なく使用できま す 。 言語オプション 以下のオプションは、コンパイラが受け付ける C の方言に関する制御を行ない ます: -ansi 全ての ANSI 標準の C プログラムをサポートします。 このオプションは、GNU C が持つ ANSI C との非互換な機能を全て排除 します。例えば、asm, inline, typeof などのキーワードや、unix や vax などの現在使用しているシステムを規定する定義済みマクロなどが 抑制されます。さらに、好ましくなくかつほとんど使用されない ANSI の トライグラフの機能を使用可能とし、さらに ‘$’ を識別子の一部と して使用できないようにします。 代替キーワードである__asm__, __extension__, __inline__, __type- of__ は、 ‘-ansi’ が指定された場合でも使用することが可能です。も ちろん、これらを ANSI C プログラムで使用することが望ましくないの は当然ですが、‘-ansi’ をつけてコンパイルされる場合でも、インクル ードされるヘッダファイル中にこれらが記述できるということは有用で す。 __unix__ や __vax__ などの代替定義済みマクロは、 ‘-ansi’ を 指定する場合でも指定しない場合でも、利用可能となっています。 ‘-ansi’ オプションは、ANSI 準拠でないプログラムを不必要に拒否 す る こ と は あ り ません。もしこのような動作を行なわせたい場合に は‘-ansi’に加えて-pedantic’ オプションを指定する必要があります。 プリプロセッサ定義済みマクロ __STRICT_ANSI__ が ‘-ansi’ オプショ ンを使用した際には定義されます。いくつかのヘッダファイルは、この マ クロを識別して、ANSI 標準が望まない関数やマクロの定義を抑制し ます。これは、それらの関数やマクロと同じ名前を別の目的で使用する プログラムを混乱させないようにするためです。 -fno-asm asm, inline, typeof をキーワードとして解釈しません。これらの単語 は識別子として解釈されるようになります。これら の 代 用 と し て __asm__, __inline__, __typeof__ が使用できます。 ‘-ansi’ を指定 すると、暗黙のうちに ‘-fno-asm’ を指定したものとみなされます。 -fno-builtin ビルトイン関数のうち、2 つのアンダースコアで始まるもの以外を認識 し なくなります。現在、この指定は_exit, abort, abs, alloca, cos, exit, fabs, labs, memcmp, memcpy, sin, sqrt, strcmp, strcpy, strlen の関数に影響を及ぼします。 ‘-ansi’ オプションを指定すると、alloca と _exit はビルトイン関数 として扱われなくなります。 -fhosted ホスト実行環境 (hosted environment) 用にコンパイルを行います。こ れ により、‘-fbuiltin’ オプションが有効になり、また、不審な main 宣言に対して警告を発するようになります。 -ffreestanding フリースタンディング実行環境 (freestanding environment) 用にコン パ イルを行います。これにより、‘-fno-builtin’ オプションが有効に なり、また、 main に特別な条件は不要とみなします。 -fno-strict-prototype ‘int foo ();’ のような、引数を指定しない関数宣言を、C 言語のよう に引数の数や型について何の仮定もしないという扱いにします (C++ の み)。通常はこのような宣言は、C++ では foo という関数が 1 つも 引 数をとらないことを意味します。 -trigraphs ANSI C のトライグラフを使用可能とします。‘-ansi’ オプションを指 定すると、暗黙のうちに ‘-trigraphs’ を指定したものとみなされます 。 -traditional 伝 統的な C コンパイラのいくつかの特徴をサポートします。詳しくは GNU C のマニュアルを参照してください。以前はここにそのリストの複 製を載せていましたが、それらが完全に時代遅れになった時に我々に文 句が来ないように削除してしまいました。 しかし、C++ のプログラムだけについて (C ではありません) 特記して おくことが 1 つあります。 ‘-traditional’ オプションは C++ に対し て 1 つだけ特別な効果を持ちます。それは、 this への代入を許可 す る というものです。これは ‘-fthis-is-variable’オプションの指定が 及ぼす効果と同一のものです。 -traditional-cpp 伝統的な C プリプロセッサのいくつかの特徴をサポートします。こ れ は 上 に挙げた中で特にプリプロセッサに関係したものを含みますが、 ‘-traditional’ の指定によって引き起こされる以外の効果を及ぼす こ とはありません。 -fdollars-in-identifiers 識 別 子 中 の ‘$’ の使用を許可します (C++ のみ)。 ‘-fno-dol- lars-in-identifiers’ を使用することによって、明示的に ‘$’の使 用 を禁止することも可能です。(GNU C++ では、デフォルトで ‘$’ を許可 しているシステムと禁止しているシステムがあります)。 -fenum-int-equiv int から列挙型への暗黙の変換を許可します (C++ のみ)。通常は GNU C++ は enum から int への変換は許可していますが、逆は許していま せん。 -fexternal-templates テンプレート関数について、その関数が定義された場所にのみ単一のコ ピーを生成することによって、テンプレート宣言に対してより小さなコ ードを生成します (C++ のみ)。このオプションを使用して正しいコ ー ド を 得るためには、テンプレートを使用する全てのファイルにおいて 、‘#pragma implementation’ (定義) または ‘#pragma interface’ (宣 言) を記述しておく必要があります。 ‘-fexternal-templates’ を指定してコンパイルを行なう場合には、全 てのテンプレートの実体は external となります。全ての使用される実 体はインプリメンテーションファイル中にまとめて記述しておかなけれ ばなりません。これはその必要とされる実体に対応した typedef 宣 言 を 行 なうことによって実現できます。逆に、デフォルトのオプション ‘-fno-external-templates’ でコンパイルした場合には全てのテンプレ ートの実体は internal となります。 -fall-virtual 可能な限り全てのメンバ関数を暗黙のうちに仮想関数として扱います。 全てのメンバ関数 (コンストラクタと new , delete メンバ演算子を除 きます) は、出現した時点でそのクラスの仮想関数として扱われます。 これは、これらのメンバ関数への全ての呼び出しが仮想関数のための内 部テーブルを参照して間接的に決定されるということを意味しません。 特定の状況においては、コンパイラは与えられた仮想関数への呼び出し を直接決定できます。このような場合にはその関数呼び出しは常に直接 呼び出しとなります。 -fcond-mismatch 条件演算子の第 2, 第 3 引数の型が異なる記述を許します。このよ う な式の型は void となります。 -fthis-is-variable this への代入を許可します (C++ のみ)。ユーザ定義による記憶管理が 可能となった現在では、 ‘this’ への代入は時代遅れのものとなりまし た。従ってデフォルトでは、クラスのメンバ関数からの this への代入 は不当なものとして扱われています。しかし、後方互換性のため に 、 ‘-fthis-is-variable’ を指定することによってこの効果を得ることが できます。 -funsigned-char char 型を unsigned char のように符号無しとして扱います。 それぞれのマシンには char がどちらであるべきかというデフォルトが あ ります。デフォルトで unsigned char であることもあれば、デフォ ルトで signed char であることもあります。 理想的には、可搬性のあるプログラムは、オブジェクトの符号の有無に 依 存する記述を行なう場合には常に signed char、もしくは unsigned char を使用すべきです。しかし実際には多くのプログラムが 単 な る char を用いて記述されており、さらにそのプログラムを記述した環境 に依存して、符号付きである、あるいは符号無しであるという暗黙の仮 定が行なわれています。このオプション、あるいはこの逆のオプション は、デフォルトと逆の動作を行なわせることにより、これらのプログラ ムを正しく動作させることを可能にします。 char 型は常に signed char あるいは unsigned char とは区別された 型として扱われます。常にそれらの振舞いがそのどちらかと全く同じで あるということに関わらず、このような扱いを行います。 -fsigned-char char 型を signed char 型のように符号付きとして扱います。 ただし、このオプションは ‘-fno-unsigned-char’ と等価です。これは ‘-funsigned-char’の否定形です。同 様 に ‘-fno-signed-char’ は ‘-funsigned-char’ と等価です。 -fsigned-bitfields -funsigned-bitfields -fno-signed-bitfields -fno-unsigned-bitfields これらのオプションは、明示的に ‘signed’ または ‘unsigned’ の指定 が行なわれていないビットフィールドに対して、符号つきであるかある いは符号なしであるかを制御します。デフォルトではこのようなビット フィールドは符号つきとなっています。なぜなら、 int のような基 本 的な型は符号つきであるという点で、整合性がとれるからです。 た だし、‘-traditional’ を指定した場合は、ビットフィールドは常に 全て符号無しであるとされます。 -fwritable-strings 文字列定数を書き込み可能なデータセグメントに配置し、同内容の文字 列 を 1 つの共有オブジェクトにする処理を行いません。これは、文字 定数に書き込むことができることを仮定した昔のプログラムとの互換性 を とるために提供されています。‘-traditional’ オプションも同様の 効果を含みます。 文字定数に書き込むという考えは非常によくない考えです。“定数” は まさに定数であり、変化すべきではありません。 プリプロセッサオプション こ れらのオプションは C プリプロセッサを制御します。各 C ソースファイル は、実際にコンパイルする前に、C プリプロセッサにかけられます。 ‘-E’ オプションを使用すると、GCC はプリプロセス以外の処理を行いません。 以下に示すオプションのうちのいくつかは、‘-E’ と同時に使用された時のみ意 味をもちます。なぜならば、これらのオプションによって、実際のコンパイ ル には不適当なプリプロセッサ出力が生成されるためです。 -include file file を、通常の入力ファイルが処理される前に処理します。結果的に file に含まれる内容は、一番最初にコンパイルされることになりま す 。コマンドラインに指定されたすべての ‘-D’ や ‘-U’ オプションは、 その記述された順番に関わらず常に ‘-include file’ が処理される 前 に処理されます。全ての ‘-include’ や ‘-imacros’ オプションは、そ れらが記述された順番通りに処理されます。 -imacros file 通常の入力ファイルを処理する前にfile を入力として処理しますが 、 その結果の出力を捨てます。 file によって生成された出力は捨てられ るため、‘-imacros file’ の処理結果の影響は、file 中に記述され た マクロがメインの入力ファイル中で使用可能になることだけです。プリ プロセッサは、‘-imacros file’ が記述された順番に関わらず、これを 処理する前に、コマンドラインから与えられた全ての ‘-D’ や ‘-U’ オ プションを評価します。全ての ‘-include’ および ‘-imacros’ オプシ ョンは、それらが記述された順番通りに処理されます。 -idirafter dir デ ィレクトリ dir を第 2 インクルードパスに加えます。第 2 インク ルードパス中のディレクトリは、メインインクルードパス (オプション ‘-I’ によって追加されます) 中にヘッダファイルを探した結果発見で きなかった場合に検索されます。 -iprefix prefix prefix を、その後に続く ‘-iwithprefix’ オプション用のプレフィ ッ クスとして使用します。 -iwithprefix dir デ ィレクトリを第 2 インクルードパスに追加します。ディレクトリ名 は prefix と dir を連結することによって得られます。ここで prefix は、‘-iprefix’ オプションによって指定されたものです。 -nostdinc ヘ ッ ダファイルのための標準のシステムディレクトリを検索しません 。‘-I’ オプションによって指定したディレクトリ (またはカレント デ ィレクトリ) のみを検索します。 ‘-nostdinc’ と ‘-I-’を使用することにより、インクルードファイルの 検索パスを明示的に指定したディレクトリのみに限定することが可能と なります。 -nostdinc++ ヘッダファイルの検索に、C++-固有の標準ディレクトリを用いません。 ただしそれ以外の標準ディレクトリは検索されます。 (このオプション は ‘libg++’ の構築に使用されます。) -undef 標準でない定義済みマクロ(アーキテクチャフラグも含めて)を定義しま せん。 -E C プリプロセッサの処理のみを行います。指定された全ての C のソ ー スファイルに対してプリプロセスを行ない、標準出力、または指定され た出力ファイルに対して出力を行います。 -C プリプロセッサに対してコメントの削除を行なわないように指示します 。 ‘-E’ オプションとともに使用されます。 -P プリプロセッサに対して ‘#line’ コマンドを生成しないように指示し ます。 ‘-E’ オプションとともに使用されます。 -M [ -MG ] プリプロセッサに対してmake で使用可能な、オブジェクト間の依存 関 係を記述した出力を生成するように指示します。それぞれのソースファ イルに対して、プリプロセッサはmake のための規則を 1 つ出力します 。この出力は、ターゲットとしてそのソースファイルから生成されるオ ブジェクトファイルのファイル名をとり、依存するファイルのリストと しては ‘#include’ によってソースファイルに読み込まれる全てのファ イルの名前が並びます。この規則は 1 行、あるいは長い場合 に は‘\’ と改行を入れて複数行で出力されます。この規則のリストは、プリプロ セス済みの C プログラムのかわりに、標準出力へと出力されます。 ‘-M’ は暗黙のうちに ‘-E’ を含みます。 ‘-MG’ を指定すると、見つからないヘッダファイルは生成されたファイ ルであり、それらはソースファイルと同じディレクトリに存在するとみ なします。これは ‘-M’ と同時に指定しなければなりません。 -MM [ -MG ] ‘-M’ と似ていますが、‘#include "file"’によってインクルードされる ユーザ定義のヘッダファイルのみを対象にした出力ファイルを生成しま す。‘#include ’ によってインクルードされるシステムヘッダフ ァイルは省略されます。 -MD ‘-M’ と 似ていますが、依存情報は出力ファイル名の最後の ‘.o’ を ‘.d’ に置き換えたファイル名のファイルに対して出力 さ れ ま す 。 ‘-MD’ を 指 定したファイルのコンパイルもこれに加えて行なわれ、 ‘-M’ のように通常のコンパイルを抑制することはありません。 Mach のユーティリティである‘md’ は、これらの複数の ‘.d’ ファイル を ‘make’ コマンドによって使用できる単一の依存記述ファイルへとマ ージするのに使用することができます。 -MMD ‘-MD’ と似ていますが、ユーザヘッダファイルのみを対象とし、システ ムヘッダファイルを無視します。 -H 通常の動作に加えて、使用されたヘッダファイルの名前を表示します。 -Aquestion(answer) questionに対するアサーション answer を定義します。これ は ‘#if #question(answer)’ のようなプリプロセッサ条件節によってテストさ れます。‘-A-’ は標準のアサーション(通常はターゲットマシンに関 す る情報を表している)を禁止します。 -Dmacro マクロ macro に対して文字列 ‘1’ を定義として与えます。 -Dmacro=defn マ クロ macro を defn として定義します。コマンドライン上の全ての ‘-D’ オプションは ‘-U’ オプションの処理を行なう前に処理されま す 。 -Umacro マ クロ macro の定義を無効にします。‘-U’ オプションは全ての ‘-D’ オプションの処理が終了した後、‘-include’ と ‘-imacros’ オプシ ョ ンの処理の前に処理されます。 -dM プリプロセッサに対して、プリプロセス終了時に有効であったマクロの 定義のみを出力するように指示します。‘-E’ オプションとともに使 用 します。 -dD プリプロセッサに対して、全てのマクロ定義を適切な順番で出力中にそ のまま出力するように指示します。 -dN ‘-dD’ と似ていますが、マクロの引数と内容を削除します 。 出 力 に は‘#define name’ のみが含まれます。 アセンブラオプション -Wa,option option をアセンブラに対するオプションとして渡します。option がコ ンマを含む場合は、そのコンマで区切られた複数のオプションとして与 えられます。 リンカオプション こ れらのオプションは、コンパイラがオブジェクトファイル群をリンクして 1 つの実行可能ファイルを出力する際に使用されるものです。これらはコンパ イ ラがリンクステップを行なわない場合には意味を持ちません。 object-file-name 特別に認識される拡張子で終っていないファイル名は、オブジェクトフ ァイル、またはライブラリであると認識されます。(オブジェクトフ ァ イ ル とライブラリはリンカがその内容を参照することで区別されます 。) GCC がリンクステップを行なう場合は、これらのファイルはリンカ への入力として使用されます。 -llibrary 名前が library であるライブラリをリンク時に使用します。 リンカは、標準のライブラリ用ディレクトリのリスト中から、実際のフ ァイル名が ‘liblibrary.a’ であるファイルを検索します。リンカはこ のファイルを、ファイル名で直接指定した場合と同様に使用します。 検 索 するディレクトリには、いくつかの標準システムディレクトリと 、‘-L’ によって指定したディレクトリが含まれます。 通常、この方法で発見されるファイルはライブラリファイル、つまりい くつかのオブジェクトファイルをメンバとして含むアーカイブファイル です。リンカは、アーカイブファイルの中を検索して、参照されている が定義されていないシンボルを定義しているメンバを探し出します。し かし、もしリンカがライブラリでなく通常のオブジェクトファイルを発 見した場合は、そのオブジェクトファイルを通常の方法でリンクします 。‘-l’ オプションを使用する場合とファイル名を直接指定する場合 の 違 いは、‘-l’ の場合が library を ‘lib’ と ‘.a’ で囲み、いくつも のディレクトリを検索することだけです。 -lobjc Objective C のプログラムをリンクする場合は、この特別な -l オプシ ョンを指定する必要があります。 -nostartfiles リンク時に、標準のシステムスタートアップファイルを使用しません。 標準ライブラリは通常通りに使用されます。 -nostdlib リンク時に、標準のシステムライブラリとスタートアップファイルを使 用しません。指定したファイルのみがリンカに渡されます。 -static ダイナミックリンクをサポートするシステムにおいて、このオプション は共有ライブラリとのリンクを抑制します。それ以外のシステムではこ のオプションは意味を持ちません。 -shared 他のオブジェクトとリンクして実行可能プログラムを形成し得る共有オ ブジェクトを生成します。ごく少数のシステムでのみ、このオプション はサポートされています。 -symbolic 共有オブジェクトを構築する際に、グローバルなシンボルへの参照をバ インドします。全ての解決できなかった参照に対して警告を与えます ( た だしリンクエディタオプション ‘-Xlinker -z -Xlinker defs’ によ ってこれを無効化した場合を除きます)。ごく少数のシステムでのみ 、 このオプションはサポートされています。 -Xlinker option オプション option をリンカに対して渡します。リンカに渡すシステム 固有のオプションが、 GNU CC が理解できないものである場合に利用で きます。 引 数を持ったオプションを渡したい場合は、 ‘-Xlinker’ を 2 度使用 すれば可能です。1 度目でオプションを渡し、2 度目で引数を渡します 。 例 え ば ‘-assert definitions’ を渡すには、 ‘-Xlinker -assert -Xlinker definitions’ のように記述すれば可能 で す 。 ‘-Xlinker "-assert definitions"’ のように指定した場合は正常に動作しません 。なぜならこれは、文字列全体を 1 つの引数として渡してしまい、 リ ンカの期待する形式と異なってしまうからです。 -Wl,option オ プション option をリンカに渡します。option がコンマを含む場合 は、それらのコンマで複数のオプションとして分割されます。 -u symbol シンボル symbol が未定義であるかのように振舞います。これは強制的 にこのシンボルを定義しているライブラリモジュールをリンクするため に使用します。‘-u’ は異なったシンボルに対して複数回使用するこ と ができます。これによって、さらに多くのライブラリモジュールを読み 込ませることができます。 ディレクトリオプション これらのオプションは、ヘッダファイル、ライブラリ、コンパイラの一部を 検 索するディレクトリを指定するために使用されます。 -Idir ディレクトリ dir を、インクルードファイルの検索するディレクトリ のリスト中に追加します。 -I- ‘-I-’ オプション指定前に ‘-I’ オプションによって指定された全ての ディレクトリは、‘#include "file"’ の形式によってのみ検索されます 。これらのディレクトリは ‘#include ’ によっては検索され ま せん。 ‘ -I-’ オプション指定後に ‘-I’ で指定したディレクトリは、全ての ‘#include’ 命令によって検索されます。(通常は 全ての ‘-I’ で指 定 されたディレクトリはこの方法で検索されます。) こ れに加えて ‘-I-’ オプションは、カレントディレクトリ (現在の入 力ファイルが存在するディレクトリ) が ‘#include "file"’ に対す る 最初の検索対象となることを抑制します。‘-I-’ によるこの効果を上書 きする方法はありません。‘-I.’ を指定することによって、コンパイラ が起動されたディレクトリが検索されることを指定することは可能です 。これはプリプロセッサが行なうデフォルトの動作とは異なりますが、 たいていはこれで十分です。 ‘-I-’ は、ヘッダファイルの検索に標準のシステムディレクトリを使う ことを抑制するわけではありません。従って、‘-I-’ と ‘-nostdinc’ は独立です。 -Ldir ディレクトリdir を ‘-l’ による検索が行なわれるディレクトリのリス トに加えます。 -Bprefix このオプションはコンパイラ自身の実行形式、ライブラリ、データファ イルの検索場所を指定します。 コンパイラドライバはサブプログラム ‘cpp’, ‘cc1’ (または C++ にお いては ‘cc1plus’), ‘as’, そして ‘ld’ を 1 つ、あるいはそれ以上起 動します。コンパイラドライバは、起動するプログラムのプレフィック スとして prefix に ‘machine/version/’ をつけたものとつけないもの の双方を使用します。 コンパイラドライバは各サブプログラムの起動時に、 ‘-B’ プレフィッ クスの指定がある場合は、それを最初に利用します。もしその名前が見 つからなければ、または ‘-B’ が指定されていなければ、ドライバは 2 つの標準プレフィックス ‘/usr/lib/gcc/’ と ‘/usr/local/lib/gcc- lib/’ を試します。このどちらにも見つからなければ、コンパイラドラ イバは、環境変数 ‘PATH’ のディレクトリリストを利用して、そのプロ グラム名を検索します。 ランタイムサポートファイル ‘libgcc.a’ も、必要ならば ‘-B’ プレフ ィックスを用いて検索されます。もしそこに見つからなければ、前記 2 つの標準プレフィックスが試みられますが、それで終りです。この場合 はリンクの対象から外されます。ほとんどの場合、またほとんどのマシ ンでは、‘libgcc.a’ は実際には必要ではありません。 こ れと同じ効果を、環境変数 GCC_EXEC_PREFIX によっても得ることが できます。もしこの環境変数が定義されていれば、この値がプレフィッ ク ス と し て同様に使用されます。もし ‘-B’ オプションと GCC_EX- EC_PREFIX 環境変数の双方が存在した場合は、‘-B’ オプションが最 初 に使用され、環境変数は次に使用されます。 警告オプション 警 告は、本質的に間違いであるわけではありませんが、危険な構造を報告した り、エラーがあるかもしれないような部分を示唆する診断メッセージです。 以下のオプションは、GNU CC が生成する警告の量と種類を制御します。 -fsyntax-only コードの文法エラーをチェックしますが、一切出力は行いません。 -w 全ての警告メッセージを抑制します。 -Wno-import #import の利用による警告メッセージを抑制します。 -pedantic 厳密な ANSI 標準 C 言語で規定している全ての警告を表示し、許さ れ ていない拡張を使用したプログラムを全て拒否します。 正 当な ANSI 標準 C プログラムは、このオプションの有無に関わらず コンパイルできるべきです (もっとも、ほんのわずかではありま す が ‘-ansi’ を必要とするものはあります)。しかし、このオプションを使 用しない場合、 GNU 拡張や伝統的な C の特徴も、これに加えてサポー トされます。このオプションを使用すれば、それらは拒絶されます。こ のオプションを使う理由はありませんが、こだわりのある人々を満足さ せるためにのみ存在しています。 ‘-pedantic’ は、始まりと終りとが ‘__’ である代替キーワードの使用 については、警告しません。同様に __extension__ に続く表現につ い ても警告しません。しかし、システムヘッダファイルのみがこの抜け道 を使用すべきであり、アプリケーションプログラムはこれを避けるべき です。 -pedantic-errors ‘-pedantic’ と似ていますが、警告のかわりにエラーを出します。 -W 以下のイベントに対して、特別な警告メッセージを表示します。 · volatile でない自動変数が longjmp の呼び出しによって変更され得る 場合です。これらの警告は、最適化コンパイルの時のみ問題になり得ま す。 コンパイラは setjmp の呼び出しのみを見ています。コンパイラは、ど こで longjmp が呼び出されるかを知ることはできません。実際には 、 シ グナルハンドラはコード中の任意の場所で longjmp を呼び出すこと ができます。従って、実際には longjmp への呼び出しが危険な部分 か らはおこなわれていないために問題のないプログラムであっても、警告 が発せられることになります。 · 関数が、値を伴ってリターンする場合と、値を伴わずにリターンする場 合の両方が起こりうる場合です。 (関数の最後を抜けていくことは、値 を伴わずに関数をリターンするとみなされます。) 例えば、次の関数が この種類の警告を引き起こします。 foo (a) { if (a > 0) return a; } ある関数 (abort やlongjmp を含む) が決してリターンしないというこ とを GNU CC が理解できないために、にせの警告が発生するかもしれま せん。 · 式文 (expression-statement) またはコンマ式の左部分が一切の副作用 を含まない場合です。警告を抑制するには、使用しない式を void にキ ャ ス ト し て下さい。例えば ‘x[i,j]’ といった式は警告されますが 、‘x[(void)i,j]’ は警告されません。 · 符号無しの値が 0 と ‘>’ または ‘<=’ で比較される場合です。 -Wimplicit-int 型を指定していない宣言に対して警告します。 -Wimplicit-function-declaration 宣言に先立って用いられた関数に対して警告します。 -Wimplicit -Wimplicit-int および -Wimplicit-function-declaration と同じです 。 -Wmain main 関数が不審な型で宣言あるいは定義されている場合に警告します 。通常、main は外部リンケージを持ち、 int を返し、0 個また は 2 個の引数をとる関数です。 -Wreturn-type 関 数の戻り値の型が、デフォルトである int に定義された時に常に警 告します。また、戻り値の型が voidでない関数内に、戻り値 の な い return 文がある場合にも常に警告します。 -Wunused ローカル変数が宣言されたにも関わらず使用されていない場合、静的に 宣言された関数の実体が定義されていない場合、計算結果が明らかに利 用されていない場合に常に警告します。 -Wswitch switch 文がインデックスとして列挙型をとっている時、その列挙型中 のいくつかの値に対する case が欠けている場合に常に警 告 し ま す 。(default ラベルが存在する場合、この警告は出ません。) このオプ ションを使用した場合には、列挙型の範囲を越えた case ラベルも、常 に警告されます。 -Wcomment コメントの開始文字列 ‘/∗’ がコメント中に現れた時に常に警告します 。 -Wtrigraphs トライグラフの出現を常に警告します (トライグラフが使用可能である と仮定します)。 -Wformat printf, scanf などへの呼び出しに対して、与えられた引数が、フォー マット文字列の指定を満足する型を持っているかを検査します。 -Wchar-subscripts 配列の添字の型が char であった場合に警告します。これはよくある間 違いのもとです。いくつかのマシンにおいてはこの型が符号付きである ことを、プログラマはしばしば忘れてしまいます。 -Wuninitialized 初期化されていない自動変数が使用されています。 これらの警告は、最適化コンパイルを行なう時のみ発生します。なぜな ら、コンパイラは最適化を行なう時にのみデータフロー情報を必要とす るからです。もし ‘-O’ を指定しなかった場合は、この警告を得ること はできません。 これらの警告は、レジスタ割り当ての対象となった変数についてのみ発 生します。従って、volatile であると宣言された変数や、アドレス 上 に割り当てられた変数、サイズが 1, 2, 4, 8 バイト以外の変数に関し てはこれらの警告は発生しません。さらに、構造体、共用体、配列につ いては、たとえそれらがレジスタに割り当てられたとしても、これらの 警告は発生しません。 ある変数によって計算された値が結局使用されないような変数について は、一切の警告が生じないことに注意して下さい。このような計算は、 警告が表示される前にデータフロー解析によって削除されます。 これらの警告をオプションにした理由の一つは、GNU CC がまだあま り 賢くなくて、あるコードが一見間違いを含むかのように見えてもそれは 実は正しいものかもしれない、ということを GNU CC が理解できない、 というものです。ここにその 1 つの例を挙げます。 { int x; switch (y) { case 1: x = 1; break; case 2: x = 4; break; case 3: x = 5; } foo (x); } も し y の値が常に 1, 2 あるいは 3 である限りは x は常に初期化さ れます。しかし GNU CC はこれを知ることはできません。もう 1 つ の 一般的な例を挙げます。 { int save_y; if (change_y) save_y = y, y = new_y; ... if (change_y) y = save_y; } これはバグを含みません。なぜなら save_y は、その値が設定された時 のみ使用されるからです。 いくつかのにせの警告は、使用している決してリターンしない関数全て に対して volatile と宣言することによって防ぐことが可能です。 -Wparentheses ある特定の文脈中で括弧が省略されていた場合に警告します。 -Wtemplate-debugging C++ プログラムにおいてテンプレートを使用している際に、デバッグが 完全に可能でない場合を警告します (C++ のみ)。 -Wall 全ての上に挙げた ‘-W’ オプションを結合したものです。これらのオプ ションは全て、たとえマクロとの組み合わせであっても、避けたほうが いいと我々が推奨する用法や、簡単に避けることができると我々が信じ ている用法に関するものです。 残 りの ‘-W...’ オプションは ‘-Wall’ によっては暗黙のうちに指定されませ ん。なぜならこれらは、クリーンなプログラムにおいても、ある状況におい て は 使用することが妥当であると我々が考える構造についての警告を行なうオプ ションだからです。 -Wtraditional 伝統的な C と ANSI C において異なった振舞いをする特定の構造に つ いて警告します。 · マクロ引数がマクロ本体内の文字列定数に現れるものです。これは、伝 統的な C においてはその引数で置換しましたが、ANSI C においては定 数の一部として扱われます。 · ブロック内で外部宣言であると宣言され、かつそのブロックの終端の後 で使用されている関数です。 · オペランドとして long 型をとる switch 文です。 -Wshadow ローカル変数が他のローカル変数を隠している時に常に警告します。 -Wid-clash-len 2 つの全く別の識別子の最初の len 文字が一致した時に警告します 。 これはある種の旧式なおばかさんコンパイラでコンパイルされ得るプロ グラムを作る場合に役に立ちます。 -Wpointer-arith 関数型や void の “サイズ” に依存するものを全て警告します。GNU C は これらに対して、サイズ 1 を割り当てています。これは void ∗ ポ インタと関数へのポインタにおける計算を簡便にするためです。 -Wcast-qual ポインタが、型修飾子が削除されるようにキャストされる全ての場合に 警告します。例えば const char ∗ を普通の char ∗ にキャストした場 合に警告がなされます。 -Wcast-align ポインタのキャストにおいて、そのターゲットに要求される境界条件が 大きくなるようなキャストを全て警告します。例えば char ∗ が int ∗ へとキャストされると、整数が 2、あるいは 4 バイト境界でしかア ク セスできないマシンにおいては警告が発せられます。 -Wwrite-strings 文字定数に対して、型 const char[length] を与え、非-const の char ∗ ポインタへのアドレスのコピーに対して警告するようにします。この 警 告は、宣言とプロトタイプにおいて const の使用を非常に注意深く おこなっていさえすれば、文字列定数に書き込みをしそうなコードをコ ンパイル時に発見することを助けますが、そうでない場合は有害無益な 指定です。これが、我々がこの警告を ‘-Wall’ のリクエストに含め な かった理由です。 -Wconversion 同じ引数が与えられた時に、プロトタイプが存在する場合とプロトタイ プが存在しない場合とで、異なった型変換を引き起こす場合について警 告します。これは固定小数点から浮動小数点への変換やその逆、デフォ ルトの動作と異なる固定小数点引数の幅や符号の有無の変換が含まれま す。 -Waggregate-return 構造体や共用体を返す関数を定義した場合や、それらを呼び出す全ての 場合に警告します。 (配列を返すことができる言語においても、これは 警告を引き起こします。) -Wstrict-prototypes 引数の型を指定せずに関数を宣言、あるいは定義した場合に警告します 。 (以前に引数の型を指定した宣言が存在する場合には、旧式の関数宣 言に対しては警告をしません。) -Wmissing-declarations グローバルな関数を、その前にプロトタイプ宣言をせずに定義した場合 に警告します。この警告は、たとえその定義自身がプロトタイプを含ん でいたとしても発生します。この警告の目的は、ヘッダファイル中にグ ローバル関数の定義を忘れることを防ぐことにあります。 -Wredundant-decls 同一スコープ中で複数回、同一対象を宣言した場合に、たとえそれが正 当で何も変化させない場合であっても警告します。 -Wnested-externs 関数内で extern 宣言を行なった場合に警告します。 -Wenum-clash 異なる列挙型の間で変換を行なった際に警告します (C++ のみ)。 -Wlong-long long long 型が使用されている場合に警告します。これはデフォルトで す。この警告メッセージを抑止するには ‘-Wno-long-long’ フラグを用 い て下さい。フラグ ‘-Wlong-long’ および ‘-Wno-long-long’ は、フ ラグ ‘-pedantic’ 使用時のみ考慮されます。 -Woverloaded-virtual (C++ のみ。) 導出クラスにおいて、仮想関数の定義は基底クラスで 定 義された仮想関数の型の記述と一致していなければなりません。このオ プションを使用することによって、基底クラスにおける仮想関数と同一 の名前を持ち、基底クラスのいかなる仮想関数とも異なった型の記述を 持つ関数に対して警告が行われます。これによって、導出クラスが仮想 関数を定義しようとして失敗する場合を警告することができます。 -Winline 関数がインライン宣言されている、あるいは -finline-functions オプ ションが与えられている場合に、関数をインライン展開できなかった場 合に警告します。 -Werror 警告をエラーとして扱います。警告の後にコンパイルを中断します。 デバッグオプション GNU CC は、ユーザのプログラムや GCC の双方をデバッグするために、多くの オプションを備えています。 -g オペレーティングシステムのネイティブのフォーマット (stabs, COFF, XCOFF, DWARF) でデバッグ情報を生成します。GDB はこのデバッグ情報 に基づいて動作することができます。 stabs フォーマットを使用するほとんどのシステムにおいて は 、‘-g’ を指定すると、GDB だけが使用できる余分なデバッグ情報が使用可能に なります。この特別の情報は GDB に対してはよりよいデバッグを行 な うことを可能としますが、おそらく他のデバッガに対してはクラッシュ 、あるいはそのプログラムを読めなくしてしまいます。この特別な情報 の 生 成 を 制 御するためには ‘-gstabs+’, ‘-gstabs’, ‘-gxcoff+’, ‘-gxcoff’, ‘-gdwarf+’, ‘-gdwarf’ を使用してください (下記参照)。 他の多くの C コンパイラと異なり、GNU CC は ‘-g’ を ‘-O’ とともに 使用することを許しています。最適化されたコードが通る近道は、時に は驚くべき結果を生み出すかもしれません。定義したはずの変数が存在 しなかったり、制御の流れが予想もしなかった場所に移動したり、結果 が定数とわかる計算や、結果がすでに手元にある文は実行されなくなり 、ある文がループの外に追い出されて別の場所で実行されたりします。 それにも関わらず、このオプションは最適化された出力のデバッグを可 能としています。これによって、バグを含むかもしれないプログラムに 対してオプティマイザを使用することができるようになります。 以 下のオプションは、GNU CC を 1 つ以上のデバッグフォーマットを扱えるよ うに作成してある場合に有益です。 -ggdb (もしサポートされていれば)ネイティブのフォーマットでデバッグ情報 を生成します。これは可能な限りの全ての GDB 拡張を含みます。 -gstabs ( もしサポートされていれば) stabs フォーマットでデバッグ情報を生 成します。ただし GDB 拡張は含みません。このフォーマットはほと ん どの BSD システム上の DBX で利用できるフォーマットです。 -gstabs+ ( もしサポートされていれば) stabs フォーマットでデバッグ情報を生 成します。ただし GNU デバッガ (GDB) でしか理解できない GNU 拡 張 を使用します。この拡張を使用すると、他のデバッガでは、クラッシュ やプログラムが読めなくなるなどの影響がおそらく出ます。 -gcoff (サポートされていれば) COFF フォーマットでデバッグ情報を生成しま す。これは、System V Release 4 より前の ほとんどの System V 上の SDB で利用できるフォーマットです。 -gxcoff (サポートされていれば) XCOFF フォーマットでデバッグ情報を生成 し ます。これは IBM RS/6000 システムにおいて DBX デバッガによって使 用されるフォーマットです。 -gxcoff+ (もしサポートされていれば) XCOFF フォーマットでデバッグ情報の 生 成 を行います。ただし、GNU デバッガ (GDB) によってのみ理解され得 る GNU 拡張を使用します。これらの拡張を使用すると、他のデバッ ガ に対してはクラッシュやプログラムを読みとり不能にするなどの影響を 及ぼし得ます。 -gdwarf (もしサポートされていれば) DWARF フォーマットでデバッグ情報の 生 成を行います。これはほとんどの System V Release 4 システムにおい て SDB によって使用される形式です。 -gdwarf+ (もしサポートされていれば) DAWRF フォーマットでデバッグ情報の 生 成 を行います。ただし、GNU デバッガ (GDB) によってのみ理解され得 る GNU 拡張を使用します。これらの拡張を使用すると、他のデバッ ガ に対してはクラッシュやプログラムを読みとり不能にするなどの影響を 及ぼし得ます。 -glevel -ggdblevel -gstabslevel -gcofflevel -gxcofflevel -gdwarflevel デバッグ情報を要求しますが、同時に level によってどの程度の情 報 が必要かを指定します。デフォルトのレベルは 2 です。 レ ベル 1 は、デバッグを予定しないプログラムの部分に対してバック トレースを生成するに十分な最低限の情報を生成します。これは関数と 外部変数の記述を含みますが、ローカル変数や行番号に関する情報は含 みません。 レベル 3 はプログラムに含まれる全てのマクロ定義などの特別な情 報 を 含みます。いくつかのデバッガは ‘-g3’ の使用によってマクロの展 開をサポートします。 -p プログラム prof によって使用されるプロファイル情報を書き込む特別 なコードを生成します。 -pg プログラム gprof によって使用されるプロファイル情報を書き込む特 別なコードを生成します。 -a 基本ブロックのプロファイル情報を書き込む特別なコードを生成します 。これはそれぞれのブロックが何回実行されたかを記録します。このデ ータは tcov のようなプログラムによって解析されます。ただし、この データフォーマットは tcov が期待するものとは異なっています。最終 的には、GNU gprof が処理できるように拡張されるべきです。 -ax ファイル ‘bb.in’ から基本ブロックプロファイルパラメータを読み 出 し、ファイル ‘bb.out’ にプロファイル結果を書き出すための、特別な コードを生成します。 ‘bb.in’ は関数のリストを保持しています。 こ のリストに含まれる関数に入ると、プロファイリングがオンになります 。最外側関数を抜けると、プロファイリングはオフになります。関数名 が ‘-’ で始まっている場合、その関数はプロファイル対象外になりま す。もし関数名が唯一に定まらない場合は、 ‘/path/filename.d:func- tionname’ と記述することでこれらを区別できます。 ‘bb.out’ には、 いくつかの利用可能な関数がリストされます。特別な意味をもつ関数が 4 つあります: ‘__bb_jumps__’ はジャンプ頻度を ‘bb.out’ に書き出 します。 ‘__bb_trace__’ は基本ブロック列を ‘gzip’ にパイプし、フ ァ イ ル ‘bbtrace.gz’ に書き出します。 ‘__bb_hidecall__’ は call 命令をトレースから除外します。 ‘__bb_showret__’ は return 命令を トレースに含めるようにします。 -dletters コ ンパイル中の letters で指定されるタイミングに、デバッグ用のダ ンプを生成するように指示します。これはコンパイラをデバッグするた めに使用されます。ほとんどのダンプのファイル名はソースファイル名 に 1 単語をつなげたものになります。( 例 え ば 、‘foo.c.rtl’ や ‘foo.c.jump’ などです)。 -dM 全てのマクロ定義をダンプし、プリプロセス終了時に出力に書き出しま す。その他には何も書き出しません。 -dN 全てのマクロ名をダンプし、プリプロセス終了時に出力に書き出します 。 -dD 全てのマクロ定義をプリプロセス終了時に通常の出力に加えてダンプし ます。 -dy パース中にデバッグ情報を標準エラー出力にダンプします。 -dr RTL 生成後に ‘file.rtl’ に対してダンプします。 -dx 関数をコンパイルするかわりに、RTL を生成するのみの処理を行います 。通常は ‘r’ とともに使用されます。 -dj 最初のジャンプ最適化の後に、‘file.jump’ に対してダンプします。 -ds 共通部分式削除 (しばしば共通部分式削除に続くジャンプ最適化も含み ます) の終了時に ‘file.cse’ に対してダンプします。 -dL ループ最適化終了時に ‘file.loop’ に対してダンプします。 -dt 第 2 共通部分式削除段階 (しばしば共通部分式削除に続くジャンプ 最 適化も含みます) の終了時に、‘file.cse2’ に対してダンプします。 -df フロー解析終了後に、‘file.flow’ に対してダンプします。 -dc 命令コンビネーション終了時に ‘file.combine’ に対してダンプします 。 -dS 第 1 命令スケジューリング段階終了時に ‘file.sched’ に対してダ ン プします。 -dl ローカルレジスタ割り当て終了時に ‘file.lreg’ に対してダンプしま す。 -dg グローバルレジスタ割り当て終了時に ‘file.greg’ に対してダンプ し ます。 -dR 第 2 命令スケジューリング段階終了時に ‘file.sched2’ に対してダン プします。 -dJ 最終ジャンプ最適化終了時に ‘file.jump2’ に対してダンプします。 -dd 遅延分岐スケジューリング終了時に ‘file.dbr’ に対してダンプします 。 -dk レジスタからスタックへの転換終了時に ‘file.stack’ に対してダンプ します。 -da 以上の全てのダンプを生成します。 -dm 処理の終了時に、メモリ使用に関する統計情報を標準エラー出力に出力 します。 -dp どのようなパターンや選択肢が使用されたかを示すコメントをアセンブ ラ出力中のコメントで解説します。 -fpretend-float クロスコンパイラで処理を行なう際に、ホストマシンと同じ浮動小数点 フォーマットをターゲットマシンが持つかのように振舞わせます。これ は浮動小数点定数の誤った出力を引き起こしますが、実際の命令列はお そらく GNU CC をターゲットマシンで起動した場合と同じものとなるで しょう。 -save-temps 通常の “一時” 中間ファイルを消去せずに保存します。これらはカレン トディレクトリに置かれ、ソースファイルに基づいた名前が付けられま す。従って、‘foo.c’ を ‘-c -save-temps’ を使用してコンパイルした 場合は、 ‘foo.cpp’, ‘foo.s’ が、‘foo.o’ と同様に生成されます。 -print-libgcc-file-name=library ライブラリファイル ‘library ’ の完全な絶対名を表示します。このフ ァイルはリンクの際のみに使用され、それ以外の働きはありません。こ の オプションが指定された場合は、GNU CC はコンパイルやリンクを何 も行なわず、ただファイル名を表示するのみです。 -print-libgcc-file-name ‘-print-file-name=libgcc.a’ と同じです。 -print-prog-name=program ‘-print-file-name’ と似ていますが、‘cpp’ のような program を検索 します。 最適化オプション これらのオプションは様々な種類の最適化処理を制御します。 -O -O1 最適化を行います。最適化コンパイルは幾分長めの処理時間と、大きな 関数に対する非常に多くのメモリを必要とします。 ‘-O’ が指定されなかった場合は、コンパイラの目標はコンパイルの コ ストを低減することや、目的の結果を得るためのデバッグを可能とする ことに置かれます。それぞれの文は独立しています。つまり、ブレーク ポイントでプログラムを停止させることによって、任意の変数に新しい 値を代入したり、プログラムカウンタを他の文へと変更することを可能 とし、そのソースコードにプログラマが望む正しい結果を得ることを可 能にします。 ‘-O’ を指定しなかった場合は、register と宣言した変数のみがレジス タ へ と割り当てられます。コンパイルの結果として得られるコードは 、PCC を ‘-O’ なしで使用した場合と比較して若干良くないものとなり ます。 ‘-O’ が指定されると、コンパイラはコードのサイズと実行時間を減少 させることを試みます。 ‘-O’ を指定することによって、 ‘-fthread-jumps’ と ‘-fdefer-pop’ の フ ラ グ が 指定されます。遅延スロットをもつマシンでは ‘-fde- layed-branch’ が指定されます。フレームポインタを使わないデバッグ を サポートしているマシンでは、‘-fomit-frame-pointer’ も指定され ます。マシンによってはさらにその他のフラグが指定されることもあり ます。 -O2 さらに最適化を行います。サポートされている最適化手段のうち、空間 と速度のトレードオフを含まないものはほとんどの全て使用されます。 例えばループのアンローリングや関数のインライン化は行われません。 -O と比較して、このオプションはコンパイル時間と生成コードの性 能 の双方を増加させます。 -O3 さらなる最適化を行います。これは -O2 が行う全ての最適化手段に加 えて -finline-functions も有効にします。 -Os サイズ優先で最適化します。普通、コードを増大させることのない全て の -O2 最適化が有効になります。更に、コードサイズを減らすように 設計された最適化も行います。 -O0 最適化を行いません。 複数の -O オプションを指定した場合は、レベル番号の有無に関わらず 、最後に指定したものが有効になります。 ‘-fflag’ の形式を持ったオプションは、マシン独立のフラグです。ほとんどの フラグは有効形式と無効形式の双方を持っています。‘-ffoo’ の無効 形 式 は ‘-fno-foo’ です。以下のリストでは、デフォルトではない方の形式のみを示し ます。これに対して ‘no-’ を削除する、あるいは追加することによって双方の 形式を生成することが可能です。 -ffloat-store 浮 動 小数点変数をレジスタに格納しません。このオプションは 68000 のように (68881 の) 浮動小数点レジスタが double よりも高い精度を 持っていると思われるマシンにおいて、望まない超過精度を抑制するこ とを可能にします。 ほとんどのプログラムにおいては、超過精度は単に良い結果を生むだけ ですが、いくつかのプログラムは正確な IEEE の浮動小数点フォーマッ ト定義に依存しています。この よ う な プ ロ グ ラ ム に 対 し て ‘-ffloat-store’ を使用します。 -fmemoize-lookups -fsave-memoized コンパイルを高速に行なうために、ヒューリスティックスを使用します (C++ のみ)。これらのヒューリスティックスはデフォルトでは有効にな っていません。なぜなら、これはある種の入力ファイルにしか効果がな く、その他のファイルではかえってコンパイルが低速になるからです。 最初に、コンパイラはメンバ関数への呼び出し (あるいはデータメンバ への参照) を構築します。これは (1) どのクラスでその名前のメン バ 関数が実装されているかを決定し、(2) どのメンバ関数への呼び出しで あるかという問題 (これはどの種類の型変換が必要となるかという決定 も含みます) を解決し、(3) 呼び出し側に対するその関数の可視性を検 査するという作業を行なう必要があります。これらは全て、コンパイル を より低速にしてしまいます。通常は、そのメンバ関数への 2 度目の 呼び出しが起こった場合も、この長い処理がまた行なわれることになり ます。これは次のようなコード cout << "This " << p << " has " << n << " legs.\n"; は、これらの 3 つの手順を 6 回繰り返すということを意味します。こ れに対して、ソフトウェアキャッシュを使用すると、そのキャッシュへ の“ ヒット ”は、コストを劇的に低減することが期待できます。不幸な ことに、キャッシュの導入によって異なったレイヤの機構を実装するこ と が 必 要 と な り 、 それ自身のオーバヘッドが生じてしまいます 。‘-fmemoize-lookups’ はこのソフトウェアキャッシュを有効にします 。 メンバとメンバ関数へのアクセス特権 (可視性) はある関数におけるコ ンテキストと別の関数におけるものとでは異なるので、 g++ はキャ ッ シュをフラッシュしなければなりません。‘-fmemoize-lookups’ フラグ を使用すると、全ての関数をコンパイルするたびに毎回キャッシュをフ ラッシュします。‘-fsave-memoized’ フラグは同一のソフトウェアキャ ッシュについて、コンパイラが前回コンパイルした関数のコンテキスト が、次にコンパイルするコンテキストと同一のアクセス特権を有してい るとみなせる時には、キャッシュを保持します。これは同一クラス中に 多くのメンバ関数を定義している時に特に有効です。他のクラスのフレ ンドになっているメンバ関数を除き、同一のクラスに属している全ての メンバ関数のアクセス特権は、全て同一です。このような場合はキャッ シュをフラッシュする必要はありません。 -fno-default-inline クラススコープ中に定義されたメンバ関数をデフォルトでインライン関 数とする処理を行ないません (C++ のみ)。 -fno-defer-pop それぞれの関数呼び出しに対して、関数のリターン直後に常に引数をポ ップします。関数呼出後に引数をポップしなければならないマシンにお いては、コンパイラは通常、いくつかの関数の引数をスタックに積んで 、それらを同時にポップします。 -fforce-mem メモリオペランドに対して、それらに対する演算が行なわれる前に、レ ジスタにコピーします。これは全てのメモリ参照を、潜在的な共通部分 式であると定めることによって、より良いコードを生成します。もしそ れが共通部分式でなかった場合は、命令コンビネーションによってレジ スタへの読み込みは削除されます。私はこれがどのような違いを生み出 すかということに興味があります。 -fforce-addr メモリアドレス定数について、それらに対する演算が行なわれる前にレ ジスタにコピーします。これは ‘-fforce-mem’ と同じ手法でより良 い コードを生成します。私はこれがどのような違いを生み出すかというこ とに興味があります。 -fomit-frame-pointer フレームポインタをレジスタに格納する必要のない関数において、この 処理を行いません。これはフレームポインタの保存、設定、復帰にかか る命令を省略し、さらに、多くの関数でレジスタ変数として使用できる 余分なレジスタを得ることを可能にします。ただし、このオプションは ほとんどのマシンにおいてデバッグを不可能にします。 Vax などのいくつかのマシンでは、このフラグは効果を持ちません。な ぜならこれらのマシンでは標準の呼び出し手順が自動的にフレームポイ ンタの設定を行なってしまい、これが存在しないとしたところで何も節 約ができないからです。マシン記述マクロ FRAME_POINTER_REQUIRED が 、ターゲットマシンがこのフラグをサポートするかどうかを制御してい ます。 -finline-functions 全ての単純な関数を呼び出し側に組み込んでしまいます。コンパイラは ヒューリスティックスを用いて、どの関数がこの方法で組み込むに足り るほど単純かを決定します。 もし、ある関数に対する全ての呼び出しを組み込むことができ、かつそ の関数が static と宣言されていた場合は、GCC はその関数を独立した アセンブラコードとしては出力をしません。 -fcaller-saves 関数呼び出しにおいて破壊されるであろう値を、レジスタに保持するこ とを可能とします。これはこのような呼び出しの周囲にレジスタに対す る保存、復帰の特別なコードを出力することによって実現されます。こ のような割り当ては、それが通常よりも良いコードを出力するとみなさ れる場合にのみ行われます。 このオプションは特定のマシンではデフォルトで有効となっています。 これらは通常、このオプションの処理の代わりに使うことができる呼び 出し時保存レジスタが存在しないマシンです。 -fkeep-inline-functions ある関数への呼び出しが全て呼び出し側に組み込むことができて、かつ その関数が static と宣言されていたとしても、実行時に呼び出し可能 な関数も生成します。 -fno-function-cse 関数のアドレスをレジスタに置きません。つまり、定まった関数を呼び 出すコードは、それぞれ明示的な関数のアドレスを含むコードとなりま す。 このオプションは効率の低いコードを生成しますが、アセンブラ出力を 書き換えるようなハックを行なう場合には、このオプションを使用しな ければ混乱させられることでしょう。 -fno-peephole マシン固有のピープホール最適化を禁止します。 -ffast-math このオプションは生成コードのスピードのために、GCC に対して、いく つかの ANSI または IEEE の規則/規格を侵させます。例えば、この オ プションは sqrt 関数の引数は非負の数であることを仮定します。 このオプションはどの ‘-O’ オプションによっても有効とされません。 なぜなら、このオプションは数学関数に関する IEEE または ANSI の規 則/ 規格の厳密な実装に依存して書かれたプログラムに対して誤った出 力を与えるからです。 以下のオプションは特殊な最適化に関する制御を行います。‘-O2’ オプショ ン は‘-funroll-loops’ と ‘-funroll-all-loops’ を除くこれらの全てのオプショ ンを有効にします。 ‘-O’ オプションは通常 ‘-fthread-jumps’ と ‘-fdelayed-branch’ を有効とし ま す。ただし、特殊なマシンではデフォルトの最適化に対して変更が加えられ ているかもしれません。 最適化に関する “きめ細かいチューニング” が必要な場合に、以下のフラグ を 使用することが可能です。 -fstrength-reduce ループのストレングスリダクションと繰り返し変数の除去を行います。 -fthread-jumps 分岐ジャンプによってある場所にジャンプした時に、最初の分岐に包括 される比較が存在した時に、最初の分岐のジャンプ先を後者の分岐先に 変更します。この変更先は、2 番目の分岐条件の真偽によって、2 番目 の分岐のジャンプ先か、あるいは2 番目の分岐の直後に定められます。 -funroll-loops ループ展開の最適化を行います。これはループの繰り返し数がコンパイ ル時、あるいはランタイムに決定できる時においてのみ、実行されます 。 -funroll-all-loops ループ展開の最適化を行います。これは全てのループに対して行われま す。このオプションは大抵、より遅く動作するプログラムを生成します 。 -fcse-follow-jumps 共通部分式削除の処理において、ジャンプ命令の行先が他の経路から到 達できない場合は、そのジャンプ命令を越えてスキャンを行ないます。 例えば、共通部分式削除処理中に else 節を伴った if 文に出会った 場合、条件が偽ならば分岐先に対しても共通部分式削除を続けます。 -fcse-skip-blocks これは ‘-fcse-follow-jumps’ に似ていますが、ブロックを跨ぐジャン プに対しても共通部分式削除を継続します。共通部分式削除処理 中 に 、else 節 を 持 た な い 単 純 な if 文 に で あ っ た 時、 ‘-fcse-skip-blocks’ は if のボディを跨いだジャンプに対する共通部 分式削除処理を継続します。 -frerun-cse-after-loop ループ最適化が行なわれた後に、再度共通部分式削除の処理を行います 。 -felide-constructors コンストラクタへの呼び出しが省略できるように思われる場合に、その 呼び出しを省略します (C++ のみ)。このフラグを指定した場合は、GNU C++ は以下のコードに対して、一時オブジェクトを経由せずに y を foo への呼び出しの結果から直接初期化します。 A foo (); A y = foo (); こ のオプションを使用しない場合は、GNU C++ は最初に y をA 型の適 切なコンストラクタを呼び出すことによって初期化します。そし て 、 foo の結果を一時オブジェクトに格納し、最終的には ‘y’ の値を一時 オブジェクトの値に入れ換えます。 デフォルトの振舞い (‘-fno-elide-constructors’) が、ANSI C++ 標準 のドラフトには規定されています。コンストラクタが副作用を含むプロ グラムに対して、‘-felide-constructors’ を指定すると、そのプロ グ ラムは異なった動作をする可能性があります。なぜなら、いくつかのコ ンストラクタの呼び出しが省略されるからです。 -fexpensive-optimizations 比較的コストの高いいくつかの些細な最適化を行います。 -fdelayed-branch ターゲットマシンにおいてこのフラグがサポートされている場合は、遅 延分岐命令後の命令スロットを命令の順番変更によって利用するように 設定します。 -fschedule-insns ターゲットマシンにおいてこのフラグがサポートされている場合は、必 要なデータを利用可能になるまで待つことによる実行の遅滞を防ぐため に、命令の順番の変更を行います。これは遅い浮動小数点命令やメモリ 読み込み命令の実行において、それらの結果を必要とする命令の前に他 の命令を詰め込みます。 -fschedule-insns2 ‘-fschedule-insns’ と似ていますが、レジスタ割当て処理の後にも う 一度命令スケジューリングの段階を置きます。これは、比較的レジスタ 数が少なく、メモリロード命令が 1 サイクルよりも多くを要するマ シ ンにおいて、特に効果的です。 ターゲットオプション デフォルトでは、GNU CC コンパイラは、現在使用しているマシンと同じタイプ のコードをコンパイルします。しかし、GNU CC はクロスコンパイラとしてもイ ン ストールすることが可能です。実際には、異なったターゲットマシンのため の様々なコンフィギュレーションの GNU CC は、同時にいくつもインストー ル す る こ とが可能です。そこで、どの GNU CC を使用するかを指定するために 、‘-b’ オプションを使用することができます。 これに加えて、古い、あるいはより新しいバージョンの GNU CC も同時にい く つもインストールしていくことができます。これらのうち 1 つ (おそらくもっ とも新しいもの) がデフォルトとなります。しかし、ひょっとしたら別のも の を使いたくなるかもしれません。 -b machine 引 数 machine は、コンパイルのターゲットマシンを規定します。これ は GNU CC をクロスコンパイラとしてインストールした時に有用です。 machine に指定する値は、GNU CC をクロスコンパイラとしてコンフィ ギュレーションした時に与えたマシンタイプと同じ で す 。 例 え ば 、80386 上の System V で実行されるプログラムのために ‘configure i386v’ というコンフィギュレーションを行なったクロスコンパイラ を 起動したい場合は、‘-b i386v’ と指定します。 ‘-b’ の設定を省略した場合は、通常は使用しているマシンと同タイプ のマシンのためのコンパイルが行われます。 -V version 引数 version は、起動される GNU CC のバージョンを規定します。 こ れは複数のバージョンがインストールされている場合に有用です。例え ば、 version が ‘2.0’ ならば、GNU CC バージョン 2.0 を起動するこ とを意味します。 ‘-V’ を指定しなかった場合のデフォルトのバージョンは、GNU CC をイ ンストールする時に調整可能です。通常は、もっとも一般的な使用に勧 めることができるバージョンがここに指定されます。 マシン依存オプション そ れぞれのターゲットマシンタイプは、それぞれの特別なオプションを持つこ とが可能です。‘-m’ で始まるオプション群は、様々なハードウェアモデルやコ ン フィギュレーション—例えば 68010 と 68020、浮動小数点コプロセッサの有 無— などを選択できます。このオプションを指定することによって、コンパ イ ラはどれか 1 つのモデル、あるいはコンフィギュレーションに対するコンパイ ルが可能です。 いくつかのコンフィギュレーションは、通常はそのプラットフォーム上の他 の コ ンパイラとのコマンドラインに関するの互換性をとるための特別なオプショ ンを用意しています。 以下は 68000 シリーズのために定義された ‘-m’ オプションです。 -m68000 -mc68000 68000 のためのコードを生成します。これは 68000 ベースのシステ ム に対してコンフィギュレーションを行なったコンパイラのデフォルトで す。 -m68020 -mc68020 (68000 ではなく) 68020 のためのコードを生成します。これは 68020 ベースのシステムに対してコンフィギュレーションを行なったコンパイ ラのデフォルトです。 -m68881 浮動小数点演算のために 68881 命令を含んだ出力を行います。これ は ほ とんどの 68020 ベースのシステムにおいて、コンパイラのコンフィ ギュレーション時に -nfp を指定されなかった場合のデフォルトです。 -m68030 68030 のためのコードを生成します。これは 68030 ベースのシステム に対してコンフィギュレーションを行なったコンパイラのデフォルトで す。 -m68040 68040 のためのコードを生成します。これは 68040 ベースのシステム に対してコンフィギュレーションを行なったコンパイラのデフォルトで す。 -m68020-40 68040 のためのコードを生成しますが、新しい命令を使用しません。こ の結果として得られるコードは、68020/68881, 68030, 68040 のいずれ のシステムにおいても、比較的高い性能を持ちます。 -mfpa 浮動小数点演算のために Sun FPA 命令を含んだ出力を行います。 -msoft-float 浮動小数点演算のためにライブラリを呼び出す出力を行います。 警告: この必須のライブラリは GNU CC の一部としては含まれません。通常は そ のマシンの一般的な C コンパイラの提供するものを使用しますが、 これは通常の方法ではクロスコンパイルで直接使用することはできませ ん。クロスコンパイルを行ないたい場合は、自分自身で必要なライブラ リ関数を用意する必要があります。 -mshort int 型を short int 型のように 16 ビット幅とみなします。 -mnobitfield ビットフィールド命令を使用しません。‘-m68000’ は暗黙 の う ち に ‘-mnobitfield’ を含みます。 -mbitfield ビ ッ ト フ ィ ー ルド命令を使用します。‘-m68020’ は暗黙のうちに ‘-mbitfield’ を含みます。これは変更されていないソースの場合の デ フォルトです。 -mrtd 固定個数の引数をとる関数に対して、異なった関数呼び出し規約を使用 します。これは、リターン時に引数をポップする rtd 命令を利用す る も の です。これは呼び出し側で引数をポップさせる必要がないために 、1 命令を省略することが可能となります。 この呼び出し規約は通常の Unix で使用されている方式とは互換性があ り ません。そのため、Unix コンパイラでコンパイルされたライブラリ を呼び出す必要がある限りは、使用することはできません。 さらに、全ての可変引数をとり得る関数 ( printfを含みます) に対 し て、関数プロトタイプを用意する必要があります。さもないと、これら の関数に対して誤ったコードが生成されます。 さらに、関数に対して多過ぎる引数をつけて呼び出すコードを書いた場 合 、これは深刻な誤ったコードを生成します。(通常は多過ぎる変数は 害を及ぼすことなく無視されます。) rtd 命令は 68010 と 68020 によってサポートされますが、 68000 で は使用できません。 以下は Vax のために定義された ‘-m’ オプションです。 -munix 特定のいくつかのジャンプ命令 (aobleq 等) を出力しません。これら の命令で長いレンジを使用した場合、 Vax 用の Unix アセンブラは こ れを処理できません。 -mgnu これらのジャンプ命令を出力します。アセンブルには GNU アセンブラ の使用を仮定します。 -mg 浮動小数点数について、d-フォーマットではなく、g-フォーマットのた めのコードを出力します。 以下は SPARC でサポートされている ‘-m’ スイッチです。 -mfpu -mhard-float 浮動小数点命令を含む出力を行います。これはデフォルトです。 -mno-fpu -msoft-float 浮 動小数点の処理のためにライブラリを呼び出す出力を行います。 警 告: SPARC 用の GNU 浮動小数点ライブラリは存在しません。通常は そ の マシンの一般的な C コンパイラの提供するものを使用しますが、こ れは通常の方法ではクロスコンパイルで直接使用することはできません 。クロスコンパイルを行ないたい場合は、自分自身で必要なライブラリ 関数を用意する必要があります。 -msoft-float は呼び出し規約を変更します。したがって、 全てのプロ グラムをこのオプションでコンパイルしない限り、このオプションは意 味をなしません。 -mno-epilogue -mepilogue -mepilogue を指定することによって (デフォルト)、コンパイラは関数 を抜けるためのコードを常に関数の最後に出力します。関数の途中で関 数を抜けるコードは全て、関数の最後の終了コードへのジャンプとして 生成されます。 -mno-epilogue を設定することによって、コンパイラは関数から抜ける コードをインライン化することを試みます。 -mno-v8 -mv8 -msparclite これらの 3 つのオプションは SPARC アーキテクチャのバリエーション を選択するために使用されます。 デ フォルトでは、(Fujitsu SPARClite 用にコンフィギュレーションし ない限りは) GCC は SPARC アーキテクチャ v7 用のコードを生成し ま す。 -mv8 は、SPARC v8 用コードを生成します。v7 コードとの違いは、整 数の乗算と整数の除算が v7 では存在しないが v8 には存在するという 点のみです。 -msparclite は、SPARClite 用のコードを生成します。これは v7 には 存在せず SPARClite に存在する、整数乗算、整数除算 と ス キ ャ ン (ffs) 命令を追加します。 -mcypress -msupersparc こ れら 2 つのオプションはコード最適化対象のプロセッサを選択する ためのものです。 -mcypress を用いると(これがデフォルト)、コンパ イ ラ は Cypress CY7C602 チップ用にコードを最適化します。このチップは SparcSta- tion/SparcServer 3xx シリーズに用いられています。このオプショ ン は古い SparcStation 1, 2, IPX などにも適用できます。 -msupersparc を用いると、コンパイラは SuperSparc CPU 用にコード を最適化します。このチップは SparcStation 10, 1000, 2000 シリ ー ズ に用いられています。このオプションを用いると、SPARC v8 の全命 令セットを用いるようになります。 以下は Convex のために定義された ‘-m’ オプションです。 -mc1 C1 用の出力を行います。これはコンパイラが C1 用にコンフィギュ レ ーションを行なわれた時のデフォルトです。 -mc2 C2 用の出力を行います。これはコンパイラが C2 用にコンフィギュレ ーションを行なわれた時のデフォルトです。 -margcount 引数列の前に、引数の数をワードに置くコードを生成します。いくつか の 可搬性のない Convex や Vax のプログラムはこのワードを必要とし ます。(デバッガは不定長引数リストを持つ関数を除いて、このワー ド を必要としません。これらの情報はシンボルテーブルに書かれます。) -mnoargcount 引数の数を示すワードを省略します。これは変更されていないソースを 使用した場合のデフォルトです。 以下は、AMD Am29000 のために定義された ‘-m’ オプションです。 -mdw DW ビットが立っていることを仮定したコードを出力します。これは 、 ハードウェアによってバイト操作やハーフワード操作がサポートされて いるということを意味します。これはデフォルトです。 -mnodw DW ビットが立っていないことを仮定したコードを出力します。 -mbw システムがバイト操作やハーフワード書き込み操作をサポートしている ことを仮定したコードを生成します。これはデフォルトです。 -mnbw システムがバイト操作やハーフワード書き込み操作をサポートしていな いことを仮定したコードを生成します。これは暗黙のうちに ‘-mnodw’ を含みます。 -msmall スモールメモリモデルを使用します。これは全ての関数のアドレスが単 一の 256KB のセグメント内に入ることと、関数の絶対アドレスが 256K 以 下にあることを仮定します。このオプションは call 命令を const, consth, calli シーケンスの代わりに使用することを可能にします。 -mlarge call 命令が使用できることを仮定しません。これはデフォルトです。 -m29050 Am29050 用のコードを生成します。 -m29000 Am29000 用のコードを生成します。これはデフォルトです。 -mkernel-registers gr96-gr127 レジスタへの参照の代わりに gr64-gr95 を参照するコード を生成します。このオプションは、ユーザのコードから使用できるグロ ーバルレジスタから区別されたグローバルレジスタの集合を利用するカ ーネルのコードをコンパイルする時に使用できます。 ただし、このオプションが使用されている時にも ‘-f’ フラグ中のレジ スタ名は通常のユーザモードでの名前を使用します。 -muser-registers 通常のグローバルレジスタの集合 gr96-gr127 を使用します。これはデ フォルトです。 -mstack-check __msp_check への呼び出しをそれぞれのスタック調整の後に挿入します 。これはしばしばカーネルのコードにおいて用いられます。 以下は、Motorola 88K アーキテクチャのために定義された ‘-m’ オプションで す。 -m88000 m88100 と m88110 の双方で比較的高性能で動作するコードを生成しま す。 -m88100 m88100 に最適なコードを生成します。ただし m88110 においても動 作 します。 -m88110 m88110 に最適なコードを生成します。ただし m88100 においては動作 しないかも知れません -midentify-revision アセンブラ出力中に、ソースファイル名、コンパイラ名とバージョン、 タ イムスタンプ、使用されたコンパイルフラグを記した ident ディレ クティブを挿入します。 -mno-underscores シンボル名の最初にアンダースコアキャラクタをつけないアセンブラ出 力を生成します。デフォルトでは個々の名前に対して、アンダースコア をプレフィックスとして使用します。 -mno-check-zero-division -mcheck-zero-division 初期の 88K のモデルはゼロによる除算の処理に問題を持っていまし た 。特に、それらの多くにおいてトラップが生じなかったことは問題でし た。これらのオプションを使用することによって、ゼロ除算を発見し、 例 外を知らせるコードを埋め込むことを禁止 (あるいは明示的に許可) することができます。全ての 88K 用の GCC のコンフィギュレーション は ‘-mcheck-zero-division’ をデフォルトとして使用しています。 -mocs-debug-info -mno-ocs-debug-info 88Open Object Compatibility Standard “OCS” で定義された (それぞ れのスタックフレーム中で使用されるレジスタに関する) 付加的なデバ ッ グ情報を取り込みます (または省略します)。これらの付加的な情報 は GDB によっては必要とされません。DG/UX, SVr4, Delta 88 SVr3.2 で はデフォルトでこの情報を含めます。その他の 88K コンフィギュレ ーションではデフォルトで省略します。 -mocs-frame-position -mno-ocs-frame-position OCS で規定されているように、レジスタの値に対して、スタックフレー ム中の特定の場所に保存されるという動作を強制します (あるいは要求 しません)。 DG/UX, Delta88 SVr3.2, BCS のコンフィギュレーショ ン で は ‘-mocs-frame-position’ をデフォルトとして、それ以外の 88k コンフィギュレーションでは ‘-mno-ocs-frame-position’ をデフォ ル トとして使用しています。 -moptimize-arg-area -mno-optimize-arg-area 関数の引数がどのような方法でスタックフレームに格納されるかを指定 します。 ‘-moptimize-arg-area’ はスペースを節約しますが、いく つ か のデバッガ (GDB は含まれない) をクラッシュさせます。‘-mno-op- timize-arg-area’ はより標準に従っています。デフォルトでは GCC は 引数エリアの最適化を行いません。 -mshort-data-num データ参照時に、それらの処理を r0 からの相対参照で行なうことによ って小さなコードにすることを可能とします。これは値のロードを (そ の 他の場合は 2 命令かかるところを) 1 命令で行なうことを可能にし ます。num をこのオプションとともに指定することによって、どのデー タ 参 照 が 影 響 を 受 け る かを指定することができます。例えば ‘-mshort-data-512’ を指定すると、512 バイト以内のディスプレー ス メ ン ト のデータ参照が影響を受けることになります。 ‘-mshort-da- ta-num’ は num が 64K よりも大きな時は効果を持ちません。 -mserialize-volatile -mno-serialize-volatile volatile なメモリへの参照について、シーケンシャルな整合性を持 っ たコードを生成する、あるいは生成しません。 GNU CC はデフォルトではどのプロセッササブモデルを選んだ場合にお いても、整合性を常に保証します。これがどのように実現されているか は、サブモデルに依存しています。 m88100 プロセッサはメモリ参照の順番を入れ換えないので、常にシー ケンシャルな整合性は保たれます。もし ‘-m88100’ を使用した場合 は 、GNU CC はシーケンシャルな整合性を保つための特別な命令を生成し ません。 m88110 プロセッサにおけるメモリ参照の順番は、必ずしもそれらの 要 求を行なった命令の順番とは一致しません。特に、読み込み命令は、先 行する書き込み命令よりも先に実行され得ます。このような順番の入れ 換えは、マルチプロセッサ時に volatile なメモリの参照におけるシー ケンシャルな整合性を崩してしま い ま す 。 ‘-m88000’ ま た は ‘-m88110’ を指定した場合には、GNU CC は、必要な場合は特別な命令 を生成し、命令の実行が正しい順番で行なわれることを強制します。 ここで生成される整合性を保証するための特別な命令はアプリケーショ ンの性能に対して影響を及ぼします。もしこの保証無しで問題がないと いうことがわかっている場合は、‘-mno-serialize-volatile’ を使用す ることができます。 ‘-m88100’ オプションを使用しているが、m88110 における実行時にシ ーケンシャルな整合性が必要とされる場合は、‘-mserialize-volatile’ を使用するべきです。 -msvr4 -msvr3 System V release 4 (SVr4) に関連したコンパイラの拡張を有効 (‘-msvr4’) あるいは無効 (‘-msvr3’) にします。これは以下の内容 を 制御します。 · 生成するアセンブラの文法の種類 (これは ‘-mversion-03.00’ を使用 することによって独立に制御できます)。 · ‘-msvr4’ は C プリプロセッサに対して ‘#pragma weak’ を理解させま す。 · ‘-msvr4’ は、GCC に SVr4 によって使用されている付加的な宣言ディ レクティブを生成させます。 ‘-msvr3’ は、SVr4 を除く全ての m88K コンフィギュレーションにおけるデ フ ォルトです。 -mtrap-large-shift -mhandle-large-shift 31 ビットより大きいビットシフトを検出するコードを埋め込みます。 これらのオプションを指定することによって、それぞれトラップ、ある い は適切に処理するコードが埋め込まれます。デフォルトでは GCC は 大きなビットシフトには特別な対策を行いません。 -muse-div-instruction 非常に初期の 88K アーキテクチャのモデルは除算命令を持っていま せ ん。従って、GCC はデフォルトでは除算命令を生成しません。このオプ ションは除算命令が安全に使用できるということを指定します。 -mversion-03.00 DG/UX コンフィギュレーションには、2 つの SVr4 の種類があります。 こ のオプションは -msvr4 オプションによって hybrid-COFF と real- ELF のどちらが使用されるかを選択します。他のコンフィギュレーショ ンはこのオプションを無視します。 -mwarn-passed-structs 関数に対して構造体を渡した場合と、関数が構造体を返した場合に警告 します。構造体を渡す規約は C 言語の発展の中で変化しており、移 植 性 の問題をしばしば生じることになります。デフォルトでは GCC はこ の警告を行いません。 以下のオプションは IBM RS6000 のために定義されたものです。 -mfp-in-toc -mno-fp-in-toc 浮動小数点定数を Table of Contents (TOC) に入れるかどうかを指 定 します。このテーブルは全てのグローバル変数と関数のアドレスを格納 します。デフォルトでは GCC は浮動小数点定数をここに格納します 。 もし TOC が算術あふれをおこす場合は、‘-mno-fp-in-toc’ を使用する ことによって TOC のサイズを小さくすることが可能であり、算術あ ふ れを防ぐことができるでしょう。 以下は IBM RT PC 用に定義された ‘-m’ オプションです。 -min-line-mul 整数の乗算に対してインラインのコード列を生成します。これはデフォ ルトです。 -mcall-lib-mul 整数の乗算に対して lmul$$ を呼び出します。 -mfull-fp-blocks フルサイズの浮動小数点データブロックを生成します。これは IBM に よって推奨されている最低限のスクラッチスペースの量を包含します。 これはデフォルトです。 -mminimum-fp-blocks 浮動小数点データブロック内に特別なスクラッチスペースを含めません 。これによって、より小さなコードが生成されますが、実行は遅くなり ます。なぜならスクラッチスペースが動的に確保されるからです。 -mfp-arg-in-fpregs IBM の関数呼び出し規約とは互換性のない呼び出し手順を使用します。 この規約では浮動小数点引数を浮動小数点レジスタに入れて渡します。 このオプションを指定すると、varargs.h や stdarg.h で浮動小数点オ ペランドが使用できなくなることに注意して下さい。 -mfp-arg-in-gregs 浮動小数点に対して通常の関数呼び出し規約を使用します。これはデフ ォルトです。 -mhc-struct-return 1 ワードより大きな構造体を返す時に、レジスタではなくメモリを使用 し て返します。これは MetaWare HighC (hc) コンパイラとの互換性を 提供します。‘-fpcc-struct-return’ を使用 す る こ と に よ っ て Portable C Compiler (pcc) との互換性を得ることができます。 -mnohc-struct-return 1 ワードより大きな構造体を返す時に、レジスタによって返される場合 があります。これはその方が便利であると考えられる時に使用されます 。 これはデフォルトです。 IBM が提供するコンパイラとの互換性を得 るためには、‘-fpcc-struct-return’ と ‘-mhc-struct-return’ の双方 を使用します。 以下は MIPS ファミリのために定義された ‘-m’ オプションです。 -mcpu=cpu-type 命令スケジューリング時に、デフォルトのマシンタイプを cpu-type に 仮定します。デフォルトの cpu-type は default です。この選択は す べてのマシンに対する最長のサイクル数を元にコードを生成します。こ れは、生成されるコードがどの MIPS cpu においても適当な速度で処理 さ れ るようにするためです。これ以外の cpu-type の選択としては、 r2000, r3000, r4000, r6000 があります。特定の cpu-type を選択 し た場合は、その特定のチップに適したスケジュールが行われます。コン パイラは、 -mips2 または -mips3 スイッチが使用されていない場合は 、MIPS ISA (instruction set architecture) のレベル 1 に合致しな いコードを生成することはありません。 -mips2 MIPS ISA のレベル 2 (branch likely 命令, 平方根命令) による命 令 群 を出力します。 -mcpu=r4000 と -mcpu=r6000 スイッチは、 -mips2 と共に使用される必要があります。 -mips3 MIPS ISA のレベル 3 (64 ビット命令) を含む命令群を出力しま す 。 -mcpu=r4000 スイッチは、 -mips2 と同時に使用する必要があります。 -mint64 -mlong64 -mlonglong128 これらのオプションは現在動作しません。 -mmips-as MIPS アセンブラのためのコードを生成し、 mips-tfile を起動して 通 常 のデバッグ情報を追加します。これは OSF/1 リファレンスプラット フォーム以外の全てのプラットフォームにおけるデフォル ト で す 。 OSF/1 リファレンスプラットフォームは OSF/rose オブジェクトフォー マットを使用します。スイッチ -ggdb, -gstabs, -gstabs+ のうちのど れ か が使用されている場合は、 mips-tfile プログラムは、stabs を MIPS ECOFF 中にカプセル化します。 -mgas GNU アセンブラ用のコードを生成します。これは OSF/1 リファレン ス プラットフォームにおけるデフォルトです。OSF/1 リファレンスプラッ トフォームは OSF/rose オブジェクトフォーマットを使用します。 -mrnames -mno-rnames -mrnames スイッチは出力コードにおいて、レジスタの名前として、 ハ ードウェア名の代わりに MIPS ソフトウェア名を使用することを指定し ます。(つまり、 a0 を $4 の代わりに使用します)。 GNU アセンブ ラ は -mrnames スイッチをサポートしません。MIPS アセンブラはソース ファイルに対して MIPS C プリプロセッサを起動す る で し ょ う 。 -mno-rnames スイッチがデフォルトです。 -mgpopt -mno-gpopt -mgpopt スイッチは、全てのデータ宣言をテキストセクション中の全命 令の前に書き出すことを指定します。これによって、全ての MIPS アセ ンブラは、ショートグローバル、あるいは静的なデータアイテムに対し て、2 ワードではなく、1 ワードのメモリ参照命令を生成します。これ は最適化が指定された場合のデフォルトです。 -mstats -mno-stats -mstats が指定された場合は、コンパイラによってインラインでない関 数が処理されるごとに、標準エラー出力ファイルに対して、そのプログ ラ ムに対する統計情報を示す 1 行のメッセージを出力します。このメ ッセージは、保存したレジスタの数、スタックのサイズなどを示します 。 -mmemcpy -mno-memcpy -mmemcpy スイッチは、全てのブロック転送に対して、インラインコー ドを生成する代わりに、適切なストリング関数 (memcpy または bcopy) を呼び出すコードを生成します。 -mmips-tfile -mno-mips-tfile -mno-mips-tfile スイッチを指定すると、 MIPS アセンブラがデバッグ サポートのために生成したオブジェクトファイルに対し、 mips-tfile を使用した後処理を行いません。 mips-tfile が実行されないと、デバ ッガからはローカル変数を扱うことができません。さらに、 stage2 と stage3 のオブジェクトはアセンブラに渡される一時的なファイル名を オブジェクトファイル中に埋め込まれて持っており、このためそれらを 比較した場合に同一のものとはみなされません。 -msoft-float 浮動小数点演算のためにライブラリを呼び出す出力を行います。 警告: この必須のライブラリは GNU CC の一部としては含まれません。通常は そ のマシンの一般的な C コンパイラの提供するものを使用しますが、 これは通常の方法ではクロスコンパイルで直接使用することはできませ ん。クロスコンパイルを行ないたい場合は、自分自身で必要なライブラ リ関数を用意する必要があります。 -mhard-float 浮動小数点命令を含んだ出力を生成します。これは変更されないソース を使用した場合のデフォルトです。 -mfp64 ステータスワード中の FR ビットが立っていることを仮定します。これ は 32 個の 32 ビット浮動小数点レジスタの代わりに、32 個の 64 ビ ットの浮動小数点レジスタが存在するということを示します。この場合 は、同時に -mcpu=r4000 と -mips3 スイッチを指定する必要があり ま す。 -mfp32 32 個の 32 ビット浮動小数点レジスタが存在するということを仮定し ます。これはデフォルトです。 -mabicalls -mno-abicalls いくつかの System V.4 の移植が位置独立コードのために使用する疑似 命令 .abicalls, .cpload, .cprestore を出力する、あるいは出力しま せん。 -mhalf-pic -mno-half-pic -mhalf-pic スイッチは、テキストセクション中に参照を配置する代 わ りに、外部参照を行なうポインタをデータセクションに配置し、それを ロードする動作を指定します。このオプションは現在まだ動作しません 。 -Gnum は num バイト以下のグローバル、あるいは静的なアイテムを 、通常のデータや bss セクションではなく、小さなデータ、 ま た は bss セクションに配置することを指定します。これによりアセンブラは 、通常では 2 ワードの参照を行うところを、グローバルポインタ (gp ま たは $28) を基準とした 1 ワードのメモリ参照命令を生成可能とな ります。デフォルトでは MIPS アセンブラが使用される場合、 num は 8 です。また、GNU アセンブラが使用される場合のデフォルトは 0 で す。 -Gnum スイッチはアセンブラ、リンカにも同様に渡されます。 全 て のモジュールは同一の -Gnum の値でコンパイルされなければなりま せん。 -nocpp MIPS アセンブラに、ユーザアセンブラファイル (‘.s’ 拡張子を持ちま す) に対するアセンブル時のプリプロセッサの起動を抑制させます。 以下は、Intel 80386 ファミリ用に定義された ‘-m’ オプションです。 -m486 -mno-486 386 ではなく 486 に最適化されたコードを出力する、あるいはその逆 を行なう指定を行います。486 用に生成されたコードは 386 で実行 可 能であり、逆もまた可能です。 -mpentium -mcpu=pentium と同義です。 -mpentiumpro -mcpu=pentiumpro と同義です。 -mcpu=cpu type 命令をスケジューリングする際のマシンタイプのデフォルトを設定しま す。 CPU TYPE の選択肢は i386, i486, i586 (pentium), pentium, i686 (pentiumpro), および pentiumpro です。ある CPU TYPE を選ぶ と、その特定チップに適するようにスケジューリングを行います が 、 -march=cpu type オプションを指定しない限り、コンパイラは i386 で 実行できないようなコードは生成しません。 -march=cpu type マシンタイプ CPU TYPE 用に命令を生成します。 CPU TYPE の選択肢は i386, i486, pentium, および pentiumpro です。 -march=cpu type を 指定すると -mcpu=cpu type も指定されたものとみなします。 -msoft-float 浮動小数点演算のためにライブラリを呼び出す出力を行います。 警告: この必須のライブラリは GNU CC の一部としては含まれません。通常は そのマシンの一般的な C コンパイラの提供するものを使用しますが 、 これは通常の方法ではクロスコンパイルで直接使用することはできませ ん。クロスコンパイルを行ないたい場合は、自分自身で必要なライブラ リ関数を用意する必要があります。 関 数が浮動小数点数を返す時に 80387 レジスタスタックを使用するマ シンにおいては、‘-msoft-float’ を使用した場合でも、いくつかの 浮 動小数点命令が生成されます。 -mno-fp-ret-in-387 関数からの返り値に FPU のレジスタを使用しません。 通 常 の関数呼び出し規約は、たとえ FPU が存在しなくても float と double の結果を FPU レジスタに入れて返します。したがってこの場合 、 オペレーティングシステムは FPU をエミュレートしなければなりま せん。 ‘-mno-fp-ret-in-387’ オプションを指定すると、浮動小数点数も通 常 の CPU レジスタに入れて返されます。 -mprofiler-epilogue -mno-profiler-epilogue 関数から抜けるコードにてプロファイル情報を書き出す追加コードを生 成します。 以下は HPPA ファミリ用に定義された ‘-m’ オプションです。 -mpa-risc-1-0 PA 1.0 プロセッサ用のコードを出力します。 -mpa-risc-1-1 PA 1.1 プロセッサ用のコードを出力します。 -mkernel カーネルに適したコードを生成します。特に、引数の 1 つとし て DP レ ジスタをとる add 命令の使用を抑制し、その代わりに、addil 命令 を生成します。これは HP-UX リンカの深刻なバグを避けるための措 置 です。 -mshared-libs HP-UX 共有ライブラリとリンクさせるコードを生成します。このオプシ ョンはまだ完全に動作しているわけではなく、どの PA ターゲットにお いてもデフォルトになっていません。このオプションを指定すると、コ ンパイラは誤ったコードを出力し得ます。 -mno-shared-libs 共有ライブラリとリンクしないコードを生成します。これは全ての PA ターゲットにおいてデフォルトのオプションです。 -mlong-calls 関数の呼び出し先と呼び出し元が同一ファイルに含まれた場合、呼び出 し時の距離が 256K を越える場合でも動作するようなコードを出力しま す。このオプションは、リンカから “branch out of range errors” で リンクを拒否された時以外には使用しないようにしてください。 -mdisable-fpregs いかなる形においても、浮動小数点レジスタの使用を禁止します。これ は浮動小数点レジスタに配慮しないコンテキストスイッチを行なうカー ネルに対して有効です。このオプションを使用して、浮動小数点処理を 行なおうとすると、コンパイラはアボートします。 -mdisable-indexing コ ンパイラに対して、indexing addressing mode を使用しないように 指定します。これによって MACH において MIG によって生成された コ ードをコンパイルする際の、あまり重要でないいくつかの問題を防ぐこ とができます。 -mtrailing-colon ラベル定義の後にコロンを加えます (ELF アセンブラ用)。 以下は、Intel 80960 ファミリ用に定義された ‘-m’ オプションです。 -mcpu-type デフォルトのマシンタイプを cpu-type に仮定します。これは生成する 命令とアドレッシングモード、そして境界条件に関係します。デフォル トの cpu-type は kb です。その他の選択としては ka, mc, ca, cf, sa, sb があります。 -mnumerics -msoft-float -mnumerics オプションはプロセッサが浮動小数点命令をサポートする ことを示します。 -msoft-float オプションは浮動小数点サポートを仮 定しないことを示します。 -mleaf-procedures -mno-leaf-procedures 葉 に位置する手続きについて、 call 命令と同様に bal 命令でも呼び 出すことを可能とします (あるいは、しません)。これは bal 命令がア センブラ、またはリンカによって置き換えられ得る場合には、直接呼び 出しに対して効率の良いコードを得ることができます。ただし、それ以 外の場合は効率の良くないコードを生成します。例えば、関数へのポイ ンタ経由の呼び出しや、この最適化をサポートしないリンカを使用した 場合などがこれに該当します。 -mtail-call -mno-tail-call ( マシン非依存の部分を越えて) 末尾再帰を分岐に変換する処理に関す るさらなる最適化を行います(または行いません)。この手法の適用が正 当でないということに関する判断が完全ではないので、まだこのオプシ ョンを使用することは適当でないかもしれません。 デ フ ォ ル ト は -mno-tail-call です。 -mcomplex-addr -mno-complex-addr この i960 の実装では複雑なアドレッシングモードの使用が優位である と仮定します (あるいは仮定しません)。複雑なアドレッシングモー ド は K-シリーズでは使用する価値は無いかも知れませんが、 C-シリーズ では確かに使用する価値があります。現在は -mcomplex-addr が 、CB と CC を除く全てのプロセッサにおけるデフォルトです。 -mcode-align -mno-code-align よ り高速なフェッチのためにコードを 8 バイトにアラインします (ま たは何もしません)。現在では C シリーズの実装においてのみデフォル トで有効にしています。 -mic-compat -mic2.0-compat -mic3.0-compat iC960 v2.0 または v3.0 との互換性を持たせます。 -masm-compat -mintel-asm iC960 アセンブラとの互換性を持たせます。 -mstrict-align -mno-strict-align アラインされないアクセスを許可しません (あるいは許可します)。 -mold-align Intel による gcc リリースバージョン 1.3 (gcc 1.37 ベース) との構 造体の境界条件に関する互換性を持たせます。現在は、 #pragma align 1 が同時に仮定されてしまい、無効化できないというバグを持っていま す。 以下は、DEC Alpha 用に定義された ‘-m’ オプションです。 -mno-soft-float -msoft-float 浮動小数点操作に対して、ハードウェアによる浮動小数点命令を使用し ま す ( し ま せ ん) 。 も し 、-msoft-float が指定された場合は 、‘libgcc1.c’ 内の関数が浮動小数点演算に使用されます。ただし、こ れらのルーチンが浮動小数点演算をエミュレートするルーチンによって 置き換えられているか、そのようなエミュレーションルーチンを呼び出 すようにコンパイルされているのでない限り、これらのルーチンは浮動 小数点演算を行なってしまいます。浮動小数点演算のない Alpha の た めのコンパイルを行なうためには、ライブラリもこれらを呼び出さない ようにコンパイルされていなければなりません。 浮動小数点演算のない Alpha の実装は、浮動小数点レジスタを必要 と するということに注意して下さい。 -mfp-reg -mno-fp-regs 浮 動小数点レジスタセットを使用する (使用しない)コードを生成しま す。 -mno-fp-regs は暗黙のうちに -msoft-float を含みます。浮動小 数点レジスタセットが使用されない場合は、浮動小数点オペランドは整 数レジスタに入れられて渡され、浮動小数点数の結果は $f0 ではな く $0 に入れて返されます。これは非標準の関数呼び出し手順であり、浮 動小数点数の引数や返り値を持つ関数で、-mno-fp-regs をつけてコ ン パイルされたコードから呼び出される関数はすべてこのオプションをつ けてコンパイルされている必要があります。 このオプションの典型的な用法は、浮動小数点レジスタを使用せず、し たがって浮動小数点レジスタへのセーブもリストアも必要のないカーネ ルを構築する時などがあるでしょう。 ここに追加するオプションは System V Release 4 において、これらのシス テ ム上の他のコンパイラとの互換性のために提供されるものです。 -G SVr4 システムにおいて、gcc は ‘-G’ オプションを受け付けます (そ してこれをシステムリンカに渡します)。これは他のコンパイラとの 互 換 性のためです。しかし、リンカオプションを gcc のコマンドライン から渡すよりも、我々は ‘-symbolic’ または ‘-shared’ の使用が適当 であると考えています。 -Qy コンパイラが使用したそれぞれのツールのバージョンを .ident アセン ブラディレクティブを使用して、出力で明示します。 -Qn .ident ディレクティブを出力に加えることを抑制します (これはデ フ ォルトです)。 -YP,dirs ‘-l’ で指定されたライブラリに対して、 dirsで規定されたディレクト リのみを検索し、他は検索しません。 dirs 中は、1 つのコロンで区切 ることにより、複数のディレクトリエントリを記述します。 -Ym,dir M4 プリプロセッサを dir に検索します。アセンブラがこのオプション を使用します。 コード生成オプション これらのマシン独立オプションは、コード生成にて使用されるインタフェー ス 規約を制御します。 こ れらのほとんどは ‘-f’ で始まります。これらのオプションは有効形式と無 効形式の 2 つの形式を持っています。‘-ffoo’ の無効形式は ‘-fno-foo’ です 。 以下に挙げる表においては、このうち、デフォルトではない片方のみが挙げ られています。‘no-’ を追加するか、削除するかによって双方の形式を得る こ とができます。 -fnonnull-objects 参 照 型 に よって参照されるオブジェクトはヌルでないと仮定します (C++ のみ)。 通常は GNU C++ は参照型によって参照されるオブジェクトに関して は 保 守的な仮定を行います。例えば、コンパイラは a が以下のコードに おいてヌルでないことをチェックする必要があります。 obj &a = g (); a.f (2); この種の参照がヌルでないことのチェックは、特別なコードを必要とし ます。しかし、これは多くのプログラムにとって無用なものです。この ヌルに対するチェックを必要のない場合 ‘-fnonnull-objects’ を使 用 することにより、省略することができます。 -fpcc-struct-return struct と union の値を返す場合に、普通の C コンパイラが行なうの と同じ規約を使用します。この規約は小規模な構造体に対して非効率な ものとなり、また多くのマシンでその関数を再入不可能としてしまいま す。しかしこれは、GCC でコンパイルされたコードと PCC でコンパ イ ルされたコードを相互に呼び出すことを可能とするという利点を持ちま す。 -freg-struct-return struct と union の値を返す場合に、可能な場合はレジスタを使用する 規 約を使用します。これは -fpcc-struct-return を使用した場合と比 較して、小さな構造体を返す場合に高い性能を発揮します。 -fpcc-struct-return と -freg-struct-return のどちらも使用しな か っ た場合には、GNU CC は各ターゲットに対して標準であると考えられ る規約をデフォルトとして使用します。もし標準規約がなかった場合は 、 -fpcc-struct-return をデフォルトとして使用します。 -fshort-enums enum 型に対して、ちょうど取り得る値の範囲に応じたバイト数の型を 与えます。具体的には、enum 型は、その値域を格納するに十分な最 小 の整数型と等価になります。 -fshort-double double を float と同サイズにします。 -fshared-data デ ータと非 const 変数を、プライベートなデータではなく、共有デー タとしてコンパイルします。このオプションは、走行中の同じプログラ ム間は共有データが共有され、プライベートデータがそれぞれのプロセ スに 1 つずつ与えられるような一部のオペレーティングシステムで 意 味を持ちます。 -fno-common bss セクション中の初期化されていないグローバル変数に対してでも、 共通ブロックに生成するのではなく、領域を割り当てます。このオプシ ョ ンは、(extern をつけずに) 同一の変数を宣言した 2 つのコンパイ ルに対して、リンク時にエラーを発生するという効果があります。この オプションは、常にこのような動作を行なうシステムにおいても、プロ グラムが正常に動作するかどうかを検査する場合にのみ有用です。 -fno-ident ‘#ident’ ディレクティブを無視します。 -fno-gnu-linker (C++ のコンストラクタとデストラクタのような) グローバルな初期 化 のコードを (GNU リンカがこれらを扱う標準のシステムであるようなシ ステムにおいて) GNU リンカで使用される形式で出力しません。これは GNU リンカではないリンカを使用する場合に指定します。この場合、 collect2 を使用して、確実にシステムリンカにコンストラクタとデ ス ト ラ クタを含んだコードを出力させる必要があります。(collect2 は GNU CC のディストリビューションに含まれます。) collect2 を必ず使 用 しなければならない システムにおいては、コンパイラドライバ gcc は自動的にそのようにコンフィギュレーションされます。 -finhibit-size-directive .sizeアセンブラディレクティブなど、関数が途中で分割され、メモ リ 上の異なった位置にそれぞれの部分が配置されるような場合に不都合が 生じるような要素を出力しません。このオプションは ‘crtstuff.c’ を コンパイルする時に使用されます。それ以外の場所ではこれを使用する 必要はありません。 -fverbose-asm 出力のアセンブラ中に特別なコメント情報を追加し、可読性を高めます 。このオプションは一般的には、出力のアセンブラコードを本当に読み たい場合 (例えばコンパイラ自身をデバッグしているような場合) にの み効果があります。 -fvolatile ポインタによるメモリの参照を全て volatile として扱います。 -fvolatile-global 外 部変数やグローバルデータアイテムへのメモリ参照を全て volatile として扱います。 -fpic このオプションがターゲットマシンでサポートされていれば、位置独立 なコードを出力します。このオプションは共有ライブラリでの使用に適 します。 -fPIC このオプションがターゲットマシンでサポートされていれば、位置独立 なコードを出力します。このオプションはダイナミックリンクに適して おり、分岐において大きなディスプレースメントを要求する場合にも適 応します。 -ffixed-reg 名 前が reg のレジスタを固定レジスタとして扱います。生成されたコ ードはこのレジスタを参照しません (ただし、スタックポインタ、フレ ームポインタ、その他固定用途の場合を除きます)。 reg はレジスタ名でなければなりません。受け付けられるレジスタ名は マシン固有であり、マシン記述マクロファイル内の REGISTER_NAMES マ クロに記述されたものです。 こ のフラグは無効形式を持ちません。なぜなら、これは 3 通りの指定 が可能であるからです。 -fcall-used-reg 名前が reg のレジスタを、関数呼び出しによって破壊される割り当 て 可能のレジスタとして取り扱います。これは、関数呼び出しを跨いで存 在しない一時領域や変数として割り当ることができます。この指定でコ ンパイルされた関数は、レジスタ reg の保存や復帰を行いません。 このフラグをマシンの実行モデルにおいて、ある固定的で特殊な役割を 持っているレジスタ、例えばスタックポインタやフレームポインタに対 して適用することは、破滅的な結果を生みます。 こ のフラグは無効形式を持ちません。なぜなら、これは 3 通りの指定 が可能であるからです。 -fcall-saved-reg 名前が reg のレジスタを、関数によって保存される割り当て可能な レ ジスタとして取り扱います。これは、関数呼び出しを跨いで存在する一 時領域や変数としても割り当てることができます。この指定でコンパイ ル された関数は、レジスタ reg を使用する場合、その保存と復帰を行 います。 このフラグをマシンの実行モデルにおいて、ある固定的で特殊な役割を 持っているレジスタ、例えばスタックポインタやフレームポインタに対 して適用することは、破滅的な結果を生みます。 また、このフラグを関数の返り値が格納されるレジスタに使用すると、 これも破滅的な結果を生みます。 こ のフラグは無効形式を持ちません。なぜなら、これは 3 通りの指定 が可能であるからです。 プラグマ 2 つの ‘#pragma’ ディレクティブ(指令)が GNU C++ によってサポートされ て います。これは、1 つのヘッダファイルを 2 つの目的、つまりあるオブジェク トクラスのためのインタフェースの定義としての目的と、オブジェクトクラ ス に 含まれる内容の完全な定義としての目的の、両方の目的で使用するためのも のです。 #pragma interface (C++ のみ) このディレクティブを、オブジェクトクラスを定義して い るヘッダファイル中に使用することによって、それらのクラスを使用す るほとんどのオブジェクトファイルの大きさを減少させることができま す。通常は、特定の情報 (インラインメンバ関数のバックアップコピー 、デバッグ情報、仮想関数実現のための内部テーブル) の複製がそのク ラス定義をインクルードしたそれぞれのオブジェクトファイル中に置か れます。このプラグマを使用することによって、このような複製を防ぐ ことが可能となります。‘#pragma interface’ を含んだヘッダファイル をインクルードした場合は、これらの追加情報は生成されません (ただ し、メインの入力ソースファイル自身が ‘#pragma implementation’ を 含んでいる場合を除きます)。そのかわり、オブジェクトファイルは リ ンク時に解決される参照を含むことになります。 #pragma implementation #pragma implementation "objects.h" (C++ のみ) インクルードされたヘッダファイルによる完全な出力を生 成させたい (またそれをグローバルに可視化したい) 場合には、メイン の入力ファイル中でこのプラグマを使用します。この場合、インクルー ドされるヘッダファイルは、‘#pragma interface’ を使用していなけれ ばなりません。インライン関数のバックアップ情報、デバッグ情報、仮 想関数実現用の内部テーブルは、全てインプリメンテーションファイル 中に生成されます。 ‘#pragma implementation’ を、引数をつけずに使用した場合は、これ はそのソースファイルと同じベースネーム(basename)を持つファイルに 対 し て適用されます。例えば、‘allclass.cc’ 中の ‘#pragma imple- mentation’ は、‘#pragma implementation “allclass.h” ’ と等価です 。 もし複数のヘッダファイルに対して、 1 つのインプリメンテーショ ンファイルを対応させたい場合は、文字列の引数を使用する必要があり ます。 1 つのヘッダファイルに対して、複数のインプリメンテーションファイ ルを対応させる方法はありません。 関連ファイル file.c C 言語ソースファイル file.h C 言語ヘッダ (プリプロセッサ) ファイル file.i プリプロセス済みの C 言語ソースファイル file.C C++ ソースファイル file.cc C++ ソースファイル file.cxx C++ ソースファイル file.m Objective-C ソースファイル file.s アセンブリ言語ファイル file.o オブジェクトファイル a.out リンクエディット済みの出力 TMPDIR/cc∗ 一時ファイル群 LIBDIR/cpp プリプロセッサ LIBDIR/cc1 C 言語コンパイラ LIBDIR/cc1plus C++ コンパイラ LIBDIR/collect いくつかのマシンで必要となるリンカのフロントエンド LIBDIR/libgcc.a GCC サブルーチンライブラリ /lib/crt[01n].o スタートアップルーチン LIBDIR/ccrt0 C++ 用の付加的なスタートアップルーチン /lib/libc.a 標準ライブラリ、intro(3)を参照 /usr/include #include ファイルのための標準ディレクトリ LIBDIR/include #include ファイルのための GCC 標準ディレクトリ LIBDIR/g++-include #include ファイルのための付加的な g++ ディレクトリ LIBDIR は通常 /usr/local/lib/machine/version の形式を持ちます TMPDIR は環境変数 TMPDIR (もし使用可能ならば /usr/tmp を、そうでなけ れ ば /tmp を使用します) からとられます。 関連項目 as(1), cpp(1), gdb(1), ld(1) info 中の ‘gcc’, ‘cpp’, ‘as’, ‘ld’, ‘gdb’ エントリ Using and Porting GNU CC (for version 2.0), Richard M. Stallman; The C Preprocessor, Richard M. Stallman; Debugging with GDB: the GNU Source- Level Debugger, Richard M. Stallman and Roland H. Pesch; Using as: the GNU Assembler, Dean Elsner, Jay Fenlason & friends; ld: the GNU linker, Steve Chamberlain and Roland Pesch. バグ バグを報告する方法については、GCC マニュアルを参照してください。 COPYING Copyright 1991, 1992, 1993 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the en- tire resulting derived work is distributed under the terms of a permis- sion notice identical to this one. Permission is granted to copy and distribute translations of this manu- al into another language, under the above conditions for modified ver- sions, except that this permission notice may be included in transla- tions approved by the Free Software Foundation instead of in the origi- nal English. 作者 GNU CC に対して貢献した人々に関しては、GNU CC マニュアルを参照してく だ さい。 日本語訳 細川 達己(hosokawa@mt.cs.keio.ac.jp): NetBSD 用に翻訳 sakai@csl.cl.nec.co.jp, h-nokubi@nmit.mt.nec.co.jp, kumano@strl.nhk.or.jp, horikawa@isrd.hitachi.co.jp: FreeBSD 向けに修正, 査閲 GNU Tools 1998/12/16 GCC(1)

GCC(1) GNU GCC(1) NAME gcc - GNU project C and C++ compiler SYNOPSIS gcc [-c|-S|-E] [-std=standard] [-g] [-pg] [-Olevel] [-Wwarn...] [-pedantic] [-Idir...] [-Ldir...] [-Dmacro[=defn]...] [-Umacro] [-foption...] [-mmachine-option...] [-o outfile] [@file] infile... Only the most useful options are listed here; see below for the remainder. g++ accepts mostly the same options as gcc. DESCRIPTION When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker. Then the output consists of object files output by the assembler. Other options are passed on to one stage of processing. Some options control the preprocessor and others the compiler itself. Yet other options control the assembler and linker; most of these are not documented here, since you rarely need to use any of them. Most of the command line options that you can use with GCC are useful for C programs; when an option is only useful with another language (usually C++), the explanation says so explicitly. If the description for a particular option does not mention a source language, you can use that option with all supported languages. The gcc program accepts options and file names as operands. Many options have multi-letter names; therefore multiple single-letter options may not be grouped: -dv is very different from -d -v. You can mix options and other arguments. For the most part, the order you use doesn’t matter. Order does matter when you use several options of the same kind; for example, if you specify -L more than once, the directories are searched in the order specified. Also, the placement of the -l option is significant. Many options have long names starting with -f or with -W---for example, -fmove-loop-invariants, -Wformat and so on. Most of these have both positive and negative forms; the negative form of -ffoo would be -fno-foo. This manual documents only one of these two forms, whichever one is not the default. OPTIONS Option Summary Here is a summary of all the options, grouped by type. Explanations are in the following sections. Overall Options -c -S -E -o file -combine -pipe -pass-exit-codes -x language -v -### --help[=class[,...]] --target-help --version -wrapper@file C Language Options -ansi -std=standard -fgnu89-inline -aux-info filename -fno-asm -fno-builtin -fno-builtin-function -fhosted -ffreestanding -fopenmp -fms-extensions -trigraphs -no-integrated-cpp -traditional -traditional-cpp -fallow-single-precision -fcond-mismatch -flax-vector-conversions -fsigned-bitfields -fsigned-char -funsigned-bitfields -funsigned-char C++ Language Options -fabi-version=n -fno-access-control -fcheck-new -fconserve-space -ffriend-injection -fno-elide-constructors -fno-enforce-eh-specs -ffor-scope -fno-for-scope -fno-gnu-keywords -fno-implicit-templates -fno-implicit-inline-templates -fno-implement-inlines -fms-extensions -fno-nonansi-builtins -fno-operator-names -fno-optional-diags -fpermissive -frepo -fno-rtti -fstats -ftemplate-depth-n -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ -fno-default-inline -fvisibility-inlines-hidden -fvisibility-ms-compat -Wabi -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Weffc++ -Wstrict-null-sentinel -Wno-non-template-friend -Wold-style-cast -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo Objective-C and Objective-C++ Language Options -fconstant-string-class=class-name -fgnu-runtime -fnext-runtime -fno-nil-receivers -fobjc-call-cxx-cdtors -fobjc-direct-dispatch -fobjc-exceptions -fobjc-gc -freplace-objc-classes -fzero-link -gen-decls -Wassign-intercept -Wno-protocol -Wselector -Wstrict-selector-match -Wundeclared-selector Language Independent Options -fmessage-length=n -fdiagnostics-show-location=[once|every-line] -fdiagnostics-show-option Warning Options -fsyntax-only -pedantic -pedantic-errors -w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds -Wno-attributes -Wno-builtin-macro-redefined -Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual -Wchar-subscripts -Wclobbered -Wcomment -Wconversion -Wcoverage-mismatch -Wno-deprecated -Wno-deprecated-declarations -Wdisabled-optimization -Wno-div-by-zero -Wempty-body -Wenum-compare -Wno-endif-labels -Werror -Werror=* -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wframe-larger-than=len -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Winline -Wno-int-to-pointer-cast -Wno-invalid-offsetof -Winvalid-pch -Wlarger-than=len -Wunsafe-loop-optimizations -Wlogical-op -Wlong-long -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wno-mudflap -Wno-multichar -Wnonnull -Wno-overflow -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format -Wpointer-arith -Wno-pointer-to-int-cast -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wsign-conversion -Wstack-protector -Wstrict-aliasing -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=n -Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand -Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized -Wunknown-pragmas -Wno-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable -Wvariadic-macros -Wvla -Wvolatile-register-var -Wwrite-strings C and Objective-C-only Warning Options -Wbad-function-cast -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wstrict-prototypes -Wtraditional -Wtraditional-conversion -Wdeclaration-after-statement -Wpointer-sign Debugging Options -dletters -dumpspecs -dumpmachine -dumpversion -fdbg-cnt-list -fdbg-cnt=counter-value-list -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links -fdump-translation-unit[-n] -fdump-class-hierarchy[-n] -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline -fdump-statistics -fdump-tree-all -fdump-tree-original[-n] -fdump-tree-optimized[-n] -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias -fdump-tree-ch -fdump-tree-ssa[-n] -fdump-tree-pre[-n] -fdump-tree-ccp[-n] -fdump-tree-dce[-n] -fdump-tree-gimple[-raw] -fdump-tree-mudflap[-n] -fdump-tree-dom[-n] -fdump-tree-dse[-n] -fdump-tree-phiopt[-n] -fdump-tree-forwprop[-n] -fdump-tree-copyrename[-n] -fdump-tree-nrv -fdump-tree-vect -fdump-tree-sink -fdump-tree-sra[-n] -fdump-tree-fre[-n] -fdump-tree-vrp[-n] -ftree-vectorizer-verbose=n -fdump-tree-storeccp[-n] -fdump-final-insns=file -fcompare-debug[=opts] -fcompare-debug-second -feliminate-dwarf2-dups -feliminate-unused-debug-types -feliminate-unused-debug-symbols -femit-class-debug-always -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs -frandom-seed=string -fsched-verbose=n -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose -ftest-coverage -ftime-report -fvar-tracking -fvar-tracking-assignments -fvar-tracking-assignments-toggle -g -glevel -gtoggle -gcoff -gdwarf-version -ggdb -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf -gvms -gxcoff -gxcoff+ -fno-merge-debug-strings -fno-dwarf2-cfi-asm -fdebug-prefix-map=old=new -femit-struct-debug-baseonly -femit-struct-debug-reduced -femit-struct-debug-detailed[=spec-list] -p -pg -print-file-name=library -print-libgcc-file-name -print-multi-directory -print-multi-lib -print-multi-os-directory -print-prog-name=program -print-search-dirs -Q -print-sysroot -print-sysroot-headers-suffix -save-temps -time[=file] Optimization Options -falign-functions[=n] -falign-jumps[=n] -falign-labels[=n] -falign-loops[=n] -fassociative-math -fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize -fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves -fcheck-data-deps -fconserve-stack -fcprop-registers -fcrossjumping -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules -fcx-limited-range -fdata-sections -fdce -fdce -fdelayed-branch -fdelete-null-pointer-checks -fdse -fdse -fearly-inlining -fexpensive-optimizations -ffast-math -ffinite-math-only -ffloat-store -fforward-propagate -ffunction-sections -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining -finline-functions -finline-functions-called-once -finline-limit=n -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg -fipa-pta -fipa-pure-const -fipa-reference -fipa-struct-reorg -fipa-type-escape -fira-algorithm=algorithm -fira-region=region -fira-coalesce -fno-ira-share-save-slots -fno-ira-share-spill-slots -fira-verbose=n -fivopts -fkeep-inline-functions -fkeep-static-consts -floop-block -floop-interchange -floop-strip-mine -fmerge-all-constants -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline -fno-defer-pop -fno-function-cse -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls -fpeel-loops -fpredictive-commoning -fprefetch-loop-arrays -fprofile-correction -fprofile-dir=path -fprofile-generate -fprofile-generate=path -fprofile-use -fprofile-use=path -fprofile-values -freciprocal-math -fregmove -frename-registers -freorder-blocks -freorder-blocks-and-partition -freorder-functions -frerun-cse-after-loop -freschedule-modulo-scheduled-loops -frounding-math -frtl-abstract-sequences -fsched2-use-superblocks -fsched2-use-traces -fsched-spec-load -fsched-spec-load-dangerous -fsched-stalled-insns-dep[=n] -fsched-stalled-insns[=n] -fschedule-insns -fschedule-insns2 -fsection-anchors -fsee -fselective-scheduling -fselective-scheduling2 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-wide-types -fstack-protector -fstack-protector-all -fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-fre -ftree-loop-im -ftree-loop-distribution -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize -ftree-parallelize-loops=n -ftree-pre -ftree-reassoc -ftree-sink -ftree-sra -ftree-switch-conversion -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp -funit-at-a-time -funroll-all-loops -funroll-loops -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb -fwhole-program --param name=value -O -O0 -O1 -O2 -O3 -Os Preprocessor Options -Aquestion=answer -A-question[=answer] -C -dD -dI -dM -dN -Dmacro[=defn] -E -H -idirafter dir -include file -imacros file -iprefix file -iwithprefix dir -iwithprefixbefore dir -isystem dir -imultilib dir -isysroot dir -M -MM -MF -MG -MP -MQ -MT -nostdinc -P -fworking-directory -remap -trigraphs -undef -Umacro -Wp,option -Xpreprocessor option Assembler Option -Wa,option -Xassembler option Linker Options object-file-name -llibrary -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic -s -static -static-libgcc -shared -shared-libgcc -symbolic -T script -Wl,option -Xlinker option -u symbol Directory Options -Bprefix -Idir -iquotedir -Ldir -specs=file -I- --sysroot=dir Target Options -V version -b machine Machine Dependent Options ARC Options -EB -EL -mmangle-cpu -mcpu=cpu -mtext=text-section -mdata=data-section -mrodata=readonly-data-section ARM Options -mapcs-frame -mno-apcs-frame -mabi=name -mapcs-stack-check -mno-apcs-stack-check -mapcs-float -mno-apcs-float -mapcs-reentrant -mno-apcs-reentrant -msched-prolog -mno-sched-prolog -mlittle-endian -mbig-endian -mwords-little-endian -mfloat-abi=name -msoft-float -mhard-float -mfpe -mthumb-interwork -mno-thumb-interwork -mcpu=name -march=name -mfpu=name -mstructure-size-boundary=n -mabort-on-noreturn -mlong-calls -mno-long-calls -msingle-pic-base -mno-single-pic-base -mpic-register=reg -mnop-fun-dllimport -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns -mpoke-function-name -mthumb -marm -mtpcs-frame -mtpcs-leaf-frame -mcaller-super-interworking -mcallee-super-interworking -mtp=name -mword-relocations -mfix-cortex-m3-ldrd AVR Options -mmcu=mcu -msize -mno-interrupts -mcall-prologues -mno-tablejump -mtiny-stack -mint8 Blackfin Options -mcpu=cpu[-sirevision] -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library -mno-id-shared-library -mshared-library-id=n -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data -mno-sep-data -mlong-calls -mno-long-calls -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram -micplb CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n -melinux-stacksize=n -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects -mstack-align -mdata-align -mconst-align -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt -melf -maout -melinux -mlinux -sim -sim2 -mmul-bug-workaround -mno-mul-bug-workaround CRX Options -mmac -mpush-args Darwin Options -all_load -allowable_client -arch -arch_errors_fatal -arch_only -bind_at_load -bundle -bundle_loader -client_name -compatibility_version -current_version -dead_strip -dependency-file -dylib_file -dylinker_install_name -dynamic -dynamiclib -exported_symbols_list -filelist -flat_namespace -force_cpusubtype_ALL -force_flat_namespace -headerpad_max_install_names -iframework -image_base -init -install_name -keep_private_externs -multi_module -multiply_defined -multiply_defined_unused -noall_load -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs -noprebind -noseglinkedit -pagezero_size -prebind -prebind_all_twolevel_modules -private_bundle -read_only_relocs -sectalign -sectobjectsymbols -whyload -seg1addr -sectcreate -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr -segs_read_write_addr -seg_addr_table -seg_addr_table_filename -seglinkedit -segprot -segs_read_only_addr -segs_read_write_addr -single_module -static -sub_library -sub_umbrella -twolevel_namespace -umbrella -undefined -unexported_symbols_list -weak_reference_mismatches -whatsloaded -F -gused -gfull -mmacosx-version-min=version -mkernel -mone-byte-bool DEC Alpha Options -mno-fp-regs -msoft-float -malpha-as -mgas -mieee -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time DEC Alpha/VMS Options -mvms-return-codes FR30 Options -msmall-model -mno-lsim FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move -moptimize-membar -mno-optimize-membar -mscc -mno-scc -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls -mcpu=cpu GNU/Linux Options -muclibc H8/300 Options -mrelax -mh -ms -mn -mint32 -malign-300 HPPA Options -march=architecture-type -mbig-switch -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld -mfixed-range=register-range -mjump-in-delay -mlinker-opt -mlong-calls -mlong-load-store -mno-big-switch -mno-disable-fpregs -mno-disable-indexing -mno-fast-indirect-calls -mno-gas -mno-jump-in-delay -mno-long-load-store -mno-portable-runtime -mno-soft-float -mno-space-regs -msoft-float -mpa-risc-1-0 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime -mschedule=cpu-type -mspace-regs -msio -mwsio -munix=unix-std -nolibdld -static -threads i386 and x86-64 Options -mtune=cpu-type -march=cpu-type -mfpmath=unit -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -msoft-float -mno-wide-multiply -mrtd -malign-double -mpreferred-stack-boundary=num -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe -mcrc32 -mrecip -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx -maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfused-madd -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlwp -mthreads -mno-align-stringops -minline-all-stringops -minline-stringops-dynamically -mstringop-strategy=alg -mpush-args -maccumulate-outgoing-args -m128bit-long-double -m96bit-long-double -mregparm=num -msseregparm -mveclibabi=type -mpc32 -mpc64 -mpc80 -mstackrealign -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs -mcmodel=code-model -m32 -m64 -mlarge-data-threshold=num -msse2avx -mindirect-branch=choice -mfunction-return==choice -mindirect-branch-register i386 and x86-64 Windows Options -mconsole -mcygwin -mno-cygwin -mdll -mnop-fun-dllimport -mthread -mwin32 -mwindows IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic -mvolatile-asm-stop -mregister-names -mno-sdata -mconstant-gp -mauto-pic -minline-float-divide-min-latency -minline-float-divide-max-throughput -minline-int-divide-min-latency -minline-int-divide-max-throughput -minline-sqrt-min-latency -minline-sqrt-max-throughput -mno-dwarf2-asm -mearly-stop-bits -mfixed-range=register-range -mtls-size=tls-size -mtune=cpu-type -mt -pthread -milp32 -mlp64 -mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec -msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose -mno-sched-prefer-non-data-spec-insns -mno-sched-prefer-non-control-spec-insns -mno-sched-count-spec-in-critical-path M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops -mno-align-loops -missue-rate=number -mbranch-cost=number -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func -mflush-func=name -mno-flush-trap -mflush-trap=number -G num M32C Options -mcpu=cpu -msim -memregs=number M680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel -malign-int -mstrict-align -msep-data -mno-sep-data -mshared-library-id=n -mid-shared-library -mno-id-shared-library -mxgot -mno-xgot M68hc1x Options -m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 -mauto-incdec -minmax -mlong-calls -mshort -msoft-reg-count=count MCore Options -mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields -m4byte-functions -mno-4byte-functions -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 -mips64r2 -mips16 -mno-mips16 -mflip-mips16 -minterlink-mips16 -mno-interlink-mips16 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float -msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mfpu=fpu-type -msmartmips -mno-smartmips -mpaired-single -mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc -mlong64 -mlong32 -msym32 -mno-sym32 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt -membedded-data -mno-embedded-data -muninit-const-in-rodata -mno-uninit-const-in-rodata -mcode-readable=setting -msplit-addresses -mno-split-addresses -mexplicit-relocs -mno-explicit-relocs -mcheck-zero-division -mno-check-zero-division -mdivide-traps -mdivide-breaks -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls -mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 -mfix-r10000 -mno-fix-r10000 -mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 -mflush-func=func -mno-flush-func -mbranch-cost=num -mbranch-likely -mno-branch-likely -mfp-exceptions -mno-fp-exceptions -mvr4130-align -mno-vr4130-align MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols -melf -mbranch-predict -mno-branch-predict -mbase-addresses -mno-base-addresses -msingle-exit -mno-single-exit MN10300 Options -mmult-bug -mno-mult-bug -mam33 -mno-am33 -mam33-2 -mno-am33-2 -mreturn-pointer-on-d0 -mno-crt0 -mrelax PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 -mbcopy -mbcopy-builtin -mint32 -mno-int16 -mint16 -mno-int32 -mfloat32 -mno-float64 -mfloat64 -mno-float32 -mabshi -mno-abshi -mbranch-expensive -mbranch-cheap -msplit -mno-split -munix-asm -mdec-asm picoChip Options -mae=ae_type -mvliw-lookahead=N -msymbol-as-address -mno-inefficient-warnings PowerPC Options See RS/6000 and PowerPC Options. RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model -mpower -mno-power -mpower2 -mno-power2 -mpowerpc -mpowerpc64 -mno-powerpc -maltivec -mno-altivec -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp -mnew-mnemonics -mold-mnemonics -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float -mhard-float -mmultiple -mno-multiple -msingle-float -mdouble-float -msimple-fpu -mstring -mno-string -mupdate -mno-update -mavoid-indexed-addresses -mno-avoid-indexed-addresses -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -maltivec -mswdiv -mprioritize-restricted-insns=priority -msched-costly-dep=dependence_type -minsert-sched-nops=scheme -mcall-sysv -mcall-netbsd -maix-struct-return -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt -misel -mno-isel -misel=yes -misel=no -mspe -mno-spe -mspe=yes -mspe=no -mpaired -mgen-cell-microcode -mwarn-cell-microcode -mvrsave -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double -mprototype -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata -msdata=opt -mvxworks -G num -pthread S/390 and zSeries Options -mtune=cpu-type -march=cpu-type -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard -mhotpatch=halfwords,halfwords Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u -mscore7 -mscore7d SH Options -m1 -m2 -m2e -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -m5-64media -m5-64media-nofpu -m5-32media -m5-32media-nofpu -m5-compact -m5-compact-nofpu -mb -ml -mdalign -mrelax -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave -mieee -mbitops -misize -minline-ic_invalidate -mpadstruct -mspace -mprefergot -musermode -multcost=number -mdiv=strategy -mdivsi3_libfunc=name -mfixed-range=register-range -madjust-unroll -mindexed-addressing -mgettrcost=number -mpt-fixed -minvalid-symbols SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model -m32 -m64 -mapp-regs -mno-app-regs -mfaster-structs -mno-faster-structs -mfpu -mno-fpu -mhard-float -msoft-float -mhard-quad-float -msoft-quad-float -mimpure-text -mno-impure-text -mlittle-endian -mstack-bias -mno-stack-bias -munaligned-doubles -mno-unaligned-doubles -mv8plus -mno-v8plus -mvis -mno-vis -threads -pthreads -pthread SPU Options -mwarn-reloc -merror-reloc -msafe-dma -munsafe-dma -mbranch-hints -msmall-mem -mlarge-mem -mstdmain -mfixed-range=register-range System V Options -Qy -Qn -YP,paths -Ym,dir V850 Options -mlong-calls -mno-long-calls -mep -mno-ep -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n -mzda=n -mapp-regs -mno-app-regs -mdisable-callt -mno-disable-callt -mv850e1 -mv850e -mv850 -mbig-switch VAX Options -mg -mgnu -munix VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy -Xbind-now x86-64 Options See i386 and x86-64 Options. Xstormy16 Options -msim Xtensa Options -mconst16 -mno-const16 -mfused-madd -mno-fused-madd -mserialize-volatile -mno-serialize-volatile -mtext-section-literals -mno-text-section-literals -mtarget-align -mno-target-align -mlongcalls -mno-longcalls zSeries Options See S/390 and zSeries Options. Code Generation Options -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions -fnon-call-exceptions -funwind-tables -fasynchronous-unwind-tables -finhibit-size-directive -finstrument-functions -finstrument-functions-exclude-function-list=sym,sym,... -finstrument-functions-exclude-file-list=file,file,... -fno-common -fno-ident -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-jump-tables -frecord-gcc-switches -freg-struct-return -fshort-enums -fshort-double -fshort-wchar -fverbose-asm -fpack-struct[=n] -fstack-check -fstack-limit-register=reg -fstack-limit-symbol=sym -fno-stack-limit -fargument-alias -fargument-noalias -fargument-noalias-global -fargument-noalias-anything -fleading-underscore -ftls-model=model -ftrapv -fwrapv -fbounds-check -fvisibility Options Controlling the Kind of Output Compilation can involve up to four stages: preprocessing, compilation proper, assembly and linking, always in that order. GCC is capable of preprocessing and compiling several files either into several assembler input files, or into one assembler input file; then each assembler input file produces an object file, and linking combines all the object files (those newly compiled, and those specified as input) into an executable file. For any given input file, the file name suffix determines what kind of compilation is done: file.c C source code which must be preprocessed. file.i C source code which should not be preprocessed. file.ii C++ source code which should not be preprocessed. file.m Objective-C source code. Note that you must link with the libobjc library to make an Objective-C program work. file.mi Objective-C source code which should not be preprocessed. file.mm file.M Objective-C++ source code. Note that you must link with the libobjc library to make an Objective-C++ program work. Note that .M refers to a literal capital M. file.mii Objective-C++ source code which should not be preprocessed. file.h C, C++, Objective-C or Objective-C++ header file to be turned into a precompiled header. file.cc file.cp file.cxx file.cpp file.CPP file.c++ file.C C++ source code which must be preprocessed. Note that in .cxx, the last two letters must both be literally x. Likewise, .C refers to a literal capital C. file.mm file.M Objective-C++ source code which must be preprocessed. file.mii Objective-C++ source code which should not be preprocessed. file.hh file.H file.hp file.hxx file.hpp file.HPP file.h++ file.tcc C++ header file to be turned into a precompiled header. file.f file.for file.ftn Fixed form Fortran source code which should not be preprocessed. file.F file.FOR file.fpp file.FPP file.FTN Fixed form Fortran source code which must be preprocessed (with the traditional preprocessor). file.f90 file.f95 file.f03 file.f08 Free form Fortran source code which should not be preprocessed. file.F90 file.F95 file.F03 file.F08 Free form Fortran source code which must be preprocessed (with the traditional preprocessor). file.ads Ada source code file which contains a library unit declaration (a declaration of a package, subprogram, or generic, or a generic instantiation), or a library unit renaming declaration (a package, generic, or subprogram renaming declaration). Such files are also called specs. file.adb Ada source code file containing a library unit body (a subprogram or package body). Such files are also called bodies. file.s Assembler code. file.S file.sx Assembler code which must be preprocessed. other An object file to be fed straight into linking. Any file name with no recognized suffix is treated this way. You can specify the input language explicitly with the -x option: -x language Specify explicitly the language for the following input files (rather than letting the compiler choose a default based on the file name suffix). This option applies to all following input files until the next -x option. Possible values for language are: c c-header c-cpp-output c++ c++-header c++-cpp-output objective-c objective-c-header objective-c-cpp-output objective-c++ objective-c++-header objective-c++-cpp-output assembler assembler-with-cpp ada f77 f77-cpp-input f95 f95-cpp-input java -x none Turn off any specification of a language, so that subsequent files are handled according to their file name suffixes (as they are if -x has not been used at all). -pass-exit-codes Normally the gcc program will exit with the code of 1 if any phase of the compiler returns a non-success return code. If you specify -pass-exit-codes, the gcc program will instead return with numerically highest error produced by any phase that returned an error indication. The C, C++, and Fortran frontends return 4, if an internal compiler error is encountered. If you only want some of the stages of compilation, you can use -x (or filename suffixes) to tell gcc where to start, and one of the options -c, -S, or -E to say where gcc is to stop. Note that some combinations (for example, -x cpp-output -E) instruct gcc to do nothing at all. -c Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file. By default, the object file name for a source file is made by replacing the suffix .c, .i, .s, etc., with .o. Unrecognized input files, not requiring compilation or assembly, are ignored. -S Stop after the stage of compilation proper; do not assemble. The output is in the form of an assembler code file for each non- assembler input file specified. By default, the assembler file name for a source file is made by replacing the suffix .c, .i, etc., with .s. Input files that don’t require compilation are ignored. -E Stop after the preprocessing stage; do not run the compiler proper. The output is in the form of preprocessed source code, which is sent to the standard output. Input files which don’t require preprocessing are ignored. -o file Place output in file file. This applies regardless to whatever sort of output is being produced, whether it be an executable file, an object file, an assembler file or preprocessed C code. If -o is not specified, the default is to put an executable file in a.out, the object file for source.suffix in source.o, its assembler file in source.s, a precompiled header file in source.suffix.gch, and all preprocessed C source on standard output. -v Print (on standard error output) the commands executed to run the stages of compilation. Also print the version number of the compiler driver program and of the preprocessor and the compiler proper. -### Like -v except the commands are not executed and all command arguments are quoted. This is useful for shell scripts to capture the driver-generated command lines. -pipe Use pipes rather than temporary files for communication between the various stages of compilation. This fails to work on some systems where the assembler is unable to read from a pipe; but the GNU assembler has no trouble. -combine If you are compiling multiple source files, this option tells the driver to pass all the source files to the compiler at once (for those languages for which the compiler can handle this). This will allow intermodule analysis (IMA) to be performed by the compiler. Currently the only language for which this is supported is C. If you pass source files for multiple languages to the driver, using this option, the driver will invoke the compiler(s) that support IMA once each, passing each compiler all the source files appropriate for it. For those languages that do not support IMA this option will be ignored, and the compiler will be invoked once for each source file in that language. If you use this option in conjunction with -save-temps, the compiler will generate multiple pre-processed files (one for each source file), but only one (combined) .o or .s file. --help Print (on the standard output) a description of the command line options understood by gcc. If the -v option is also specified then --help will also be passed on to the various processes invoked by gcc, so that they can display the command line options they accept. If the -Wextra option has also been specified (prior to the --help option), then command line options which have no documentation associated with them will also be displayed. --target-help Print (on the standard output) a description of target-specific command line options for each tool. For some targets extra target- specific information may also be printed. --help={class|[^]qualifier}[,...] Print (on the standard output) a description of the command line options understood by the compiler that fit into all specified classes and qualifiers. These are the supported classes: optimizers This will display all of the optimization options supported by the compiler. warnings This will display all of the options controlling warning messages produced by the compiler. target This will display target-specific options. Unlike the --target-help option however, target-specific options of the linker and assembler will not be displayed. This is because those tools do not currently support the extended --help= syntax. params This will display the values recognized by the --param option. language This will display the options supported for language, where language is the name of one of the languages supported in this version of GCC. common This will display the options that are common to all languages. These are the supported qualifiers: undocumented Display only those options which are undocumented. joined Display options which take an argument that appears after an equal sign in the same continuous piece of text, such as: --help=target. separate Display options which take an argument that appears as a separate word following the original option, such as: -o output-file. Thus for example to display all the undocumented target-specific switches supported by the compiler the following can be used: --help=target,undocumented The sense of a qualifier can be inverted by prefixing it with the ^ character, so for example to display all binary warning options (i.e., ones that are either on or off and that do not take an argument), which have a description the following can be used: --help=warnings,^joined,^undocumented The argument to --help= should not consist solely of inverted qualifiers. Combining several classes is possible, although this usually restricts the output by so much that there is nothing to display. One case where it does work however is when one of the classes is target. So for example to display all the target-specific optimization options the following can be used: --help=target,optimizers The --help= option can be repeated on the command line. Each successive use will display its requested class of options, skipping those that have already been displayed. If the -Q option appears on the command line before the --help= option, then the descriptive text displayed by --help= is changed. Instead of describing the displayed options, an indication is given as to whether the option is enabled, disabled or set to a specific value (assuming that the compiler knows this at the point where the --help= option is used). Here is a truncated example from the ARM port of gcc: % gcc -Q -mabi=2 --help=target -c The following options are target specific: -mabi= 2 -mabort-on-noreturn [disabled] -mapcs [disabled] The output is sensitive to the effects of previous command line options, so for example it is possible to find out which optimizations are enabled at -O2 by using: -Q -O2 --help=optimizers Alternatively you can discover which binary optimizations are enabled by -O3 by using: gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts diff /tmp/O2-opts /tmp/O3-opts | grep enabled --version Display the version number and copyrights of the invoked GCC. -wrapper Invoke all subcommands under a wrapper program. It takes a single comma separated list as an argument, which will be used to invoke the wrapper: gcc -c t.c -wrapper gdb,--args This will invoke all subprograms of gcc under "gdb --args", thus cc1 invocation will be "gdb --args cc1 ...". @file Read command-line options from file. The options read are inserted in place of the original @file option. If file does not exist, or cannot be read, then the option will be treated literally, and not removed. Options in file are separated by whitespace. A whitespace character may be included in an option by surrounding the entire option in either single or double quotes. Any character (including a backslash) may be included by prefixing the character to be included with a backslash. The file may itself contain additional @file options; any such options will be processed recursively. Compiling C++ Programs C++ source files conventionally use one of the suffixes .C, .cc, .cpp, .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or (for shared template code) .tcc; and preprocessed C++ files use the suffix .ii. GCC recognizes files with these names and compiles them as C++ programs even if you call the compiler the same way as for compiling C programs (usually with the name gcc). However, the use of gcc does not add the C++ library. g++ is a program that calls GCC and treats .c, .h and .i files as C++ source files instead of C source files unless -x is used, and automatically specifies linking against the C++ library. This program is also useful when precompiling a C header file with a .h extension for use in C++ compilations. On many systems, g++ is also installed with the name c++. When you compile C++ programs, you may specify many of the same command-line options that you use for compiling programs in any language; or command-line options meaningful for C and related languages; or options that are meaningful only for C++ programs. Options Controlling C Dialect The following options control the dialect of C (or languages derived from C, such as C++, Objective-C and Objective-C++) that the compiler accepts: -ansi In C mode, this is equivalent to -std=c89. In C++ mode, it is equivalent to -std=c++98. This turns off certain features of GCC that are incompatible with ISO C90 (when compiling C code), or of standard C++ (when compiling C++ code), such as the "asm" and "typeof" keywords, and predefined macros such as "unix" and "vax" that identify the type of system you are using. It also enables the undesirable and rarely used ISO trigraph feature. For the C compiler, it disables recognition of C++ style // comments as well as the "inline" keyword. The alternate keywords "__asm__", "__extension__", "__inline__" and "__typeof__" continue to work despite -ansi. You would not want to use them in an ISO C program, of course, but it is useful to put them in header files that might be included in compilations done with -ansi. Alternate predefined macros such as "__unix__" and "__vax__" are also available, with or without -ansi. The -ansi option does not cause non-ISO programs to be rejected gratuitously. For that, -pedantic is required in addition to -ansi. The macro "__STRICT_ANSI__" is predefined when the -ansi option is used. Some header files may notice this macro and refrain from declaring certain functions or defining certain macros that the ISO standard doesn’t call for; this is to avoid interfering with any programs that might use these names for other things. Functions that would normally be built in but do not have semantics defined by ISO C (such as "alloca" and "ffs") are not built-in functions when -ansi is used. -std= Determine the language standard. This option is currently only supported when compiling C or C++. The compiler can accept several base standards, such as c89 or c++98, and GNU dialects of those standards, such as gnu89 or gnu++98. By specifying a base standard, the compiler will accept all programs following that standard and those using GNU extensions that do not contradict it. For example, -std=c89 turns off certain features of GCC that are incompatible with ISO C90, such as the "asm" and "typeof" keywords, but not other GNU extensions that do not have a meaning in ISO C90, such as omitting the middle term of a "?:" expression. On the other hand, by specifying a GNU dialect of a standard, all features the compiler support are enabled, even when those features change the meaning of the base standard and some strict-conforming programs may be rejected. The particular standard is used by -pedantic to identify which features are GNU extensions given that version of the standard. For example -std=gnu89 -pedantic would warn about C++ style // comments, while -std=gnu99 -pedantic would not. A value for this option must be provided; possible values are c89 iso9899:1990 Support all ISO C90 programs (certain GNU extensions that conflict with ISO C90 are disabled). Same as -ansi for C code. iso9899:199409 ISO C90 as modified in amendment 1. c99 c9x iso9899:1999 iso9899:199x ISO C99. Note that this standard is not yet fully supported; see for more information. The names c9x and iso9899:199x are deprecated. gnu89 GNU dialect of ISO C90 (including some C99 features). This is the default for C code. gnu99 gnu9x GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC, this will become the default. The name gnu9x is deprecated. c++98 The 1998 ISO C++ standard plus amendments. Same as -ansi for C++ code. gnu++98 GNU dialect of -std=c++98. This is the default for C++ code. c++0x The working draft of the upcoming ISO C++0x standard. This option enables experimental features that are likely to be included in C++0x. The working draft is constantly changing, and any feature that is enabled by this flag may be removed from future versions of GCC if it is not part of the C++0x standard. gnu++0x GNU dialect of -std=c++0x. This option enables experimental features that may be removed in future versions of GCC. -fgnu89-inline The option -fgnu89-inline tells GCC to use the traditional GNU semantics for "inline" functions when in C99 mode. This option is accepted and ignored by GCC versions 4.1.3 up to but not including 4.3. In GCC versions 4.3 and later it changes the behavior of GCC in C99 mode. Using this option is roughly equivalent to adding the "gnu_inline" function attribute to all inline functions. The option -fno-gnu89-inline explicitly tells GCC to use the C99 semantics for "inline" when in C99 or gnu99 mode (i.e., it specifies the default behavior). This option was first supported in GCC 4.3. This option is not supported in C89 or gnu89 mode. The preprocessor macros "__GNUC_GNU_INLINE__" and "__GNUC_STDC_INLINE__" may be used to check which semantics are in effect for "inline" functions. -aux-info filename Output to the given filename prototyped declarations for all functions declared and/or defined in a translation unit, including those in header files. This option is silently ignored in any language other than C. Besides declarations, the file indicates, in comments, the origin of each declaration (source file and line), whether the declaration was implicit, prototyped or unprototyped (I, N for new or O for old, respectively, in the first character after the line number and the colon), and whether it came from a declaration or a definition (C or F, respectively, in the following character). In the case of function definitions, a K&R-style list of arguments followed by their declarations is also provided, inside comments, after the declaration. -fno-asm Do not recognize "asm", "inline" or "typeof" as a keyword, so that code can use these words as identifiers. You can use the keywords "__asm__", "__inline__" and "__typeof__" instead. -ansi implies -fno-asm. In C++, this switch only affects the "typeof" keyword, since "asm" and "inline" are standard keywords. You may want to use the -fno-gnu-keywords flag instead, which has the same effect. In C99 mode (-std=c99 or -std=gnu99), this switch only affects the "asm" and "typeof" keywords, since "inline" is a standard keyword in ISO C99. -fno-builtin -fno-builtin-function Don’t recognize built-in functions that do not begin with __builtin_ as prefix. GCC normally generates special code to handle certain built-in functions more efficiently; for instance, calls to "alloca" may become single instructions that adjust the stack directly, and calls to "memcpy" may become inline copy loops. The resulting code is often both smaller and faster, but since the function calls no longer appear as such, you cannot set a breakpoint on those calls, nor can you change the behavior of the functions by linking with a different library. In addition, when a function is recognized as a built-in function, GCC may use information about that function to warn about problems with calls to that function, or to generate more efficient code, even if the resulting code still contains calls to that function. For example, warnings are given with -Wformat for bad calls to "printf", when "printf" is built in, and "strlen" is known not to modify global memory. With the -fno-builtin-function option only the built-in function function is disabled. function must not begin with __builtin_. If a function is named that is not built-in in this version of GCC, this option is ignored. There is no corresponding -fbuiltin-function option; if you wish to enable built-in functions selectively when using -fno-builtin or -ffreestanding, you may define macros such as: #define abs(n) __builtin_abs ((n)) #define strcpy(d, s) __builtin_strcpy ((d), (s)) -fhosted Assert that compilation takes place in a hosted environment. This implies -fbuiltin. A hosted environment is one in which the entire standard library is available, and in which "main" has a return type of "int". Examples are nearly everything except a kernel. This is equivalent to -fno-freestanding. -ffreestanding Assert that compilation takes place in a freestanding environment. This implies -fno-builtin. A freestanding environment is one in which the standard library may not exist, and program startup may not necessarily be at "main". The most obvious example is an OS kernel. This is equivalent to -fno-hosted. -fopenmp Enable handling of OpenMP directives "#pragma omp" in C/C++ and "!$omp" in Fortran. When -fopenmp is specified, the compiler generates parallel code according to the OpenMP Application Program Interface v2.5 . This option implies -pthread, and thus is only supported on targets that have support for -pthread. -fms-extensions Accept some non-standard constructs used in Microsoft header files. Some cases of unnamed fields in structures and unions are only accepted with this option. -trigraphs Support ISO C trigraphs. The -ansi option (and -std options for strict ISO C conformance) implies -trigraphs. -no-integrated-cpp Performs a compilation in two passes: preprocessing and compiling. This option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the -B option. The user supplied compilation step can then add in an additional preprocessing step after normal preprocessing but before compiling. The default is to use the integrated cpp (internal cpp) The semantics of this option will change if "cc1", "cc1plus", and "cc1obj" are merged. -traditional -traditional-cpp Formerly, these options caused GCC to attempt to emulate a pre- standard C compiler. They are now only supported with the -E switch. The preprocessor continues to support a pre-standard mode. See the GNU CPP manual for details. -fcond-mismatch Allow conditional expressions with mismatched types in the second and third arguments. The value of such an expression is void. This option is not supported for C++. -flax-vector-conversions Allow implicit conversions between vectors with differing numbers of elements and/or incompatible element types. This option should not be used for new code. -funsigned-char Let the type "char" be unsigned, like "unsigned char". Each kind of machine has a default for what "char" should be. It is either like "unsigned char" by default or like "signed char" by default. Ideally, a portable program should always use "signed char" or "unsigned char" when it depends on the signedness of an object. But many programs have been written to use plain "char" and expect it to be signed, or expect it to be unsigned, depending on the machines they were written for. This option, and its inverse, let you make such a program work with the opposite default. The type "char" is always a distinct type from each of "signed char" or "unsigned char", even though its behavior is always just like one of those two. -fsigned-char Let the type "char" be signed, like "signed char". Note that this is equivalent to -fno-unsigned-char, which is the negative form of -funsigned-char. Likewise, the option -fno-signed-char is equivalent to -funsigned-char. -fsigned-bitfields -funsigned-bitfields -fno-signed-bitfields -fno-unsigned-bitfields These options control whether a bit-field is signed or unsigned, when the declaration does not use either "signed" or "unsigned". By default, such a bit-field is signed, because this is consistent: the basic integer types such as "int" are signed types. Options Controlling C++ Dialect This section describes the command-line options that are only meaningful for C++ programs; but you can also use most of the GNU compiler options regardless of what language your program is in. For example, you might compile a file "firstClass.C" like this: g++ -g -frepo -O -c firstClass.C In this example, only -frepo is an option meant only for C++ programs; you can use the other options with any language supported by GCC. Here is a list of options that are only for compiling C++ programs: -fabi-version=n Use version n of the C++ ABI. Version 2 is the version of the C++ ABI that first appeared in G++ 3.4. Version 1 is the version of the C++ ABI that first appeared in G++ 3.2. Version 0 will always be the version that conforms most closely to the C++ ABI specification. Therefore, the ABI obtained using version 0 will change as ABI bugs are fixed. The default is version 2. -fno-access-control Turn off all access checking. This switch is mainly useful for working around bugs in the access control code. -fcheck-new Check that the pointer returned by "operator new" is non-null before attempting to modify the storage allocated. This check is normally unnecessary because the C++ standard specifies that "operator new" will only return 0 if it is declared throw(), in which case the compiler will always check the return value even without this option. In all other cases, when "operator new" has a non-empty exception specification, memory exhaustion is signalled by throwing "std::bad_alloc". See also new (nothrow). -fconserve-space Put uninitialized or runtime-initialized global variables into the common segment, as C does. This saves space in the executable at the cost of not diagnosing duplicate definitions. If you compile with this flag and your program mysteriously crashes after "main()" has completed, you may have an object that is being destroyed twice because two definitions were merged. This option is no longer useful on most targets, now that support has been added for putting variables into BSS without making them common. -fno-deduce-init-list Disable deduction of a template type parameter as std::initializer_list from a brace-enclosed initializer list, i.e. template auto forward(T t) -> decltype (realfn (t)) { return realfn (t); } void f() { forward({1,2}); // call forward> } This option is present because this deduction is an extension to the current specification in the C++0x working draft, and there was some concern about potential overload resolution problems. -ffriend-injection Inject friend functions into the enclosing namespace, so that they are visible outside the scope of the class in which they are declared. Friend functions were documented to work this way in the old Annotated C++ Reference Manual, and versions of G++ before 4.1 always worked that way. However, in ISO C++ a friend function which is not declared in an enclosing scope can only be found using argument dependent lookup. This option causes friends to be injected as they were in earlier releases. This option is for compatibility, and may be removed in a future release of G++. -fno-elide-constructors The C++ standard allows an implementation to omit creating a temporary which is only used to initialize another object of the same type. Specifying this option disables that optimization, and forces G++ to call the copy constructor in all cases. -fno-enforce-eh-specs Don’t generate code to check for violation of exception specifications at runtime. This option violates the C++ standard, but may be useful for reducing code size in production builds, much like defining NDEBUG. This does not give user code permission to throw exceptions in violation of the exception specifications; the compiler will still optimize based on the specifications, so throwing an unexpected exception will result in undefined behavior. -ffor-scope -fno-for-scope If -ffor-scope is specified, the scope of variables declared in a for-init-statement is limited to the for loop itself, as specified by the C++ standard. If -fno-for-scope is specified, the scope of variables declared in a for-init-statement extends to the end of the enclosing scope, as was the case in old versions of G++, and other (traditional) implementations of C++. The default if neither flag is given to follow the standard, but to allow and give a warning for old-style code that would otherwise be invalid, or have different behavior. -fno-gnu-keywords Do not recognize "typeof" as a keyword, so that code can use this word as an identifier. You can use the keyword "__typeof__" instead. -ansi implies -fno-gnu-keywords. -fno-implicit-templates Never emit code for non-inline templates which are instantiated implicitly (i.e. by use); only emit code for explicit instantiations. -fno-implicit-inline-templates Don’t emit code for implicit instantiations of inline templates, either. The default is to handle inlines differently so that compiles with and without optimization will need the same set of explicit instantiations. -fno-implement-inlines To save space, do not emit out-of-line copies of inline functions controlled by #pragma implementation. This will cause linker errors if these functions are not inlined everywhere they are called. -fms-extensions Disable pedantic warnings about constructs used in MFC, such as implicit int and getting a pointer to member function via non- standard syntax. -fno-nonansi-builtins Disable built-in declarations of functions that are not mandated by ANSI/ISO C. These include "ffs", "alloca", "_exit", "index", "bzero", "conjf", and other related functions. -fno-operator-names Do not treat the operator name keywords "and", "bitand", "bitor", "compl", "not", "or" and "xor" as synonyms as keywords. -fno-optional-diags Disable diagnostics that the standard says a compiler does not need to issue. Currently, the only such diagnostic issued by G++ is the one for a name having multiple meanings within a class. -fpermissive Downgrade some diagnostics about nonconformant code from errors to warnings. Thus, using -fpermissive will allow some nonconforming code to compile. -frepo Enable automatic template instantiation at link time. This option also implies -fno-implicit-templates. -fno-rtti Disable generation of information about every class with virtual functions for use by the C++ runtime type identification features (dynamic_cast and typeid). If you don’t use those parts of the language, you can save some space by using this flag. Note that exception handling uses the same information, but it will generate it as needed. The dynamic_cast operator can still be used for casts that do not require runtime type information, i.e. casts to "void *" or to unambiguous base classes. -fstats Emit statistics about front-end processing at the end of the compilation. This information is generally only useful to the G++ development team. -fstrict-enums Allow the compiler to optimize using the assumption that a value of enumeration type can only be one of the values of the enumeration (as defined in the C++ standard; basically, a value which can be represented in the minimum number of bits needed to represent all the enumerators). This assumption may not be valid if the program uses a cast to convert an arbitrary integer value to the enumeration type. -ftemplate-depth-n Set the maximum instantiation depth for template classes to n. A limit on the template instantiation depth is needed to detect endless recursions during template class instantiation. ANSI/ISO C++ conforming programs must not rely on a maximum depth greater than 17. -fno-threadsafe-statics Do not emit the extra code to use the routines specified in the C++ ABI for thread-safe initialization of local statics. You can use this option to reduce code size slightly in code that doesn’t need to be thread-safe. -fuse-cxa-atexit Register destructors for objects with static storage duration with the "__cxa_atexit" function rather than the "atexit" function. This option is required for fully standards-compliant handling of static destructors, but will only work if your C library supports "__cxa_atexit". -fno-use-cxa-get-exception-ptr Don’t use the "__cxa_get_exception_ptr" runtime routine. This will cause "std::uncaught_exception" to be incorrect, but is necessary if the runtime routine is not available. -fvisibility-inlines-hidden This switch declares that the user does not attempt to compare pointers to inline methods where the addresses of the two functions were taken in different shared objects. The effect of this is that GCC may, effectively, mark inline methods with "__attribute__ ((visibility ("hidden")))" so that they do not appear in the export table of a DSO and do not require a PLT indirection when used within the DSO. Enabling this option can have a dramatic effect on load and link times of a DSO as it massively reduces the size of the dynamic export table when the library makes heavy use of templates. The behavior of this switch is not quite the same as marking the methods as hidden directly, because it does not affect static variables local to the function or cause the compiler to deduce that the function is defined in only one shared object. You may mark a method as having a visibility explicitly to negate the effect of the switch for that method. For example, if you do want to compare pointers to a particular inline method, you might mark it as having default visibility. Marking the enclosing class with explicit visibility will have no effect. Explicitly instantiated inline methods are unaffected by this option as their linkage might otherwise cross a shared library boundary. -fvisibility-ms-compat This flag attempts to use visibility settings to make GCC’s C++ linkage model compatible with that of Microsoft Visual Studio. The flag makes these changes to GCC’s linkage model: 1. It sets the default visibility to "hidden", like -fvisibility=hidden. 2. Types, but not their members, are not hidden by default. 3. The One Definition Rule is relaxed for types without explicit visibility specifications which are defined in more than one different shared object: those declarations are permitted if they would have been permitted when this option was not used. In new code it is better to use -fvisibility=hidden and export those classes which are intended to be externally visible. Unfortunately it is possible for code to rely, perhaps accidentally, on the Visual Studio behavior. Among the consequences of these changes are that static data members of the same type with the same name but defined in different shared objects will be different, so changing one will not change the other; and that pointers to function members defined in different shared objects may not compare equal. When this flag is given, it is a violation of the ODR to define types with the same name differently. -fno-weak Do not use weak symbol support, even if it is provided by the linker. By default, G++ will use weak symbols if they are available. This option exists only for testing, and should not be used by end-users; it will result in inferior code and has no benefits. This option may be removed in a future release of G++. -nostdinc++ Do not search for header files in the standard directories specific to C++, but do still search the other standard directories. (This option is used when building the C++ library.) In addition, these optimization, warning, and code generation options have meanings only for C++ programs: -fno-default-inline Do not assume inline for functions defined inside a class scope. Note that these functions will have linkage like inline functions; they just won’t be inlined by default. -Wabi (C, Objective-C, C++ and Objective-C++ only) Warn when G++ generates code that is probably not compatible with the vendor-neutral C++ ABI. Although an effort has been made to warn about all such cases, there are probably some cases that are not warned about, even though G++ is generating incompatible code. There may also be cases where warnings are emitted even though the code that is generated will be compatible. You should rewrite your code to avoid these warnings if you are concerned about the fact that code generated by G++ may not be binary compatible with code generated by other compilers. The known incompatibilities at this point include: · Incorrect handling of tail-padding for bit-fields. G++ may attempt to pack data into the same byte as a base class. For example: struct A { virtual void f(); int f1 : 1; }; struct B : public A { int f2 : 1; }; In this case, G++ will place "B::f2" into the same byte as"A::f1"; other compilers will not. You can avoid this problem by explicitly padding "A" so that its size is a multiple of the byte size on your platform; that will cause G++ and other compilers to layout "B" identically. · Incorrect handling of tail-padding for virtual bases. G++ does not use tail padding when laying out virtual bases. For example: struct A { virtual void f(); char c1; }; struct B { B(); char c2; }; struct C : public A, public virtual B {}; In this case, G++ will not place "B" into the tail-padding for "A"; other compilers will. You can avoid this problem by explicitly padding "A" so that its size is a multiple of its alignment (ignoring virtual base classes); that will cause G++ and other compilers to layout "C" identically. · Incorrect handling of bit-fields with declared widths greater than that of their underlying types, when the bit-fields appear in a union. For example: union U { int i : 4096; }; Assuming that an "int" does not have 4096 bits, G++ will make the union too small by the number of bits in an "int". · Empty classes can be placed at incorrect offsets. For example: struct A {}; struct B { A a; virtual void f (); }; struct C : public B, public A {}; G++ will place the "A" base class of "C" at a nonzero offset; it should be placed at offset zero. G++ mistakenly believes that the "A" data member of "B" is already at offset zero. · Names of template functions whose types involve "typename" or template template parameters can be mangled incorrectly. template void f(typename Q::X) {} template