diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2007-08-31 16:21:23 +1000 |
---|---|---|
committer | Jon Loeliger <jdl@freescale.com> | 2007-08-31 08:34:18 -0500 |
commit | bf944970317820867895680cf0e2c4e72eefa8b1 (patch) | |
tree | 21477a6f99c64345eaf91296056379d560d9564f | |
parent | ed0117a0c059ec0e1257573b0850081787bd651d (diff) | |
download | dtc-bf944970317820867895680cf0e2c4e72eefa8b1.zip dtc-bf944970317820867895680cf0e2c4e72eefa8b1.tar.gz dtc-bf944970317820867895680cf0e2c4e72eefa8b1.tar.bz2 |
dtc: Optimise by default, fix warnings thus uncovered
This patch turns on optimisation in the Makefile by default. With the
optimizer on, some uninitialized variable warnings (one real, two
bogus) are now generated. This patch also squashes those again.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | dtc.c | 2 | ||||
-rw-r--r-- | dtc.h | 2 | ||||
-rw-r--r-- | flattree.c | 9 | ||||
-rw-r--r-- | tests/truncated_property.c | 3 |
5 files changed, 9 insertions, 9 deletions
@@ -45,7 +45,7 @@ endef CPPFLAGS = -I libfdt -CFLAGS = -Wall -g +CFLAGS = -Wall -g -Os LDFLAGS = -Llibfdt BISON = bison @@ -71,7 +71,7 @@ void fill_fullpaths(struct node *tree, char *prefix) fill_fullpaths(child, tree->fullpath); } -static void usage(void) +static void __attribute__ ((noreturn)) usage(void) { fprintf(stderr, "Usage:\n"); fprintf(stderr, "\tdtc [options] <input file>\n"); @@ -43,7 +43,7 @@ extern int quiet; /* Level of quietness */ extern int reservenum; /* Number of memory reservation slots */ extern int minsize; /* Minimum blob size */ -static inline void die(char * str, ...) +static inline void __attribute__((noreturn)) die(char * str, ...) { va_list ap; @@ -909,6 +909,7 @@ struct boot_info *dt_from_blob(FILE *f) fprintf(stderr, "\tboot_cpuid_phys:\t0x%x\n", be32_to_cpu(bph->boot_cpuid_phys)); + size_str = -1; if (version >= 3) { size_str = be32_to_cpu(bph->size_dt_strings); fprintf(stderr, "\tsize_dt_strings:\t%d\n", size_str); @@ -932,10 +933,10 @@ struct boot_info *dt_from_blob(FILE *f) inbuf_init(&memresvbuf, blob + off_mem_rsvmap, blob + totalsize); inbuf_init(&dtbuf, blob + off_dt, blob + totalsize); - inbuf_init(&strbuf, blob + off_str, blob + totalsize); - - if (version >= 3) - strbuf.limit = strbuf.base + size_str; + if (size_str >= 0) + inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str); + else + inbuf_init(&strbuf, blob + off_str, blob + totalsize); reservelist = flat_read_mem_reserve(&memresvbuf); diff --git a/tests/truncated_property.c b/tests/truncated_property.c index 5642d8d..56daa22 100644 --- a/tests/truncated_property.c +++ b/tests/truncated_property.c @@ -33,7 +33,6 @@ int main(int argc, char *argv[]) { void *fdt = &_truncated_property; const void *prop; - int err; int len; test_init(argc, argv); @@ -43,7 +42,7 @@ int main(int argc, char *argv[]) FAIL("fdt_getprop() succeeded on truncated property"); if (len != -FDT_ERR_BADSTRUCTURE) FAIL("fdt_getprop() failed with \"%s\" instead of \"%s\"", - fdt_strerror(err), fdt_strerror(-FDT_ERR_BADSTRUCTURE)); + fdt_strerror(len), fdt_strerror(-FDT_ERR_BADSTRUCTURE)); PASS(); } |