Fix: protect visibility of filter-parser functions
[lttng-tools.git] / src / lib / lttng-ctl / filter-parser.y
index 30c208ab15ccaf6095527df50d7cee012ae4896b..8be5e4326818832ddd1eb17c7cd6e5be68fd8f7d 100644 (file)
 #include <assert.h>
 #include <errno.h>
 #include <inttypes.h>
 #include <assert.h>
 #include <errno.h>
 #include <inttypes.h>
-#include "filter-parser.h"
 #include "filter-ast.h"
 #include "filter-ast.h"
+#include "filter-parser.h"
 
 
+__attribute__((visibility("protected")))
 int yydebug;
 int filter_parser_debug = 0;
 
 int yydebug;
 int filter_parser_debug = 0;
 
+__attribute__((visibility("protected")))
 int yyparse(struct filter_parser_ctx *parser_ctx);
 int yyparse(struct filter_parser_ctx *parser_ctx);
+__attribute__((visibility("protected")))
 int yylex(union YYSTYPE *yyval, struct filter_parser_ctx *parser_ctx);
 int yylex(union YYSTYPE *yyval, struct filter_parser_ctx *parser_ctx);
+__attribute__((visibility("protected")))
 int yylex_init_extra(struct filter_parser_ctx *parser_ctx, yyscan_t * ptr_yy_globals);
 int yylex_init_extra(struct filter_parser_ctx *parser_ctx, yyscan_t * ptr_yy_globals);
+__attribute__((visibility("protected")))
 int yylex_destroy(yyscan_t yyparser_ctx);
 int yylex_destroy(yyscan_t yyparser_ctx);
+__attribute__((visibility("protected")))
 void yyrestart(FILE * in_str, yyscan_t parser_ctx);
 
 struct gc_string {
 void yyrestart(FILE * in_str, yyscan_t parser_ctx);
 
 struct gc_string {
@@ -55,6 +61,7 @@ static const char *node_type_to_str[] = {
        [ NODE_UNARY_OP ] = "NODE_UNARY_OP",
 };
 
        [ NODE_UNARY_OP ] = "NODE_UNARY_OP",
 };
 
+__attribute__((visibility("protected")))
 const char *node_type(struct filter_node *node)
 {
        if (node->type < NR_NODE_TYPES)
 const char *node_type(struct filter_node *node)
 {
        if (node->type < NR_NODE_TYPES)
@@ -85,6 +92,7 @@ static struct gc_string *gc_string_alloc(struct filter_parser_ctx *parser_ctx,
  * gsrc will be garbage collected immediately, and gstr might be.
  * Should only be used to append characters to a string literal or constant.
  */
  * gsrc will be garbage collected immediately, and gstr might be.
  * Should only be used to append characters to a string literal or constant.
  */
+__attribute__((visibility("protected")))
 struct gc_string *gc_string_append(struct filter_parser_ctx *parser_ctx,
                                   struct gc_string *gstr,
                                   struct gc_string *gsrc)
 struct gc_string *gc_string_append(struct filter_parser_ctx *parser_ctx,
                                   struct gc_string *gstr,
                                   struct gc_string *gsrc)
@@ -114,6 +122,7 @@ struct gc_string *gc_string_append(struct filter_parser_ctx *parser_ctx,
        return gstr;
 }
 
        return gstr;
 }
 
+__attribute__((visibility("protected")))
 void setstring(struct filter_parser_ctx *parser_ctx, YYSTYPE *lvalp, const char *src)
 {
        lvalp->gs = gc_string_alloc(parser_ctx, strlen(src) + 1);
 void setstring(struct filter_parser_ctx *parser_ctx, YYSTYPE *lvalp, const char *src)
 {
        lvalp->gs = gc_string_alloc(parser_ctx, strlen(src) + 1);
@@ -175,11 +184,13 @@ static struct filter_node *make_op_node(struct filter_parser_ctx *scanner,
        return node;
 }
 
        return node;
 }
 
+__attribute__((visibility("protected")))
 void yyerror(struct filter_parser_ctx *parser_ctx, const char *str)
 {
        fprintf(stderr, "error %s\n", str);
 }
  
 void yyerror(struct filter_parser_ctx *parser_ctx, const char *str)
 {
        fprintf(stderr, "error %s\n", str);
 }
  
+__attribute__((visibility("protected")))
 int yywrap(void)
 {
        return 1;
 int yywrap(void)
 {
        return 1;
@@ -287,7 +298,7 @@ void filter_parser_ctx_free(struct filter_parser_ctx *parser_ctx)
 %start translation_unit
 %token CHARACTER_CONSTANT_START SQUOTE STRING_LITERAL_START DQUOTE
 %token ESCSEQ CHAR_STRING_TOKEN
 %start translation_unit
 %token CHARACTER_CONSTANT_START SQUOTE STRING_LITERAL_START DQUOTE
 %token ESCSEQ CHAR_STRING_TOKEN
-%token DECIMAL_CONSTANT OCTAL_CONSTANT HEXADECIMAL_CONSTANT
+%token DECIMAL_CONSTANT OCTAL_CONSTANT HEXADECIMAL_CONSTANT FLOAT_CONSTANT
 %token LSBRAC RSBRAC LPAREN RPAREN LBRAC RBRAC RARROW
 %token STAR PLUS MINUS
 %token MOD_OP DIV_OP RIGHT_OP LEFT_OP
 %token LSBRAC RSBRAC LPAREN RPAREN LBRAC RBRAC RARROW
 %token STAR PLUS MINUS
 %token MOD_OP DIV_OP RIGHT_OP LEFT_OP
@@ -390,6 +401,13 @@ primary_expression
                        sscanf(yylval.gs->s, "0x%" PRIx64,
                               &$$->u.expression.u.constant);
                }
                        sscanf(yylval.gs->s, "0x%" PRIx64,
                               &$$->u.expression.u.constant);
                }
+       |       FLOAT_CONSTANT
+               {
+                       $$ = make_node(parser_ctx, NODE_EXPRESSION);
+                       $$->u.expression.type = AST_EXP_FLOAT_CONSTANT;
+                       sscanf(yylval.gs->s, "%lg",
+                              &$$->u.expression.u.float_constant);
+               }
        |       STRING_LITERAL_START DQUOTE
                {
                        $$ = make_node(parser_ctx, NODE_EXPRESSION);
        |       STRING_LITERAL_START DQUOTE
                {
                        $$ = make_node(parser_ctx, NODE_EXPRESSION);
This page took 0.023902 seconds and 4 git commands to generate.