用于模板的 c 预处理器 - 抑制额外的人工制品
c preprocessor for templating - suppress extra artefacts
命令:
% cat <<EOF | cpp -DVERBOSE=3
#if VERBOSE >= 2
printf("trace message");
#endif
EOF
输出:
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 362 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2
printf("trace message");
任何人都知道如何抑制这些行,例如 # 1 "<stding>" 2
,我需要在输入 Dockerfile 中包含一些指令,例如 # dockerfile syntax=experiemental
。
how to suppress those lines such as # 1 "" 2
来自gcc manual:
-P
Inhibit generation of linemarkers in the output from the preprocessor. This might be useful when running the preprocessor on something that is not C code, and will be sent to a program which might be confused by the linemarkers.
cpp -P ...
命令:
% cat <<EOF | cpp -DVERBOSE=3
#if VERBOSE >= 2
printf("trace message");
#endif
EOF
输出:
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 362 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2
printf("trace message");
任何人都知道如何抑制这些行,例如 # 1 "<stding>" 2
,我需要在输入 Dockerfile 中包含一些指令,例如 # dockerfile syntax=experiemental
。
how to suppress those lines such as # 1 "" 2
来自gcc manual:
-P
Inhibit generation of linemarkers in the output from the preprocessor. This might be useful when running the preprocessor on something that is not C code, and will be sent to a program which might be confused by the linemarkers.
cpp -P ...