Re: [PATCH] lib/curl_poll.h: fix header guard collision with musl libc

Baruch Siach <[email protected]>
Newsgroups gmane.comp.hardware.lirc
Message-ID <[email protected]>
Hi Alec,

On Sat, Jun 24, 2017 at 11:31:14AM +0200, Alec Leamas wrote:
> Thanks for patch! It's committed on the release branch[1], and will make it
> into the final release.

Thanks.

> Does it build OK against the musl libc with this patch?

Yes. I needed this patch to update the Buildroot package. Since Buildroot uses 
the release tarball, I had to also patch the lib/lirc/ copy of curl_poll.h. 
See http://patchwork.ozlabs.org/patch/780406/. As I understand, this copy will 
also be updated in the next release tarball, right?

> [1] https://sourceforge.net/p/lirc/git/ci/e07a80aa00a14fc98d7347afa1fa44282732b27f/

baruch

> On 23/06/17 17:35, Baruch Siach wrote:
> > The musl libc uses the _POLL_H macro as a double include guard for the poll.h
> > header. This breaks compilation of files the include curl_poll.h:
> > 
> > In file included from driver.h:32:0,
> >                   from driver.c:12:
> > lirc/curl_poll.h:38:29: error: array type has incomplete element type ‘struct pollfd’
> >   int curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms);
> >                               ^~~~
> > 
> > Rename the curl_poll.h header guard macro to avoid collision. Don't use a name
> > that starts with an underscore and a capital letter since these names are
> > reserved according to the ANSI C standard.
> > 
> > https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html
> > 
> > Signed-off-by: Baruch Siach<[email protected]>
> > ---
> >   lib/curl_poll.h | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/lib/curl_poll.h b/lib/curl_poll.h
> > index c8813859eca6..c0162b66718b 100644
> > --- a/lib/curl_poll.h
> > +++ b/lib/curl_poll.h
> > @@ -1,5 +1,5 @@
> > -#ifndef _POLL_H
> > -#define _POLL_H
> > +#ifndef HEADER_LIB_CURL_POLL_H
> > +#define HEADER_LIB_CURL_POLL_H
> >   /***************************************************************************
> >    *                                  _   _ ____  _
> >    *  Project                     ___| | | |  _ \| |
> > @@ -44,4 +44,4 @@ int curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms);
> >   #endif
> > -#endif /* _POLL_H */
> > +#endif /* HEADER_LIB_CURL_POLL_H */
> > -- 2.11.0

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.