linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] perf pmu: remove unused declaration
@ 2020-06-09 23:43 Ian Rogers
  2020-06-09 23:43 ` [PATCH 2/2] perf parse-events: enable more flex/yacc warnings Ian Rogers
  2020-06-10 13:46 ` [PATCH 1/2] perf pmu: remove unused declaration Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 7+ messages in thread
From: Ian Rogers @ 2020-06-09 23:43 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Andi Kleen, Jin Yao, John Garry, Adrian Hunter, linux-kernel
  Cc: Stephane Eranian, Ian Rogers

This avoids multiple declarations if the flex header is included.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/pmu.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 85e0c7f2515c..f971d9aa4570 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -86,7 +86,6 @@ int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms,
 			  struct perf_pmu_info *info);
 struct list_head *perf_pmu__alias(struct perf_pmu *pmu,
 				  struct list_head *head_terms);
-int perf_pmu_wrap(void);
 void perf_pmu_error(struct list_head *list, char *name, char const *msg);
 
 int perf_pmu__new_format(struct list_head *list, char *name,
-- 
2.27.0.278.ge193c7cf3a9-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] perf parse-events: enable more flex/yacc warnings
  2020-06-09 23:43 [PATCH 1/2] perf pmu: remove unused declaration Ian Rogers
@ 2020-06-09 23:43 ` Ian Rogers
  2020-06-10 14:05   ` Arnaldo Carvalho de Melo
  2020-06-10 13:46 ` [PATCH 1/2] perf pmu: remove unused declaration Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 7+ messages in thread
From: Ian Rogers @ 2020-06-09 23:43 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Andi Kleen, Jin Yao, John Garry, Adrian Hunter, linux-kernel
  Cc: Stephane Eranian, Ian Rogers

All C compiler warnings are disabled are disabled by -w. This change
removes the -w from flex and bison targets. To avoid implicit
declarations header files are declared as targets and included.

Tested with GCC 9.3.0 and clang 9.0.1.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/Build          | 55 ++++++++++++++++++++++------------
 tools/perf/util/expr.y         |  2 ++
 tools/perf/util/parse-events.y |  1 +
 3 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 8d18380ecd10..8d47dd3ecf2e 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -191,36 +191,53 @@ CFLAGS_llvm-utils.o += -DPERF_INCLUDE_DIR="BUILD_STR($(perf_include_dir_SQ))"
 # avoid compiler warnings in 32-bit mode
 CFLAGS_genelf_debug.o  += -Wno-packed
 
-$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
+$(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-flex.h: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
 	$(call rule_mkdir)
-	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
+	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/parse-events-flex.c \
+		--header-file=$(OUTPUT)util/parse-events-flex.h \
+		$(PARSER_DEBUG_FLEX) $<
 
-$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
+$(OUTPUT)util/parse-events-bison.c $(OUTPUT)util/parse-events-bison.h: util/parse-events.y
 	$(call rule_mkdir)
-	$(Q)$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_
+	$(Q)$(call echo-cmd,bison)$(BISON) -v util/parse-events.y \
+		$(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c \
+		--defines=$(OUTPUT)util/parse-events-bison.h \
+		-p parse_events_
 
-$(OUTPUT)util/expr-flex.c: util/expr.l $(OUTPUT)util/expr-bison.c
+$(OUTPUT)util/parse-events-bison.o: $(OUTPUT)util/parse-events-flex.h
+
+$(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-flex.h: util/expr.l $(OUTPUT)util/expr-bison.c
 	$(call rule_mkdir)
-	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) util/expr.l
+	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/expr-flex.c \
+		--header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) $<
 
-$(OUTPUT)util/expr-bison.c: util/expr.y
+$(OUTPUT)util/expr-bison.c $(OUTPUT)util/expr-bison.h: util/expr.y
 	$(call rule_mkdir)
-	$(Q)$(call echo-cmd,bison)$(BISON) -v util/expr.y -d $(PARSER_DEBUG_BISON) -o $@ -p expr_
+	$(Q)$(call echo-cmd,bison)$(BISON) -v util/expr.y $(PARSER_DEBUG_BISON) \
+		-o $(OUTPUT)util/expr-bison.c \
+		--defines=$(OUTPUT)util/expr-bison.h -p expr_
+
+$(OUTPUT)util/expr-bison.o: $(OUTPUT)util/expr-flex.h
 
-$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
+$(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-flex.h: util/pmu.l $(OUTPUT)util/pmu-bison.c
 	$(call rule_mkdir)
-	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
+	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/pmu-flex.c \
+		--header-file=$(OUTPUT)util/pmu-flex.h $(PARSER_DEBUG_FLEX) $<
 
-$(OUTPUT)util/pmu-bison.c: util/pmu.y
+$(OUTPUT)util/pmu-bison.c $(OUTPUT)util/pmu-bison.h: util/pmu.y
 	$(call rule_mkdir)
-	$(Q)$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $@ -p perf_pmu_
-
-CFLAGS_parse-events-flex.o  += -w
-CFLAGS_pmu-flex.o           += -w
-CFLAGS_expr-flex.o          += -w
-CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 -w
-CFLAGS_pmu-bison.o          += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
-CFLAGS_expr-bison.o         += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+	$(Q)$(call echo-cmd,bison)$(BISON) -v util/pmu.y $(PARSER_DEBUG_BISON) \
+		-o $(OUTPUT)util/pmu-bison.c \
+		--defines=$(OUTPUT)util/pmu-bison.h -p perf_pmu_
+
+flex_flags := -Wno-switch-enum -Wno-switch-default -Wno-unused-function -Wno-redundant-decls
+bison_flags := -Wno-unused-parameter -Wno-nested-externs
+CFLAGS_parse-events-flex.o  += $(flex_flags)
+CFLAGS_pmu-flex.o           += $(flex_flags)
+CFLAGS_expr-flex.o          += $(flex_flags)
+CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 $(bison_flags)
+CFLAGS_pmu-bison.o          += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
+CFLAGS_expr-bison.o         += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
 
 $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
 $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
index bf3e898e3055..f34a5e544a41 100644
--- a/tools/perf/util/expr.y
+++ b/tools/perf/util/expr.y
@@ -39,6 +39,8 @@
 %type <num> expr if_expr
 
 %{
+#include "expr-flex.h"
+
 static void expr_error(double *final_val __maybe_unused,
 		       struct expr_parse_ctx *ctx __maybe_unused,
 		       void *scanner,
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index acef87d9af58..ae0aa47dbafb 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -17,6 +17,7 @@
 #include "evsel.h"
 #include "parse-events.h"
 #include "parse-events-bison.h"
+#include "parse-events-flex.h"
 
 void parse_events_error(YYLTYPE *loc, void *parse_state, void *scanner, char const *msg);
 
-- 
2.27.0.278.ge193c7cf3a9-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] perf pmu: remove unused declaration
  2020-06-09 23:43 [PATCH 1/2] perf pmu: remove unused declaration Ian Rogers
  2020-06-09 23:43 ` [PATCH 2/2] perf parse-events: enable more flex/yacc warnings Ian Rogers
