memo: gcc option - stop right after preprocessing stage
Computing 2011. 3. 25. 01:04If gcc is given "-E" option, it stops after preprocessing stage. Its output will be like following:
orchistro.deltabellun:~/work/iso-2022-jp$ cat a.c
#include <stdio.h>
int main(void)
{
printf("%c%c%c%c%c", 0x1b, 0x24, 0x42, 0x30, 0x21); /* nihongo kanji */
printf("%c%c%c%c%c", 0x1b, 0x24, 0x42, 0x2d, 0x21); /* circled 1 */
printf("%c%c%c\n", 0x1b, 0x28, 0x42); /* ascii */
return 0;
}
orchistro.deltabellun:~/work/iso-2022-jp$ gcc -E a.c | head -30
# 1 "a.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "a.c"
# 1 "/usr/include/stdio.h" 1 3 4
# 64 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/_types.h" 1 3 4
# 27 "/usr/include/_types.h" 3 4
# 1 "/usr/include/sys/_types.h" 1 3 4
# 32 "/usr/include/sys/_types.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 33 "/usr/include/sys/_types.h" 2 3 4
# 1 "/usr/include/machine/_types.h" 1 3 4
# 34 "/usr/include/machine/_types.h" 3 4
# 1 "/usr/include/i386/_types.h" 1 3 4
# 37 "/usr/include/i386/_types.h" 3 4
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
typedef long long __int64_t;
typedef unsigned long long __uint64_t;
typedef long __darwin_intptr_t;
typedef unsigned int __darwin_natural_t;
orchistro.deltabellun:~/work/iso-2022-jp$ gcc -E a.c | tail -30
extern int __snprintf_chk (char * , size_t, int, size_t,
const char * , ...)
;
extern int __vsprintf_chk (char * , int, size_t,
const char * , va_list)
;
extern int __vsnprintf_chk (char * , size_t, int, size_t,
const char * , va_list)
;
# 444 "/usr/include/stdio.h" 2 3 4
# 2 "a.c" 2
int main(void)
{
printf("%c%c%c%c%c", 0x1b, 0x24, 0x42, 0x30, 0x21);
printf("%c%c%c%c%c", 0x1b, 0x24, 0x42, 0x2d, 0x21);
printf("%c%c%c\n", 0x1b, 0x28, 0x42);
return 0;
}
orchistro.deltabellun:~/work/iso-2022-jp$