Fix -Wduplicated-cond warnings
[babeltrace.git] / src / plugins / ctf / common / metadata / parser.y
index e014db1f2fb0c83b74cd219b56bd4342bb1e2fb2..16868179282c18b66da6a110becc880336d3cc68 100644 (file)
 #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
@@ -1305,7 +1310,7 @@ unary_expression:
                                $$->u.unary_expression.type = UNARY_SIGNED_CONSTANT;
                                $$->u.unary_expression.u.signed_constant =
                                        -($$->u.unary_expression.u.unsigned_constant);
-                       } else if ($$->u.unary_expression.type == UNARY_UNSIGNED_CONSTANT) {
+                       } else if ($$->u.unary_expression.type == UNARY_SIGNED_CONSTANT) {
                                $$->u.unary_expression.u.signed_constant =
                                        -($$->u.unary_expression.u.signed_constant);
                        } else {
This page took 0.025003 seconds and 4 git commands to generate.