mirror of https://gitlab.com/qemu-project/dtc.git
Return a non-zero exit code if an error occurs during dts parsing.
Previously, only failure to parse caused the reading of the tree to fail; semantic errors that called yyerror() but not YYERROR only emitted a message, without signalling make to stop the build. Signed-off-by: Scott Wood <scottwood@freescale.com>
This commit is contained in:
parent
910efac4b4
commit
ad4f54ae2b
|
@ -28,6 +28,7 @@ int yylex(void);
|
||||||
unsigned long long eval_literal(const char *s, int base, int bits);
|
unsigned long long eval_literal(const char *s, int base, int bits);
|
||||||
|
|
||||||
extern struct boot_info *the_boot_info;
|
extern struct boot_info *the_boot_info;
|
||||||
|
extern int treesource_error;
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -320,6 +321,7 @@ void yyerrorf(char const *s, ...)
|
||||||
vfprintf(stderr, s, va);
|
vfprintf(stderr, s, va);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
|
treesource_error = 1;
|
||||||
va_end(va);
|
va_end(va);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
dtc.c
2
dtc.c
|
@ -205,7 +205,7 @@ int main(int argc, char *argv[])
|
||||||
if (inf && inf->file != stdin)
|
if (inf && inf->file != stdin)
|
||||||
fclose(inf->file);
|
fclose(inf->file);
|
||||||
|
|
||||||
if (! bi || ! bi->dt)
|
if (! bi || ! bi->dt || bi->error)
|
||||||
die("Couldn't read input tree\n");
|
die("Couldn't read input tree\n");
|
||||||
|
|
||||||
process_checks(force, bi);
|
process_checks(force, bi);
|
||||||
|
|
1
dtc.h
1
dtc.h
|
@ -233,6 +233,7 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list,
|
||||||
struct boot_info {
|
struct boot_info {
|
||||||
struct reserve_info *reservelist;
|
struct reserve_info *reservelist;
|
||||||
struct node *dt; /* the device tree */
|
struct node *dt; /* the device tree */
|
||||||
|
int error;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct boot_info *build_boot_info(struct reserve_info *reservelist,
|
struct boot_info *build_boot_info(struct reserve_info *reservelist,
|
||||||
|
|
|
@ -172,6 +172,7 @@ struct boot_info *build_boot_info(struct reserve_info *reservelist,
|
||||||
bi = xmalloc(sizeof(*bi));
|
bi = xmalloc(sizeof(*bi));
|
||||||
bi->reservelist = reservelist;
|
bi->reservelist = reservelist;
|
||||||
bi->dt = tree;
|
bi->dt = tree;
|
||||||
|
bi->error = 0;
|
||||||
|
|
||||||
return bi;
|
return bi;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,12 @@ extern FILE *yyin;
|
||||||
extern int yyparse(void);
|
extern int yyparse(void);
|
||||||
|
|
||||||
struct boot_info *the_boot_info;
|
struct boot_info *the_boot_info;
|
||||||
|
int treesource_error;
|
||||||
|
|
||||||
struct boot_info *dt_from_source(const char *fname)
|
struct boot_info *dt_from_source(const char *fname)
|
||||||
{
|
{
|
||||||
the_boot_info = NULL;
|
the_boot_info = NULL;
|
||||||
|
treesource_error = 0;
|
||||||
|
|
||||||
push_input_file(fname);
|
push_input_file(fname);
|
||||||
|
|
||||||
|
@ -37,6 +39,7 @@ struct boot_info *dt_from_source(const char *fname)
|
||||||
|
|
||||||
fill_fullpaths(the_boot_info->dt, "");
|
fill_fullpaths(the_boot_info->dt, "");
|
||||||
|
|
||||||
|
the_boot_info->error = treesource_error;
|
||||||
return the_boot_info;
|
return the_boot_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue