Re: [DTC][RFC] dtc: Allow better error reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 17-02-21, 16:07, David Gibson wrote:
> > diff --git a/dtc.h b/dtc.h
> > index d3e82fb8e3db..b8ffec155263 100644
> > --- a/dtc.h
> > +++ b/dtc.h
> > @@ -29,6 +29,12 @@
> >  #define debug(...)
> >  #endif
> >  
> > +#ifdef VERBOSE
> > +#define dtc_err(fmt, ...)	fprintf(stderr, "DTC: %s: %d: " fmt, __func__, __LINE__, ##__VA_ARGS__)
> > +#else
> > +#define dtc_err(fmt, ...)
> > +#endif
> 
> Actually, the natural way to handle this is to make dtc_err() -
> hrm... bad name, since this is libfdt - be something that must be
> provided by libfdt_env.h.  The default version would have it be a
> no-op, with a define that makes it use stdio.
> 
> This has the additional advantage that it would be relatively
> straightfoward to enable the rich reporting in a non-POSIXish
> environment (these should provide their own libfdt_env.h and it can
> implement the error reporting callback in a way that makes sense in
> that environment.

Okay, I will move it to libfdt_env.h. And using -DVERBOSE to enable
rich errors look fine to you, right ?

> You will also definitely need Makefile changes, because you'll need to
> make the fdtoverlay binary link to the verbose-compiled version of
> libfdt not the normal one.

Actually it worked for me because of how we compile this in kernel, we
don't link different libraries there.

libfdt-objs     := fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o fdt_empty_tree.o fdt_addresses.o fdt_overlay.o
libfdt          = $(addprefix libfdt/,$(libfdt-objs))
fdtoverlay-objs := $(libfdt) fdtoverlay.o util.o

HOST_EXTRACFLAGS := -DVERBOSE

> Except.... it might make more sense to do this in dtc rather than
> libfdt, more on that in different mails.

I am not sure about this comment, are you going to send more emails on
this ?

-- 
viresh



[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux