X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Ffilter%2Ffilter-parser.ypp;h=0f11c234d6197f30ab3b9cea48ea749bf6697fbe;hb=HEAD;hp=d654ecc84ab7ac539925d4973d50027172d1ece8;hpb=348ddc5c9107149d48b1f12d31a7e75e9b73b4da;p=lttng-tools.git diff --git a/src/common/filter/filter-parser.ypp b/src/common/filter/filter-parser.ypp index d654ecc84..e3fae6394 100644 --- a/src/common/filter/filter-parser.ypp +++ b/src/common/filter/filter-parser.ypp @@ -16,19 +16,28 @@ #include #include #include -#include "common/bytecode/bytecode.h" -#include "filter-ast.h" +#include "common/bytecode/bytecode.hpp" +#include "filter-ast.hpp" #include "filter-parser.hpp" -#include "memstream.h" +#include "memstream.hpp" -#include -#include +#include +#include +#include #define WIDTH_u64_SCANF_IS_A_BROKEN_API "20" #define WIDTH_o64_SCANF_IS_A_BROKEN_API "22" #define WIDTH_x64_SCANF_IS_A_BROKEN_API "17" #define WIDTH_lg_SCANF_IS_A_BROKEN_API "4096" /* Hugely optimistic approximation */ +/* + * bison 3.8.2 produces a parser with unused, but set, which results in warnings + * at build time. + */ +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wunused-but-set-variable" +#endif /* __clang__ */ + #ifdef DEBUG static const int print_xml = 1; #define dbg_printf(fmt, args...) \ @@ -54,7 +63,7 @@ void yyrestart(FILE * in_str, yyscan_t parser_ctx); struct gc_string { struct cds_list_head gc; size_t alloclen; - char s[]; + char s[LTTNG_FLEXIBLE_ARRAY_MEMBER_LENGTH]; }; static @@ -97,7 +106,7 @@ static struct gc_string *gc_string_alloc(struct filter_parser_ctx *parser_ctx, for (alloclen = 8; alloclen < sizeof(long) + sizeof(*gstr) + len; alloclen *= 2); - gstr = (gc_string *) zmalloc(alloclen); + gstr = zmalloc(alloclen); if (!gstr) { goto end; } @@ -154,7 +163,7 @@ static struct filter_node *make_node(struct filter_parser_ctx *scanner, struct filter_ast *ast = filter_parser_get_ast(scanner); struct filter_node *node; - node = (filter_node *) zmalloc(sizeof(*node)); + node = zmalloc(); if (!node) return NULL; memset(node, 0, sizeof(*node)); @@ -191,7 +200,7 @@ static struct filter_node *make_op_node(struct filter_parser_ctx *scanner, struct filter_ast *ast = filter_parser_get_ast(scanner); struct filter_node *node; - node = (filter_node *) zmalloc(sizeof(*node)); + node = zmalloc(); if (!node) return NULL; memset(node, 0, sizeof(*node)); @@ -227,7 +236,7 @@ static struct filter_ast *filter_ast_alloc(void) { struct filter_ast *ast; - ast = (filter_ast *) zmalloc(sizeof(*ast)); + ast = zmalloc(); if (!ast) return NULL; memset(ast, 0, sizeof(*ast)); @@ -257,7 +266,7 @@ struct filter_parser_ctx *filter_parser_ctx_alloc(FILE *input) yydebug = filter_parser_debug; - parser_ctx = (filter_parser_ctx *) zmalloc(sizeof(*parser_ctx)); + parser_ctx = zmalloc(); if (!parser_ctx) return NULL; memset(parser_ctx, 0, sizeof(*parser_ctx)); @@ -428,7 +437,7 @@ error: %code provides { -#include "common/macros.h" +#include "common/macros.hpp" void setstring(struct filter_parser_ctx *parser_ctx, YYSTYPE *lvalp, const char *src); }