@ 2020-06-10 13:46 ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-06-10 13:46 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Andi Kleen, Jin Yao, John Garry,
	Adrian Hunter, linux-kernel, Stephane Eranian

Em Tue, Jun 09, 2020 at 04:43:43PM -0700, Ian Rogers escreveu:
> This avoids multiple declarations if the flex header is included.

Thanks, applied,

- Arnaldo
 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/util/pmu.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
> index 85e0c7f2515c..f971d9aa4570 100644
> --- a/tools/perf/util/pmu.h
> +++ b/tools/perf/util/pmu.h
> @@ -86,7 +86,6 @@ int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms,
>  			  struct perf_pmu_info *info);
>  struct list_head *perf_pmu__alias(struct perf_pmu *pmu,
>  				  struct list_head *head_terms);
> -int perf_pmu_wrap(void);
>  void perf_pmu_error(struct list_head *list, char *name, char const *msg);
>  
>  int perf_pmu__new_format(struct list_head *list, char *name,
> -- 
> 2.27.0.278.ge193c7cf3a9-goog
> 

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] perf parse-events: enable more flex/yacc warnings
  2020-06-09 23:43 ` [PATCH 2/2] perf parse-events: enable more flex/yacc warnings Ian Rogers
@ 2020-06-10 14:05   ` Arnaldo Carvalho de Melo
  2020-06-10 14:09     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-06-10 14:05 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Andi Kleen, Jin Yao, John Garry,
	Adrian Hunter, linux-kernel, Stephane Eranian

