Last Update 2020/11/28
-std=gnu90
-std=gnu89
-std=gnu89
言語標準をgnu90(gnu89)としてコンパイル
テスト概要
C++スタイルのコメントとtypeofが含まれるコードをコンパイル
-std=オプションに c90 を指定してコンパイル実行
FAIL
C++スタイルコメント、typeofに関するエラー発生・停止
-std=オプションに gnu90 を指定してコンパイル実行
WARNING
警告のみでコンパイル終了・実行ファイル生成
-std=オプションに c99 を指定してコンパイル実行
FAIL
typeofに関するエラー発生・停止
-std=オプションに gnu99 を指定してコンパイル実行
PASS
コンパイル終了・実行ファイル生成
Digraph(ダイグラフ)とtypeofを使用したコードをコンパイル
-std=オプションに c90 を指定してコンパイル実行
FAIL
typeof、Digraphに関するエラー発生・停止
-std=オプションに c99 を指定してコンパイル実行
FAIL
typeofに関するエラー発生・停止
-std=オプションに gnu90 を指定してコンパイル実行
PASS
コンパイル終了・実行ファイル生成
-std=オプションに gnu99 を指定してコンパイル実行
PASS
コンパイル終了・実行ファイル生成
実行環境
GCC-8.2.0
GNU C Library 2.28
GNU Binutils 2.31.1
GNU C Library 2.28
GNU Binutils 2.31.1
コード例・出力内容中の表記
・実行例中の太字表記部分は、コマンドなどの入力された文字列を示します。
・「︙」や「...」の着色省略表記は、 実際のソースコードや出力内容などを省略加工した部分を示します。
・「︙」や「...」の着色省略表記は、 実際のソースコードや出力内容などを省略加工した部分を示します。
C++スタイルのコメントとtypeofが含まれるコードをコンパイル
sample1.c
/* -std=gnu90 オプション動作確認用ソースファイル(1) */
// C++スタイルコメント
#include <stdio.h>
int main(void)
{
int i;
typeof (int *) p; /* typeofの使用 */
i = 100;
p = &i;
printf("-std=gnu90 オプション動作確認用ソースファイル(1)\n");
printf("*p = %d\n", *p);
return 0;
}
-std=オプションに c90 を指定してコンパイル実行
$ gcc -v -Wpedantic -std=c90 sample1.c <--- -WpedanticオプションでISO C で要求される警告を出力
Using built-in specs.
︙
/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/cc1 -quiet -v sample1.c ... -std=c90 ...
︙
GNU C89 (GCC) version 8.2.0 (x86_64-pc-linux-gnu) <--- 規格に関する出力(C89)
compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 84637943c330ccfe91c8483610cbfda9
sample1.c:2:1: error: C++ style comments are not allowed in ISO C90
// C++スタイルコメント C++スタイルコメントに関するエラー
^
sample1.c:2:1: error: (this will be reported only once per input file)
sample1.c: In function ‘main’:
sample1.c:9:10: error: expected expression before ‘int’
typeof (int *) p; /* typeofの使用 */ 以下、typeofに関するエラー
^~~
sample1.c:9:16: error: expected ‘;’ before ‘p’
typeof (int *) p; /* typeofの使用 */
^~
;
sample1.c:12:2: error: ‘p’ undeclared (first use in this function)
p = &i;
^
sample1.c:12:2: note: each undeclared identifier is reported only once for each function it appears in
$ エラー発生・停止
-std=オプションに gnu90 を指定してコンパイル実行
$ gcc -v -Wpedantic -std=gnu90 sample1.c <--- -WpedanticオプションでISO C で要求される警告を出力
Using built-in specs.
︙
/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/cc1 -quiet -v sample1.c ... -std=gnu90 ...
︙
GNU C89 (GCC) version 8.2.0 (x86_64-pc-linux-gnu) <--- 規格に関する出力(C89)
compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 84637943c330ccfe91c8483610cbfda9
sample1.c:2:1: warning: C++ style comments are not allowed in ISO C90
// C++スタイルコメント C++スタイルコメントに関する警告
^
sample1.c:2:1: warning: (this will be reported only once per input file)
COLLECT_GCC_OPTIONS='-v' '-Wpedantic' '-std=gnu90' '-mtune=generic' '-march=x86-64'
as -v --64 -o /tmp/ccJ71kGv.o /tmp/ccmjySlP.s
︙
/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/collect2 ...
COLLECT_GCC_OPTIONS='-v' '-Wpedantic' '-std=gnu90' '-mtune=generic' '-march=x86-64'
$ ./a.out
-std=gnu90 オプション動作確認用ソースファイル(1)
*p = 100
$ 警告のみでコンパイル終了・実行ファイル生成
-std=オプションに c99 を指定してコンパイル実行
$ gcc -v -Wpedantic -std=c99 sample1.c <--- -WpedanticオプションでISO C で要求される警告を出力
Using built-in specs.
︙
/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/cc1 -quiet -v sample1.c ... -std=c99 ...
︙
GNU C99 (GCC) version 8.2.0 (x86_64-pc-linux-gnu) <--- 規格に関する出力(C99)
compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 84637943c330ccfe91c8483610cbfda9
sample1.c: In function ‘main’:
sample1.c:9:2: warning: implicit declaration of function ‘typeof’; did you mean ‘feof’? [-Wimplicit-function-declaration]
typeof (int *) p; /* typeofの使用 */ typeofに関する警告
^~~~~~
feof
sample1.c:9:10: error: expected expression before ‘int’
typeof (int *) p; /* typeofの使用 */ 以下、typeofに関するエラー
^~~
sample1.c:9:16: error: expected ‘;’ before ‘p’
typeof (int *) p; /* typeofの使用 */
^~
;
sample1.c:12:2: error: ‘p’ undeclared (first use in this function)
p = &i;
^
sample1.c:12:2: note: each undeclared identifier is reported only once for each function it appears in
$ エラー発生・停止
-std=オプションに gnu99 を指定してコンパイル実行
$ gcc -v -Wpedantic -std=gnu99 sample1.c <--- -WpedanticオプションでISO C で要求される警告を出力
Using built-in specs.
︙
/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/cc1 -quiet -v sample1.c ... -std=gnu99 ...
︙
GNU C99 (GCC) version 8.2.0 (x86_64-pc-linux-gnu) <--- 規格に関する出力(C99)
compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version none
︙
as -v --64 -o /tmp/cceoCFvP.o /tmp/cccSK6I1.s
︙
/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/collect2 ...
COLLECT_GCC_OPTIONS='-v' '-Wpedantic' '-std=gnu99' '-mtune=generic' '-march=x86-64'
$ ./a.out
-std=gnu90 オプション動作確認用ソースファイル(1)
*p = 100
$
Digraph(ダイグラフ)とtypeofを使用したコードをコンパイル
sample2.c
/* -std=gnu90 オプション動作確認用ソースファイル(2) */
#include <stdio.h>
int main(void)
{
int i;
typeof (int *) p; /* typeofの使用 */
i = 100;
p = &i;
char s[10];
s<:0:> = 'a'; /* Digraphによる記述 */
s[1] = '\0';
printf("-std=gnu90 オプション動作確認用ソースファイル(2)\n");
printf("*p = %d\n", *p);
printf("s = %s\n", s);
return 0;
}
-std=オプションに c90 を指定してコンパイル実行
$ gcc -v -Wpedantic -std=c90 sample2.c <--- -WpedanticオプションでISO C で要求される警告を出力
Using built-in specs.
︙
/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/cc1 -quiet -v sample2.c ... -std=c90 ...
︙
GNU C89 (GCC) version 8.2.0 (x86_64-pc-linux-gnu) <--- 規格に関する出力(C89)
compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 84637943c330ccfe91c8483610cbfda9
sample2.c: In function ‘main’:
sample2.c:10:10: error: expected expression before ‘int’
typeof (int *) p; /* typeofの使用 */ typeofに関するエラー
^~~
sample2.c:10:16: error: expected ‘;’ before ‘p’
typeof (int *) p; /* typeofの使用 */
^~
;
sample2.c:13:2: error: ‘p’ undeclared (first use in this function)
p = &i;
^
sample2.c:13:2: note: each undeclared identifier is reported only once for each function it appears in
sample2.c:15:4: error: expected expression before ‘:’ token
s<:0:> = 'a'; /* Digraphによる記述 */ Digraphに関するエラー
^
$ エラー発生・停止
-std=オプションに c99 を指定してコンパイル実行
$ gcc -v -Wpedantic -std=c99 sample2.c <--- -WpedanticオプションでISO C で要求される警告を出力
Using built-in specs.
︙
/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/cc1 -quiet -v sample2.c ... -std=c99 ...
︙
GNU C99 (GCC) version 8.2.0 (x86_64-pc-linux-gnu) <--- 規格に関する出力(C99)
compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 84637943c330ccfe91c8483610cbfda9
sample2.c: In function ‘main’:
sample2.c:10:2: warning: implicit declaration of function ‘typeof’; did you mean ‘feof’? [-Wimplicit-function-declaration]
typeof (int *) p; /* typeofの使用 */ typeofに関するエラー
^~~~~~
feof
sample2.c:10:10: error: expected expression before ‘int’
typeof (int *) p; /* typeofの使用 */
^~~
sample2.c:10:16: error: expected ‘;’ before ‘p’
typeof (int *) p; /* typeofの使用 */
^~
;
sample2.c:13:2: error: ‘p’ undeclared (first use in this function)
p = &i;
^
sample2.c:13:2: note: each undeclared identifier is reported only once for each function it appears in
$ エラー発生・停止
-std=オプションに gnu90 を指定してコンパイル実行
$ gcc -v -Wpedantic -std=gnu90 sample2.c <--- -WpedanticオプションでISO C で要求される警告を出力
Using built-in specs.
︙
/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/cc1 -quiet -v sample2.c ... -std=gnu90 ...
︙
GNU C89 (GCC) version 8.2.0 (x86_64-pc-linux-gnu) <--- 規格に関する出力(C89)
compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version none
︙
as -v --64 -o /tmp/cca1dfM8.o /tmp/cco7GSVT.s
︙
/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/collect2 ...
COLLECT_GCC_OPTIONS='-v' '-Wpedantic' '-std=gnu90' '-mtune=generic' '-march=x86-64'
$ ./a.out
-std=gnu90 オプション動作確認用ソースファイル(2)
*p = 100
s = a
$ 警告・エラー無し(マニュアルにC99の機能含むとの記載あり)
-std=オプションに gnu99 を指定してコンパイル実行
$ gcc -v -Wpedantic -std=gnu99 sample2.c <--- -WpedanticオプションでISO C で要求される警告を出力
Using built-in specs.
︙
/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/cc1 -quiet -v sample2.c ... -std=gnu99 ...
︙
GNU C99 (GCC) version 8.2.0 (x86_64-pc-linux-gnu) <--- 規格に関する出力(C99)
compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version none
︙
as -v --64 -o /tmp/ccQ9SrmV.o /tmp/cc3Nr6dY.s
︙
/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/collect2 ...
COLLECT_GCC_OPTIONS='-v' '-Wpedantic' '-std=gnu99' '-mtune=generic' '-march=x86-64'
$ ./a.out
-std=gnu90 オプション動作確認用ソースファイル(2)
*p = 100
s = a
$