original_kernel/tools/perf/util
Jiri Olsa b39c2a57a0 perf tools: Fix strict alias issue for find_first_bit
When compiling perf tool code with gcc 4.4.7 I'm getting
following error:

    CC       util/session.o
  cc1: warnings being treated as errors
  util/session.c: In function ‘perf_session_deliver_event’:
  tools/perf/util/include/linux/bitops.h:109: error: dereferencing pointer ‘p’ does break strict-aliasing rules
  tools/perf/util/include/linux/bitops.h:101: error: dereferencing pointer ‘p’ does break strict-aliasing rules
  util/session.c:697: note: initialized from here
  tools/perf/util/include/linux/bitops.h:101: note: initialized from here
  make[1]: *** [util/session.o] Error 1
  make: *** [util/session.o] Error 2

The aliased types here are u64 and unsigned long pointers, which is safe
for the find_first_bit processing.

This error shows up for me only for gcc 4.4 on 32bit x86, even for
-Wstrict-aliasing=3, while newer gcc are quiet and scream here for
-Wstrict-aliasing={2,1}. Looks like newer gcc changed the rules for
strict alias warnings.

The gcc documentation offers workaround for valid aliasing by using
__may_alias__ attribute:

  http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Type-Attributes.html

Using this workaround for the find_first_bit function.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1393434867-20271-1-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-02-28 10:39:40 -03:00
..
include
scripting-engines
PERF-VERSION-GEN
abspath.c
alias.c
annotate.c
annotate.h
bitmap.c
build-id.c
build-id.h
cache.h
callchain.c
callchain.h
cgroup.c
cgroup.h
color.c
color.h
comm.c
comm.h
config.c
cpumap.c
cpumap.h
ctype.c
data.c
data.h
debug.c
debug.h
dso.c
dso.h
dwarf-aux.c
dwarf-aux.h
environment.c
event.c
event.h
evlist.c
evlist.h
evsel.c
evsel.h
exec_cmd.c
exec_cmd.h
fs.c
fs.h
generate-cmdlist.sh
header.c
header.h
help.c
help.h
hist.c
hist.h
hweight.c
intlist.c
intlist.h
levenshtein.c
levenshtein.h
machine.c
machine.h
map.c
map.h
pager.c
parse-events.c
parse-events.h
parse-events.l
parse-events.y
parse-options.c
parse-options.h
path.c
perf_regs.h
pmu.c
pmu.h
pmu.l
pmu.y
probe-event.c
probe-event.h
probe-finder.c
probe-finder.h
pstack.c
pstack.h
python-ext-sources
python.c
quote.c
quote.h
rblist.c
rblist.h
record.c
run-command.c
run-command.h
session.c
session.h
setup.py
sigchain.c
sigchain.h
sort.c
sort.h
srcline.c
stat.c
stat.h
strbuf.c
strbuf.h
strfilter.c
strfilter.h
string.c
strlist.c
strlist.h
svghelper.c
svghelper.h
symbol-elf.c
symbol-minimal.c
symbol.c
symbol.h
target.c
target.h
thread.c
thread.h
thread_map.c
thread_map.h
tool.h
top.c
top.h
trace-event-info.c
trace-event-parse.c
trace-event-read.c
trace-event-scripting.c
trace-event.c
trace-event.h
types.h
unwind.c
unwind.h
usage.c
util.c
util.h
values.c
values.h
vdso.c
vdso.h
wrapper.c
xyarray.c
xyarray.h