fix compiler warning
The patch fixed the following compiler warnings:
/home/yhs/work/bcc/src/cc/perf_reader.c: In function ‘read_data_head’:
/home/yhs/work/bcc/src/cc/perf_reader.c:149:3: warning: dereferencing type-punned pointer will break strict-alias
ing rules [-Wstrict-aliasing]
uint64_t data_head = *((volatile uint64_t *)&perf_header->data_head);
^
/home/yhs/work/bcc/src/cc/perf_reader.c: In function ‘read_data_head’:
/home/yhs/work/bcc/src/cc/perf_reader.c:149:3: warning: dereferencing type-punned pointer will break strict-alias
ing rules [-Wstrict-aliasing]
uint64_t data_head = *((volatile uint64_t *)&perf_header->data_head);
^
Declaring perf_header as volatile type will force its member read from memory,
hence avoiding a forced type conversion.
Signed-off-by: Yonghong Song <yhs@fb.com>
Showing
Please register or sign in to comment