[PATCH weston] make error() portable

Pekka Paalanen ppaalanen at gmail.com
Thu Apr 27 09:26:53 UTC 2017


On Mon, 1 Jun 2015 10:32:15 +0300
Pekka Paalanen <ppaalanen at gmail.com> wrote:

> On Sat, 30 May 2015 12:08:22 -0700
> Khem Raj <raj.khem at gmail.com> wrote:
> 
> >   
> > > On May 30, 2015, at 12:02 PM, Jon A. Cruz <jonc at osg.samsung.com> wrote:
> > > 
> > > On 05/29/2015 09:14 PM, Khem Raj wrote:  
> > >> error() is not posix but gnu extension so may not be available on all
> > >> kind of systemsi e.g. musl.  
> > > 
> > > Hi,
> > > 
> > > Just including a few low-level notes.
> > >   
> > >> 
> > >> Signed-off-by: Khem Raj <raj.khem at gmail.com>
> > >> ---
> > >> configure.ac        |  2 ++
> > >> src/weston-error.h  | 20 ++++++++++++++++++++
> > >> src/weston-launch.c |  2 +-
> > >> 3 files changed, 23 insertions(+), 1 deletion(-)
> > >> create mode 100644 src/weston-error.h
> > >> 
> > >> diff --git a/configure.ac b/configure.ac
> > >> index 263fc22..f52cd62 100644
> > >> --- a/configure.ac
> > >> +++ b/configure.ac
> > >> @@ -57,6 +57,8 @@ AC_CHECK_DECL(CLOCK_MONOTONIC,[],
> > >> 	      [[#include <time.h>]])
> > >> AC_CHECK_HEADERS([execinfo.h])
> > >> 
> > >> +AC_CHECK_HEADERS([error.h])
> > >> +  
> > > 
> > > A check should probably also be added for err.h also since its functions
> > > are non-standard BSD extensions.  
> 
> 
> > > 
> > > Functionally it seems to make sense. Do you happen to know which
> > > platforms/scenarios need this?
> > >   
> > 
> > I will address the reviews in a follow up
> > 
> > I am using musl for C library, and musl implements just POSIX
> > currently we are too tied to glibc behavior without this patch.  
> 
> Is this really one of the biggest issues? If so, I'm impressed. We use
> gnu extensions all over, like %m.
> 
> Since error() seems to be used only by weston-launch.c, how about
> adding just a plain replacement function there?
> 
> It would avoid the configure check and conditionally compiled code
> (both of which are prone to break, because very few people would test
> on platforms where they are needed). That way we'd also avoid
> dependency to err.h in case that's also a problem for someone.
> 
> What would people think about that?

Incidentally bumping into this patch again, I do not think is it good
replace a GNU extension with a BSD extension.

Just write a complete replacement for error() to be used in
weston-launch.c alone. No configure checks necessary.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20170427/f5c1db6a/attachment.sig>


More information about the wayland-devel mailing list