[PATCH weston] make error() portable
Pekka Paalanen
ppaalanen at gmail.com
Mon Jun 1 00:32:15 PDT 2015
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?
Thanks,
pq
More information about the wayland-devel
mailing list