Em Tue, Jun 09, 2020 at 04:43:44PM -0700, Ian Rogers escreveu:
> All C compiler warnings are disabled are disabled by -w. This change
> removes the -w from flex and bison targets. To avoid implicit
> declarations header files are declared as targets and included.
> 
> Tested with GCC 9.3.0 and clang 9.0.1.
> 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/util/Build          | 55 ++++++++++++++++++++++------------
>  tools/perf/util/expr.y         |  2 ++
>  tools/perf/util/parse-events.y |  1 +
>  3 files changed, 39 insertions(+), 19 deletions(-)
> 
> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> index 8d18380ecd10..8d47dd3ecf2e 100644
> --- a/tools/perf/util/Build
> +++ b/tools/perf/util/Build
> @@ -191,36 +191,53 @@ CFLAGS_llvm-utils.o += -DPERF_INCLUDE_DIR="BUILD_STR($(perf_include_dir_SQ))"
>  # avoid compiler warnings in 32-bit mode
>  CFLAGS_genelf_debug.o  += -Wno-packed
>  
> -$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
> +$(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-flex.h: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
>  	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
> +	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/parse-events-flex.c \
> +		--header-file=$(OUTPUT)util/parse-events-flex.h \
> +		$(PARSER_DEBUG_FLEX) $<

Wouldn't this be equivalent to:

+	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/parse-events-flex.c --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) $< \
+		--header-file=$(OUTPUT)util/parse-events-flex.h

So that we match what is being replaced more easily?

You have to replace $@ by (OUTPUT)util/parse-events-flex.c because now
you're multi-target, but then as $@ is replaced by whichever of those
targets caused the recipe to run, and what is in other places is
$(OUTPUT)util/parse-events-flex.c, we can continue to use $@, no?

And you took advantage of util/parse-events.l being
the first dependency to replace it with $<

So I think you can have it as:

$(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-flex.h: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
 	$(call rule_mkdir)
	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) $< \
		--header-file=$(OUTPUT)util/parse-events-flex.h


Right?

You have $(OUTPUT)util/parse-events-flex.h later on as a dependency, but
by then this has resolved already and that recipe won't be called for
it?

Damn, Makefiles are obtuse, we better do this more piecemeal, for
instance, using $< where applicable first, etc.

This will help us bisect problems here,

Thanks,

- Arnaldo

