This is the mail archive of the mailing list for the elfutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: nonnull Re: [PATCH] Fix type warnings from clang compiler.

> extern Elf *dwfl_module_getelf (Dwfl_Module *, GElf_Addr *bias)
>   __nonnull_attribute__ (1, 2);
> I believe in this case the first argument should not be nonnull.
> Since we would expect people to be able to chain for example the
> dwfl_addrmodule () call followed by a dwfl_module_getelf () call.
> So the correct fix in that case seems to be the removal of the nonnull
> attribute for the first argument and leave the NULL check against mod in
> the implementation.


> There is one other case where I am not totally sure the nonnull
> attribute was intended is for the internal function
> __libdw_visit_scopes. It was rewritten from having just one (pre)visit
> function to having both a previsit and postvisit callback function. In
> all cases we are using it with a previsit one. But maybe the intention
> was that you could only supply a postvisit one and keep the previsit one

That sounds like a generally reasonable thing, and obviously I always did
the reasonable thing because I'm so reasonable.  But as it is an internal
function with few callers, tailoring it slightly to its extant callers is
certainly sensible.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]