[aarch64] Fixes CLI crashes on dpaa2 platform.
[vpp.git] / src / tools / vppapigen / node.c
index 54fef8f..4c85a11 100644 (file)
@@ -39,7 +39,7 @@ time_t starttime;
 char *vlib_app_name;
 char *input_filename;
 node_vft_t *the_vft[NODE_N_TYPES];
-static int indent;
+static u32 indent;
 static int dont_output_version;
 int dump_tree;
 static char *fixed_name;
@@ -397,7 +397,7 @@ void node_define_generate (node_t *this, enum passid which, FILE *fp)
            fprintf(fp, ",\n");
         }
        indent_me(fp);
-       fprintf (fp, "{\"crc\" : \"0x%08x\"}\n", (u32)(u64)CDATA3);
+       fprintf (fp, "{\"crc\" : \"0x%08x\"}\n", (u32)(uword)CDATA3);
         indent -= 4;
        indent_me(fp);
         fprintf(fp, "]");
@@ -754,7 +754,7 @@ void node_complex_generate (node_t *this, enum passid which, FILE *fp)
                 union_prefix, member_name);
         indent_me(fp);
 
-        if (deeper->type == NODE_VECTOR)
+        if (deeper && deeper->type == NODE_VECTOR)
             fprintf(fp, "%s_print(a->%s%s, handle);\n", 
                     CDATA0, union_prefix, member_name);
         else
@@ -778,7 +778,7 @@ void node_complex_generate (node_t *this, enum passid which, FILE *fp)
         }
 
         indent_me(fp);
-        if (deeper->type == NODE_VECTOR)
+        if (deeper && deeper->type == NODE_VECTOR)
             fprintf(fp, "%s_endian(a->%s%s);\n", 
                     CDATA0, union_prefix, member_name);
         else
@@ -1050,6 +1050,11 @@ YYSTYPE set_flags(YYSTYPE a1, YYSTYPE a2)
     flags = (int)(uword) a1;
 
     np->flags |= flags;
+
+    /* Generate a foo_reply_t right here */
+    if (flags & NODE_FLAG_AUTOREPLY) 
+        autoreply(np);
+
     return (a2);
 }
 /*
@@ -1109,7 +1114,12 @@ char *fixup_input_filename(void)
 void generate_top_boilerplate(FILE *fp)
 
 {
-    char *datestring = ctime(&starttime);
+    time_t curtime;
+    char *datestring;
+    char *source_date_epoch;
+    if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")) == NULL || (curtime = (time_t)strtol(source_date_epoch, NULL, 10)) <= 0)
+        curtime = starttime;
+    datestring = asctime(gmtime(&curtime));
     fixed_name = fixup_input_filename();
 
     datestring[24] = 0;
@@ -1214,7 +1224,7 @@ void generate_msg_name_crc_list (YYSTYPE a1, FILE *fp)
             if (!(np->flags & NODE_FLAG_TYPEONLY)) {
                 fprintf (fp, "\\\n_(VL_API_%s, %s, %08x) ",
                          uppercase (np->data[0]), (i8 *) np->data[0],
-                         (u32)(u64)np->data[3]);
+                         (u32)(uword)np->data[3]);
             }
         }
         np = np->peer;