> -$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
> +$(OUTPUT)util/parse-events-bison.c $(OUTPUT)util/parse-events-bison.h: util/parse-events.y
>  	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_
> +	$(Q)$(call echo-cmd,bison)$(BISON) -v util/parse-events.y \
> +		$(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c \
> +		--defines=$(OUTPUT)util/parse-events-bison.h \
> +		-p parse_events_
>  
> -$(OUTPUT)util/expr-flex.c: util/expr.l $(OUTPUT)util/expr-bison.c
> +$(OUTPUT)util/parse-events-bison.o: $(OUTPUT)util/parse-events-flex.h
> +
> +$(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-flex.h: util/expr.l $(OUTPUT)util/expr-bison.c
>  	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) util/expr.l
> +	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/expr-flex.c \
> +		--header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) $<
>  
> -$(OUTPUT)util/expr-bison.c: util/expr.y
> +$(OUTPUT)util/expr-bison.c $(OUTPUT)util/expr-bison.h: util/expr.y
>  	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,bison)$(BISON) -v util/expr.y -d $(PARSER_DEBUG_BISON) -o $@ -p expr_
> +	$(Q)$(call echo-cmd,bison)$(BISON) -v util/expr.y $(PARSER_DEBUG_BISON) \
> +		-o $(OUTPUT)util/expr-bison.c \
> +		--defines=$(OUTPUT)util/expr-bison.h -p expr_
> +
> +$(OUTPUT)util/expr-bison.o: $(OUTPUT)util/expr-flex.h
>  
> -$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
> +$(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-flex.h: util/pmu.l $(OUTPUT)util/pmu-bison.c
>  	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
> +	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/pmu-flex.c \
> +		--header-file=$(OUTPUT)util/pmu-flex.h $(PARSER_DEBUG_FLEX) $<
>  
> -$(OUTPUT)util/pmu-bison.c: util/pmu.y
> +$(OUTPUT)util/pmu-bison.c $(OUTPUT)util/pmu-bison.h: util/pmu.y
>  	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $@ -p perf_pmu_
> -
> -CFLAGS_parse-events-flex.o  += -w
> -CFLAGS_pmu-flex.o           += -w
> -CFLAGS_expr-flex.o          += -w
> -CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 -w
> -CFLAGS_pmu-bison.o          += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
> -CFLAGS_expr-bison.o         += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
> +	$(Q)$(call echo-cmd,bison)$(BISON) -v util/pmu.y $(PARSER_DEBUG_BISON) \
> +		-o $(OUTPUT)util/pmu-bison.c \
> +		--defines=$(OUTPUT)util/pmu-bison.h -p perf_pmu_
> +
> +flex_flags := -Wno-switch-enum -Wno-switch-default -Wno-unused-function -Wno-redundant-decls
> +bison_flags := -Wno-unused-parameter -Wno-nested-externs
> +CFLAGS_parse-events-flex.o  += $(flex_flags)
> +CFLAGS_pmu-flex.o           += $(flex_flags)
> +CFLAGS_expr-flex.o          += $(flex_flags)
> +CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 $(bison_flags)
> +CFLAGS_pmu-bison.o          += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
> +CFLAGS_expr-bison.o         += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
>  
>  $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
>  $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
> diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
> index bf3e898e3055..f34a5e544a41 100644
> --- a/tools/perf/util/expr.y
> +++ b/tools/perf/util/expr.y
> @@ -39,6 +39,8 @@
>  %type <num> expr if_expr
>  
>  %{
> +#include "expr-flex.h"
> +
>  static void expr_error(double *final_val __maybe_unused,
>  		       struct expr_parse_ctx *ctx __maybe_unused,
>  		       void *scanner,
> diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
> index acef87d9af58..ae0aa47dbafb 100644
> --- a/tools/perf/util/parse-events.y
> +++ b/tools/perf/util/parse-events.y
> @@ -17,6 +17,7 @@
>  #include "evsel.h"
>  #include "parse-events.h"
>  #include "parse-events-bison.h"
> +#include "parse-events-flex.h"
>  
>  void parse_events_error(YYLTYPE *loc, void *parse_state, void *scanner, char const *msg);
>  
> -- 
> 2.27.0.278.ge193c7cf3a9-goog
> 

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] perf parse-events: enable more flex/yacc warnings
  2020-06-10 14:05   ` Arnaldo Carvalho de Melo
@ 2020-06-10 14:09     ` Arnaldo Carvalho de Melo
  2020-06-10 14:18       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-06-10 14:09 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Andi Kleen, Jin Yao, John Garry,
	Adrian Hunter, linux-kernel, Stephane Eranian

Em Wed, Jun 10, 2020 at 11:05:26AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Jun 09, 2020 at 04:43:44PM -0700, Ian Rogers escreveu:
> > All C compiler warnings are disabled are disabled by -w. This change
> > removes the -w from flex and bison targets. To avoid implicit
> > declarations header files are declared as targets and included.

> > Tested with GCC 9.3.0 and clang 9.0.1.

> > Signed-off-by: Ian Rogers <irogers@google.com>

> > +++ b/tools/perf/util/Build
<SNIP>
> > -$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
> > +$(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-flex.h: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
> >  	$(call rule_mkdir)
> > -	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
> > +	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/parse-events-flex.c \
> > +		--header-file=$(OUTPUT)util/parse-events-flex.h \
> > +		$(PARSER_DEBUG_FLEX) $<

<SNIP>
 
> And you took advantage of util/parse-events.l being
> the first dependency to replace it with $<

<SNIP>
 
> Damn, Makefiles are obtuse, we better do this more piecemeal, for
> instance, using $< where applicable first, etc.

I mean, first this, ok? Then you do the other bits, and please try to
keep the positioning as far as possible, so that visually we see what is
being replaced by what.

- Arnaldo

diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 8d18380ecd10..cc50fdfd0c2f 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -193,27 +193,27 @@ CFLAGS_genelf_debug.o  += -Wno-packed
 
 $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
 	$(call rule_mkdir)
-	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
+	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) %<
 
 $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
 	$(call rule_mkdir)
-	$(Q)$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_
+	$(Q)$(call echo-cmd,bison)$(BISON) -v %< -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_
 
 $(OUTPUT)util/expr-flex.c: util/expr.l $(OUTPUT)util/expr-bison.c
 	$(call rule_mkdir)
-	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) util/expr.l
+	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) %<
 
 $(OUTPUT)util/expr-bison.c: util/expr.y
 	$(call rule_mkdir)
