debug source code after macro expand

Some time I'd like debug source code after macro expand.
We can use -E option to stop after the preprocessing stage, do not run the compiler.

-------------------------------------------------------------------------------------------------------------

The source code of test_macro.c

#define TEST_MACRO(a,b)   a,,,,,,b

int main(void)
{
        TEST_MACRO(xxx,yyy)

        return 0;
}

-------------------------------------------------------------------------------------------------------------

$ gcc -E test_macro.c
# 1 "test_macro.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "test_macro.c"


int main(void)
{
        xxx,,,,,,yyy

        return 0;
}

-------------------------------------------------------------------------------------------------------------

gcc option -E

猜你喜欢

转载自www.cnblogs.com/youchihwang/p/9026218.html