[PATCH RFC 01/11] libdwfl: Fix debuginfod_client redefinition
Ilya Leoshkevich
iii@linux.ibm.com
Tue Feb 7 19:47:24 GMT 2023
On Tue, 2023-02-07 at 20:22 +0100, Mark Wielaard wrote:
> Hi Ilyam
>
> On Mon, Feb 06, 2023 at 11:25:03PM +0100, Ilya Leoshkevich via
> Elfutils-devel wrote:
> > clang complains:
> >
> > In file included from debuginfod-client.c:38:
> > ./../debuginfod/debuginfod.h:47:34: error: redefinition of
> > typedef 'debuginfod_client' is a C11 feature [-Werror,-Wtypedef-
> > redefinition]
> > typedef struct debuginfod_client debuginfod_client;
> > ^
> > ./libdwfl.h:53:34: note: previous definition is here
> > typedef struct debuginfod_client debuginfod_client;
> > ^
> >
> > config/eu.am specifies -std=gnu99, and upgrading just for this is
> > an
> > overkill. So is #including "debuginfod.h", since we don't know if
> > users
> > even have it. So fix by using "struct debuginfod_client" instead.
> > This
> > may break the clients that use dwfl_get_debuginfod_client() without
> > #including "debuginfod.h", but such cases should be rare.
>
> This was recently reported by someone else and fixed differently:
>
> commit 45576ab5f24cd39669a418fa8e005b4d04f8e9ca
> Author: Mark Wielaard <mark@klomp.org>
> Date: Mon Feb 6 10:21:58 2023 +0100
>
> debuginfod: Make sure there is only one typedef for
> debuginfod_client
>
> Both debuginfod.h and libdwfl.h have a simple typedef for struct
> debuginfod_client. Some compilers pedantically warn when
> including
> both headers that such typedefs are only officially supported in
> C11. So guard them with _ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF to
> make them happy.
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=30077
>
> Signed-off-by: Mark Wielaard <mark@klomp.org>
>
> Does that work for you?
>
> Thanks,
>
> Mark
Thanks, this works. This patch can be dropped.
More information about the Elfutils-devel
mailing list