From patchwork Tue Aug 3 04:23:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 491252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25814C4320E for ; Tue, 3 Aug 2021 04:24:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F09861168 for ; Tue, 3 Aug 2021 04:24:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233797AbhHCEYP (ORCPT ); Tue, 3 Aug 2021 00:24:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:57148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232667AbhHCEYH (ORCPT ); Tue, 3 Aug 2021 00:24:07 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ED468610A0; Tue, 3 Aug 2021 04:23:56 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.94.2) (envelope-from ) id 1mAly7-002qnO-Sq; Tue, 03 Aug 2021 00:23:55 -0400 From: Steven Rostedt To: linux-trace-devel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Tom Zanussi , Daniel Bristot de Oliveira , Masami Hiramatsu , Namhyung Kim , linux-rt-users , Clark Williams , "Steven Rostedt (VMware)" Subject: [PATCH v2 08/21] libtracefs: Make parser unique to libtracefs Date: Tue, 3 Aug 2021 00:23:34 -0400 Message-Id: <20210803042347.679499-9-rostedt@goodmis.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210803042347.679499-1-rostedt@goodmis.org> References: <20210803042347.679499-1-rostedt@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org From: "Steven Rostedt (VMware)" 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) --- 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)