• Yonghong Song's avatar
    fix compiler warning · 61130a16
    Yonghong Song authored
    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: default avatarYonghong Song <yhs@fb.com>
    61130a16
perf_reader.c 6.86 KB