X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Fcommon%2Fmetadata%2Fparser.y;h=b270a83c5001b89d5b4398398420a55587eed259;hb=9103e903a8;hp=e014db1f2fb0c83b74cd219b56bd4342bb1e2fb2;hpb=0746848ce8b40484254eeace3962a7654d01c7bc;p=babeltrace.git diff --git a/src/plugins/ctf/common/metadata/parser.y b/src/plugins/ctf/common/metadata/parser.y index e014db1f..b270a83c 100644 --- a/src/plugins/ctf/common/metadata/parser.y +++ b/src/plugins/ctf/common/metadata/parser.y @@ -41,16 +41,10 @@ #include "common/list.h" #include "common/assert.h" #include "scanner.h" -#include "parser.h" #include "ast.h" #include "objstack.h" -#if BT_LOG_ENABLED_VERBOSE -# define YYDEBUG 1 -# define YYFPRINTF(_stream, _fmt, args...) BT_LOGV(_fmt, ## args) -#else -# define YYDEBUG 0 -#endif +#include "parser-wrap.h" /* Join two lists, put "add" at the end of "head". */ static inline void @@ -165,7 +159,7 @@ int parse_base_sequence(const char *src, size_t len, size_t pos, return -1; } } - BT_ASSERT(nr_char > 0); + BT_ASSERT_DBG(nr_char > 0); buffer[nr_char] = '\0'; *buf_len = nr_char; return 0; @@ -318,7 +312,7 @@ static void push_scope(struct ctf_scanner *scanner) { struct ctf_scanner_scope *ns; - BT_LOGV("Pushing scope: scanner-addr=%p", scanner); + BT_LOGT("Pushing scope: scanner-addr=%p", scanner); ns = malloc(sizeof(struct ctf_scanner_scope)); init_scope(ns, scanner->cs); scanner->cs = ns; @@ -328,7 +322,7 @@ static void pop_scope(struct ctf_scanner *scanner) { struct ctf_scanner_scope *os; - BT_LOGV("Popping scope: scanner-addr=%p", scanner); + BT_LOGT("Popping scope: scanner-addr=%p", scanner); os = scanner->cs; scanner->cs = os->parent; finalize_scope(os); @@ -340,7 +334,7 @@ static int lookup_type(struct ctf_scanner_scope *s, const char *id) int ret; ret = GPOINTER_TO_INT(g_hash_table_lookup(s->classes, id)); - BT_LOGV("Looked up type: scanner-addr=%p, id=\"%s\", ret=%d", + BT_LOGT("Looked up type: scanner-addr=%p, id=\"%s\", ret=%d", s, id, ret); return ret; } @@ -351,20 +345,20 @@ int is_type(struct ctf_scanner *scanner, const char *id) struct ctf_scanner_scope *it; int ret = 0; - for (it = scanner->cs; it != NULL; it = it->parent) { + for (it = scanner->cs; it; it = it->parent) { if (lookup_type(it, id)) { ret = 1; break; } } - BT_LOGV("Found if ID is type: scanner-addr=%p, id=\"%s\", ret=%d", + BT_LOGT("Found if ID is type: scanner-addr=%p, id=\"%s\", ret=%d", scanner, id, ret); return ret; } static void add_type(struct ctf_scanner *scanner, char *id) { - BT_LOGV("Adding type: scanner-addr=%p, id=\"%s\"", + BT_LOGT("Adding type: scanner-addr=%p, id=\"%s\"", scanner, id); if (lookup_type(scanner->cs, id)) return; @@ -1044,6 +1038,17 @@ void ctf_scanner_free(struct ctf_scanner *scanner) %} +/* + * This ends up in parser.h and makes sure those who want to include it pass + * through parser-wrap.h. + */ +%code requires { +#ifndef ALLOW_INCLUDE_PARSER_H +# error "Don't include parser.h directly, include parser-wrap.h instead." +#endif +} + + %define api.pure /* %locations */ %error-verbose