perf/core clang fixes:

Changes to make tools/{perf,lib/{bpf,traceevent,api}} build with
CC=clang, to, for instance, take advantage of warnings (Arnaldo Carvalho de Melo):

- Conditionally request some warning options not available on clang

- Set the maximum optimization level to -O3 when using CC=clang, leave
  the previous setting of -O6 otherwise.

- Make it an error to pass a signed value to OPTION_UINTEGER, so that
  we can remove abs(unsigned int) calls in 'perf bench futex'.

- Make sure dprintf() is not defined before using that name in 'perf bench numa'

- Avoid using field after variable sized type, its a GNU extension, use
  equivalent code.

- Fix some bugs where some variables could be used unitialized,
  something not caught by gcc.

- Fix some spots where we were testing struct->array[] members against
  NULL, it will always evaluate to 'true'.

- Add missing parse_events_error() prototype in the bison file.

There are still one problem when trying to build the python support, but
this are the 'size' outputs for 'make -C tools/perf NO_LIBPYTHON' for
gcc and clang builds:

  DW_AT_producer: clang version 4.0.0 (http://llvm.org/git/clang.git f5be8ba13adc4ba1011a7ccd60c844bd60427c1c) (ht

  $ size ~/bin/perf
     text    data     bss     dec     hex     filename
  3447514  831320 23901696  28180530  1ae0032 /home/acme/bin/perf

  DW_AT_producer: GNU C99 6.3.1 20161221 (Red Hat 6.3.1-1) -mtune=generic -march=x86-64 -ggdb3 -O6 -std=gnu99
+-fno-omit-frame-pointer -funwind-tables -fstack-protector-all

  $ size ~/bin/perf
     text    data     bss     dec     hex     filename
  3671662  836480 23902752  28410894  1b1840e /home/acme/bin/perf

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf tools: Add missing parse_events_error() prototype

As pointed out by clang, we were not providing a prototype for a
function before using it:

  util/parse-events.y:699:6: error: conflicting types for 'parse_events_error'
  void parse_events_error(YYLTYPE *loc, void *data,
       ^
  /tmp/build/perf/util/parse-events-bison.c:2224:7: note: previous implicit declaration is here
        yyerror (&yylloc, _data, scanner, YY_("syntax error"));
        ^
  /tmp/build/perf/util/parse-events-bison.c:65:25: note: expanded from macro 'yyerror'
  #define yyerror         parse_events_error

  1 error generated.

One line fix it.

Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20170215130605.GC4020@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed