]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf: parse-events: Fix compilation error while defining DEBUG_PARSER
authorClément Le Goffic <clement.legoffic@foss.st.com>
Wed, 5 Jun 2024 14:04:53 +0000 (16:04 +0200)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 6 Jun 2024 07:19:36 +0000 (00:19 -0700)
Compiling perf tool with 'DEBUG_PARSER=1' leads to errors:

$> make -C tools/perf PARSER_DEBUG=1 NO_LIBTRACEEVENT=1
...
  CC      util/expr-flex.o
  CC      util/expr.o
util/parse-events.c:33:12: error: redundant redeclaration of ‘parse_events_debug’ [-Werror=redundant-decls]
   33 | extern int parse_events_debug;
      |            ^~~~~~~~~~~~~~~~~~
In file included from util/parse-events.c:18:
util/parse-events-bison.h:43:12: note: previous declaration of ‘parse_events_debug’ with type ‘int’
   43 | extern int parse_events_debug;
      |            ^~~~~~~~~~~~~~~~~~
util/expr.c:27:12: error: redundant redeclaration of ‘expr_debug’ [-Werror=redundant-decls]
   27 | extern int expr_debug;
      |            ^~~~~~~~~~
In file included from util/expr.c:11:
util/expr-bison.h:43:12: note: previous declaration of ‘expr_debug’ with type ‘int’
   43 | extern int expr_debug;
      |            ^~~~~~~~~~
cc-1: all warnings being treated as errors

Remove extern declaration from the parse-envents.c file as there is a
conflict with the ones generated using bison and yacc tools from the file
parse-events.[ly].

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@arm.com>
Cc: John Garry <john.g.garry@oracle.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240605140453.614862-1-clement.legoffic@foss.st.com
tools/perf/util/expr.c
tools/perf/util/parse-events.c

index b8875aac8f8709039681dd4bfce26df9acea731c..b2536a59c44e6436e1f1a11ff37697121c9b363b 100644 (file)
 #include <math.h>
 #include "pmu.h"
 
-#ifdef PARSER_DEBUG
-extern int expr_debug;
-#endif
-
 struct expr_id_data {
        union {
                struct {
index 6ed0f9c5581de7d213330b1a30c4dae32992f0d0..8d5fb05f20c247870840a87450411f7fe4a1a4df 100644 (file)
@@ -31,9 +31,6 @@
 
 #define MAX_NAME_LEN 100
 
-#ifdef PARSER_DEBUG
-extern int parse_events_debug;
-#endif
 static int get_config_terms(const struct parse_events_terms *head_config,
                            struct list_head *head_terms);
 static int parse_events_terms__copy(const struct parse_events_terms *src,