check source code after macro expand

Some time I'd like check 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

posted @ 2018-05-11 18:53  wangchangruei  阅读(156)  评论(0编辑  收藏  举报