-	$(Q)$(call echo-cmd,bison)$(BISON) -v util/expr.y -d $(PARSER_DEBUG_BISON) -o $@ -p expr_
+	$(Q)$(call echo-cmd,bison)$(BISON) -v %< -d $(PARSER_DEBUG_BISON) -o $@ -p expr_
 
 $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
 	$(call rule_mkdir)
-	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
+	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h %<
 
 $(OUTPUT)util/pmu-bison.c: util/pmu.y
 	$(call rule_mkdir)
-	$(Q)$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $@ -p perf_pmu_
+	$(Q)$(call echo-cmd,bison)$(BISON) -v %< -d -o $@ -p perf_pmu_
 
 CFLAGS_parse-events-flex.o  += -w
 CFLAGS_pmu-flex.o           += -w

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] perf parse-events: enable more flex/yacc warnings
  2020-06-10 14:09     ` Arnaldo Carvalho de Melo
@ 2020-06-10 14:18       ` Arnaldo Carvalho de Melo
  2020-06-10 17:00         ` Ian Rogers
  0 siblings, 1 reply; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-06-10 14:18 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Andi Kleen, Jin Yao, John Garry,
	Adrian Hunter, linux-kernel, Stephane Eranian

Em Wed, Jun 10, 2020 at 11:09:56AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Jun 10, 2020 at 11:05:26AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Tue, Jun 09, 2020 at 04:43:44PM -0700, Ian Rogers escreveu:
> > > All C compiler warnings are disabled are disabled by -w. This change
> > > removes the -w from flex and bison targets. To avoid implicit
> > > declarations header files are declared as targets and included.
> 
> > > Tested with GCC 9.3.0 and clang 9.0.1.
> 
> > > Signed-off-by: Ian Rogers <irogers@google.com>
> 
> > > +++ b/tools/perf/util/Build
> <SNIP>
> > > -$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
> > > +$(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-flex.h: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
> > >  	$(call rule_mkdir)
> > > -	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
> > > +	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/parse-events-flex.c \
> > > +		--header-file=$(OUTPUT)util/parse-events-flex.h \
> > > +		$(PARSER_DEBUG_FLEX) $<
> 
> <SNIP>
>  
> > And you took advantage of util/parse-events.l being
> > the first dependency to replace it with $<
> 
> <SNIP>
>  
> > Damn, Makefiles are obtuse, we better do this more piecemeal, for
> > instance, using $< where applicable first, etc.
> 
> I mean, first this, ok? Then you do the other bits, and please try to
> keep the positioning as far as possible, so that visually we see what is
> being replaced by what.

Argh, replace all %< below with, of course, $<

- Arnaldo
> 
> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> index 8d18380ecd10..cc50fdfd0c2f 100644
> --- a/tools/perf/util/Build
> +++ b/tools/perf/util/Build
> @@ -193,27 +193,27 @@ CFLAGS_genelf_debug.o  += -Wno-packed
>  
>  $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
>  	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
> +	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) %<
>  
>  $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
>  	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_
> +	$(Q)$(call echo-cmd,bison)$(BISON) -v %< -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_
>  
>  $(OUTPUT)util/expr-flex.c: util/expr.l $(OUTPUT)util/expr-bison.c
>  	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) util/expr.l
> +	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) %<
>  
>  $(OUTPUT)util/expr-bison.c: util/expr.y
>  	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,bison)$(BISON) -v util/expr.y -d $(PARSER_DEBUG_BISON) -o $@ -p expr_
> +	$(Q)$(call echo-cmd,bison)$(BISON) -v %< -d $(PARSER_DEBUG_BISON) -o $@ -p expr_
>  
>  $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
>  	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
> +	$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h %<
>  
>  $(OUTPUT)util/pmu-bison.c: util/pmu.y
>  	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $@ -p perf_pmu_
> +	$(Q)$(call echo-cmd,bison)$(BISON) -v %< -d -o $@ -p perf_pmu_
>  
>  CFLAGS_parse-events-flex.o  += -w
>  CFLAGS_pmu-flex.o           += -w

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] perf parse-events: enable more flex/yacc warnings
  2020-06-10 14:18       ` Arnaldo Carvalho de Melo
