Re: dtc: Enable and fix -Wpointer-arith warnings

Jon Loeliger
2008-07-14T18:59:59Z

> This patch turns on the -Wpointer-arith option in the dtc Makefile,
> and fixes the resulting warnings due to using (void *) in pointer
> arithmetic. While convenient, pointer arithmetic on void * is not
> portable, so it's better that we avoid it, particularly in libfdt.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

This patch didn't apply. I tracked it down to bad context
in the Makefile where this appeared:

> CPPFLAGS += -std=c99 -D_XOPEN_SOURCE -D_BSD_SOURCE
> CFLAGS += -Werror

but the file had this instead:

> BISON = bison
> LEX = flex

in this part:

> Index: dtc/Makefile
> ===================================================================
> --- dtc.orig/Makefile 2008-07-04 11:48:05.000000000 +1000
> +++ dtc/Makefile 2008-07-04 16:54:42.000000000 +1000
> @@ -16,7 +16,7 @@
> CONFIG_LOCALVERSION =
>
> CPPFLAGS = -I libfdt
> -CFLAGS = -Wall -g -Os
> +CFLAGS = -Wall -g -Os -Wpointer-arith
>
> CPPFLAGS += -std=c99 -D_XOPEN_SOURCE -D_BSD_SOURCE
> CFLAGS += -Werror

Again, I hand whacked-the patch mail and applied it.

For the love-of-Pete, please use git.

jdl