Loose-Info.com
Last Update 2021/12/18
TOP - 各種テスト - gcc - -d文字 - -dI

-dI
前処理の結果、および#include指令を出力

テスト概要

オプション無し、および-dIオプションを使用した際の出力例

実行環境

GCC-8.2.0
GNU C Library 2.28
GNU Binutils 2.31.1


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

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

使用ファイル


sample.h
#ifndef SAMPLE_H #define SAMPLE_H #include "func.h" #endif /* SAMPLE_H */

sample.c
#include "sample.h" int main(void) { sampFunc(); return 0; }

func.h
#ifndef FUNC_H #define FUNC_H void sampFunc(void); #endif /* FUNC_H */

func.c
#include "func.h" void sampFunc(void) { }

動作テスト


オプション無しで実行した際の出力例
(前処理で停止させるため-Eオプション使用)
$ gcc -E sample.c func.c # 1 "sample.c" # 1 "<built-in>" # 1 "<command-line>" # 31 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 32 "<command-line>" 2 # 1 "sample.c" # 1 "sample.h" 1 # 1 "func.h" 1 void sampFunc(void); # 5 "sample.h" 2 # 2 "sample.c" 2 int main(void) { sampFunc(); return 0; } # 1 "func.c" # 1 "<built-in>" # 1 "<command-line>" # 31 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 32 "<command-line>" 2 # 1 "func.c" # 1 "func.h" 1 void sampFunc(void); # 2 "func.c" 2 void sampFunc(void) { } $ #include指令の出力無し

-dIオプションを使用した際の出力例
(前処理で停止させるため-Eオプション使用)
$ gcc -dI -E sample.c func.c # 1 "sample.c" # 1 "<built-in>" # 1 "<command-line>" # 31 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 32 "<command-line>" 2 # 1 "sample.c" #include "sample.h" # 1 "sample.c" # 1 "sample.h" 1 #include "func.h" # 4 "sample.h" # 1 "func.h" 1 void sampFunc(void); # 5 "sample.h" 2 # 2 "sample.c" 2 int main(void) { sampFunc(); return 0; } # 1 "func.c" # 1 "<built-in>" # 1 "<command-line>" # 31 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 32 "<command-line>" 2 # 1 "func.c" #include "func.h" # 1 "func.c" # 1 "func.h" 1 void sampFunc(void); # 2 "func.c" 2 void sampFunc(void) { } $ #include指令の出力有り