[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210730221824.595597-9-rostedt@goodmis.org>
Date: Fri, 30 Jul 2021 18:18:15 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: linux-trace-devel@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Tom Zanussi <zanussi@...nel.org>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
linux-rt-users <linux-rt-users@...r.kernel.org>,
Clark Williams <williams@...hat.com>,
"Steven Rostedt (VMware)" <rostedt@...dmis.org>
Subject: [PATCH 08/17] libtracefs: Make parser unique to libtracefs
From: "Steven Rostedt (VMware)" <rostedt@...dmis.org>
Add %define api.prefix and defines to have the parser global variables use
tracefs_* instead of yy*, as without this, if a tool that links to this
library, and tries to use the synth sql parsing, it may end up using its
own yyparse() and friends functions.
Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
---
src/sqlhist.y | 10 ++++++++++
src/tracefs-sqlhist.c | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/sqlhist.y b/src/sqlhist.y
index ce9cb58fb3a9..9d03a457ae84 100644
--- a/src/sqlhist.y
+++ b/src/sqlhist.y
@@ -30,6 +30,16 @@ extern void yyerror(struct sqlhist_bison *, char *fmt, ...);
%}
%define api.pure
+
+/* Change the globals to use tracefs_ prefix */
+%define api.prefix{tracefs_}
+%code provides
+{
+ #define YYSTYPE TRACEFS_STYPE
+ #define yylex tracefs_lex
+ #define yyerror tracefs_error
+}
+
%lex-param {void *scanner}
%parse-param {struct sqlhist_bison *sb}
diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c
index e8f77d60659f..933b3609733b 100644
--- a/src/tracefs-sqlhist.c
+++ b/src/tracefs-sqlhist.c
@@ -1021,7 +1021,7 @@ struct tracefs_synth *tracefs_sql(struct tep_handle *tep, const char *name,
return NULL;
}
- ret = yyparse(&sb);
+ ret = tracefs_parse(&sb);
yylex_destroy(sb.scanner);
if (ret)
--
2.30.2
Powered by blists - more mailing lists