Fix -Wmissing-prototypes/-Wmissing-declarations warnings
[babeltrace.git] / src / plugins / ctf / common / metadata / parser.y
index b270a83c5001b89d5b4398398420a55587eed259..f75e577b42b18559afd01f96b6b917a8c5731ecf 100644 (file)
@@ -59,8 +59,6 @@ _bt_list_splice_tail (struct bt_list_head *add, struct bt_list_head *head)
        }
 }
 
-BT_HIDDEN
-int yyparse(struct ctf_scanner *scanner, yyscan_t yyscanner);
 BT_HIDDEN
 int yylex(union YYSTYPE *yyval, yyscan_t yyscanner);
 BT_HIDDEN
@@ -939,19 +937,13 @@ static int set_parent_node(struct ctf_node *node,
        return 0;
 }
 
-BT_HIDDEN
+static
 void yyerror(struct ctf_scanner *scanner, yyscan_t yyscanner, const char *str)
 {
        _BT_LOGE_LINENO(yyget_lineno(scanner->scanner),
                "%s: token=\"%s\"", str, yyget_text(scanner->scanner));
 }
 
-BT_HIDDEN
-int yywrap(void)
-{
-       return 1;
-}
-
 #define reparent_error(scanner, str)                           \
 do {                                                           \
        yyerror(scanner, scanner->scanner, YY_("reparent_error: " str)); \
@@ -1036,6 +1028,17 @@ void ctf_scanner_free(struct ctf_scanner *scanner)
        free(scanner);
 }
 
+/*
+ * The bison-provided version of strlen (yystrlen) generates a benign
+ * -Wnull-dereference warning.  That version is used when building on cygwin,
+ * for example, but you can also enable it by hand (to test) by removing the
+ * preprocessor conditional around it.
+ *
+ * Define yystrlen such that it will always use strlen.  As far as we know,
+ * strlen provided by all the platforms we use is reliable.
+ */
+#define yystrlen strlen
+
 %}
 
 /*
@@ -1048,6 +1051,13 @@ void ctf_scanner_free(struct ctf_scanner *scanner)
 #endif
 }
 
+%code provides {
+       BT_HIDDEN
+       void setstring(struct ctf_scanner *scanner, YYSTYPE *lvalp, const char *src);
+       
+       BT_HIDDEN
+       int import_string(struct ctf_scanner *scanner, YYSTYPE *lvalp, const char *src, char delim);
+}
 
 %define api.pure
        /* %locations */
@@ -1310,7 +1320,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.0263 seconds and 4 git commands to generate.