@ 2020-06-10 17:00         ` Ian Rogers
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Rogers @ 2020-06-10 17:00 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Andi Kleen, Jin Yao, John Garry,
	Adrian Hunter, LKML, Stephane Eranian

On Wed, Jun 10, 2020 at 7:18 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Wed, Jun 10, 2020 at 11:09:56AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Wed, Jun 10, 2020 at 11:05:26AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Tue, Jun 09, 2020 at 04:43:44PM -0700, Ian Rogers escreveu:
> > > > All C compiler warnings are disabled are disabled by -w. This change
> > > > removes the -w from flex and bison targets. To avoid implicit
> > > > declarations header files are declared as targets and included.
> >
> > > > Tested with GCC 9.3.0 and clang 9.0.1.
> >
> > > > Signed-off-by: Ian Rogers <irogers@google.com>
> >
> > > > +++ b/tools/perf/util/Build
> > <SNIP>
> > > > -$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
> > > > +$(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-flex.h: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
> > > >   $(call rule_mkdir)
> > > > - $(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
> > > > + $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/parse-events-flex.c \
> > > > +         --header-file=$(OUTPUT)util/parse-events-flex.h \
> > > > +         $(PARSER_DEBUG_FLEX) $<
> >
> > <SNIP>
> >
> > > And you took advantage of util/parse-events.l being
> > > the first dependency to replace it with $<
> >
> > <SNIP>
> >
> > > Damn, Makefiles are obtuse, we better do this more piecemeal, for
> > > instance, using $< where applicable first, etc.
> >
> > I mean, first this, ok? Then you do the other bits, and please try to
> > keep the positioning as far as possible, so that visually we see what is
> > being replaced by what.
>
> Argh, replace all %< below with, of course, $<

Thanks, I'll pull it into a series of changes. I'm more worried that
the -W flags aren't going to be supported by an old clang or GCC.
Worth the pain to get rid of the -w that introduced some issues.

Ian

> - Arnaldo
> >
> > diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> > index 8d18380ecd10..cc50fdfd0c2f 100644
> > --- a/tools/perf/util/Build
> > +++ b/tools/perf/util/Build
> > @@ -193,27 +193,27 @@ CFLAGS_genelf_debug.o  += -Wno-packed
> >
> >  $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
> >       $(call rule_mkdir)
> > -     $(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
> > +     $(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) %<
> >
> >  $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
> >       $(call rule_mkdir)
> > -     $(Q)$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_
> > +     $(Q)$(call echo-cmd,bison)$(BISON) -v %< -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_
> >
> >  $(OUTPUT)util/expr-flex.c: util/expr.l $(OUTPUT)util/expr-bison.c
> >       $(call rule_mkdir)
> > -     $(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) util/expr.l
> > +     $(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) %<
> >
> >  $(OUTPUT)util/expr-bison.c: util/expr.y
> >       $(call rule_mkdir)
> > -     $(Q)$(call echo-cmd,bison)$(BISON) -v util/expr.y -d $(PARSER_DEBUG_BISON) -o $@ -p expr_
> > +     $(Q)$(call echo-cmd,bison)$(BISON) -v %< -d $(PARSER_DEBUG_BISON) -o $@ -p expr_
> >
> >  $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
> >       $(call rule_mkdir)
> > -     $(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
> > +     $(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h %<
> >
> >  $(OUTPUT)util/pmu-bison.c: util/pmu.y
> >       $(call rule_mkdir)
> > -     $(Q)$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $@ -p perf_pmu_
> > +     $(Q)$(call echo-cmd,bison)$(BISON) -v %< -d -o $@ -p perf_pmu_
> >
> >  CFLAGS_parse-events-flex.o  += -w
> >  CFLAGS_pmu-flex.o           += -w
>
> --
>
> - Arnaldo

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-06-10 17:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 23:43 [PATCH 1/2] perf pmu: remove unused declaration Ian Rogers
2020-06-09 23:43 ` [PATCH 2/2] perf parse-events: enable more flex/yacc warnings Ian Rogers
2020-06-10 14:05   ` Arnaldo Carvalho de Melo
2020-06-10 14:09     ` Arnaldo Carvalho de Melo
2020-06-10 14:18       ` Arnaldo Carvalho de Melo
2020-06-10 17:00         ` Ian Rogers
2020-06-10 13:46 ` [PATCH 1/2] perf pmu: remove unused declaration Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).