preprocessing gcc vs clang - majianpeng/majianpeng.github.io GitHub Wiki
preprocessing stage
compare
clang
typedef uint8_t WriteLogCacheEntry_toid_type_num[((2 + 1 - (sizeof(_pobj_layout_rbd_pwl_ref)))) + 1];union WriteLogCacheEntry_toid{ WriteLogCacheEntry_toid(){ } WriteLogCacheEntry_toid(PMEMoid _oid) : oid(_oid){ } PMEMoid oid; struct WriteLogCacheEntry *_type; WriteLogCacheEntry_toid_type_num *_type_num;};;
gcc
# 205 "librbd/cache/pwl/Types.h"
WriteLogCacheEntry_toid_type_num
# 205 "librbd/cache/pwl/Types.h" 3 4
[((2 + 1 - (sizeof(_pobj_layout_rbd_pwl_ref)))) + 1];union
# 205 "librbd/cache/pwl/Types.h"
WriteLogCacheEntry_toid
# 205 "librbd/cache/pwl/Types.h" 3 4
{
# 205 "librbd/cache/pwl/Types.h"
WriteLogCacheEntry_toid
# 205 "librbd/cache/pwl/Types.h" 3 4
(){ }
# 205 "librbd/cache/pwl/Types.h"
WriteLogCacheEntry_toid
# 205 "librbd/cache/pwl/Types.h" 3 4
(PMEMoid _oid) : oid(_oid){ } PMEMoid oid;
# 205 "librbd/cache/pwl/Types.h"
struct WriteLogCacheEntry
# 205 "librbd/cache/pwl/Types.h" 3 4
*_type;
# 205 "librbd/cache/pwl/Types.h"
WriteLogCacheEntry_toid_type_num
# 205 "librbd/cache/pwl/Types.h" 3 4
*_type_num;};
# 205 "librbd/cache/pwl/Types.h"
- But we can use "c++ -E -P" to get the same result of clang++.
Summary:
format of output of Clang is better and make more readable.