Loose-Info.com
Last Update 2021/03/10
TOP - 各種テスト - gcc - -fno-diagnostics-show-option オプション

-fno-diagnostics-show-option オプション
デフォルトで付加される診断を制御するコマンドラインオプションを示すテキストを出力しない

テスト概要

-fno-diagnostics-show-option オプション有りと無しの場合を比較

実行環境

GCC-8.2.0
GNU C Library 2.28
GNU Binutils 2.31.1


コード例・出力内容中の表記

・実行例中の太字表記部分は、コマンドなどの入力された文字列を示します。
・「」や「...」の着色省略表記は、 実際のソースコードや出力内容などを省略加工した部分を示します。

使用ファイル

main.c
/* -fno-diagnostics-show-option オプション動作確認用ソースファイル */ #include <stdio.h> int main(void) { struct { struct {int i1, i2;}; } sx; sx.i1 = n * 2; sx.i2 = n * 3; printf("sx.i1 = %d : sx.i2 = %d\n", sx.i1, sx.i2); prinnntf("Error!!!\n"); return 0; }

動作テスト

-fno-diagnostics-show-optionオプション無しでコンパイル
着色部は、関係するコマンドラインオプションに関する出力
$ gcc -std=c99 -Wpedantic main.c main.c: In function ‘main’: main.c:9:23: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic] struct {int i1, i2;}; ^ main.c:7:2: warning: struct has no named members [-Wpedantic] struct ^~~~~~ main.c:12:10: error: ‘n’ undeclared (first use in this function) sx.i1 = n * 2; ^ main.c:12:10: note: each undeclared identifier is reported only once for each function it appears in main.c:17:5: warning: implicit declaration of function ‘prinnntf’; did you mean ‘printf’? [-Wimplicit-function-declaration] prinnntf("Error!!!\n"); ^~~~~~~~ printf $

-fno-diagnostics-show-optionオプション有りでコンパイル
$ gcc -std=c99 -Wpedantic -fno-diagnostics-show-option main.c main.c: In function ‘main’: main.c:9:23: warning: ISO C99 doesn’t support unnamed structs/unions struct {int i1, i2;}; ^ main.c:7:2: warning: struct has no named members struct ^~~~~~ main.c:12:10: error: ‘n’ undeclared (first use in this function) sx.i1 = n * 2; ^ main.c:12:10: note: each undeclared identifier is reported only once for each function it appears in main.c:17:5: warning: implicit declaration of function ‘prinnntf’; did you mean ‘printf’? prinnntf("Error!!!\n"); ^~~~~~~~ printf $ コマンドラインオプションに関する文字列は出力されない