buildroot/package/musl-compat-headers/cdefs.h
Yann E. MORIN e31eb72040 package/musl-compat-headers: provide compatibility headers not in musl
musl provides neither sys/queue.h nor sys/cdefs.h. Those two headers are
however quite widely used in a lot of packages (though they should at
least not use cdefs.h which is only full of mostly-legacy macros, and
which is mostly an internal header of glibc and was never really meant to
be exposed to, and used by packages).

But we don't live in an ideal world, so a lot of packages break when
those two headers are missing.

We already took care of sys/queue.h with the netbsd-queue package. But
the need for cdefs.h is getting more and more pressing.

We rename the netbsd-queue package into musl-compat-headers, and we
make it install sys/queue.h (from NetBSD) and sys/cdefs.h (a minimalist
one we bundle in Buildroot). We can't use the cdefs.h from NetBSD
because it includes machine-dependent headers; instead we bundle a very
minimalistic one, that covers only what we need.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-08-19 11:29:12 +02:00

52 lines
1.3 KiB
C

/* Copyright (C) 2016 Yann E. MORIN <yann.morin.1998@free.fr>
*
* This file is in the Public Domain.
*
* For jurisdictions in which the Public Domain does not exist
* or it is not otherwise applicable, this file is licensed CC0
* (Creative Commons Zero).
*/
/* This file contains definitions for non-standard macros defined by
* glibc, but quite commonly used in packages.
*
* Because they are non-standard, musl does not define those macros.
* It does not provide cdefs.h either.
*
* This file is a compatibility header written from scratch, to be
* installed when the C library is musl.
*
* Not all macros from the glibc's cdefs.h are available, only the
* most commonly used ones.
*
* Please refer to the glibc documentation and source code for
* explanations about those macros.
*/
#ifndef BUILDROOT_SYS_CDEFS_H
#define BUILDROOT_SYS_CDEFS_H
/* Function prototypes. */
#undef __P
#define __P(arg) arg
/* C declarations in C++ mode. */
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS
# define __END_DECLS
#endif
/* Don't throw exceptions in C functions. */
#ifndef __cplusplus
# define __THROW __attribute__ ((__nothrow__))
# define __NTH(f) __attribute__ ((__nothrow__)) f
#else
# define __THROW
# define __NTH(f) f
#endif
#endif /* ifndef BUILDROOT_SYS_CDEFS_H */