Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce pollution in stddef.h and stdarg.h #1595

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions include/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ INCS= a.out.h ar.h assert.h bitstring.h byteswap.h \
.PATH: ${SRCTOP}/contrib/libc-vis
INCS+= vis.h

MHDRS= float.h floatingpoint.h stdarg.h
MHDRS= float.h floatingpoint.h

PHDRS= _semaphore.h
PHDRS= _semaphore.h stdarg.h

LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
syslog.h ucontext.h
Expand Down
1 change: 1 addition & 0 deletions include/dlfcn.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#ifndef _DLFCN_H_
#define _DLFCN_H_

#include <sys/cdefs.h>
#include <sys/_types.h>

/*
Expand Down
6 changes: 4 additions & 2 deletions include/stddef.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#ifndef _STDDEF_H_
#define _STDDEF_H_

#include <sys/cdefs.h>
#include <sys/_null.h>
#include <sys/_types.h>
#include <sys/_visible.h>

#ifndef _PTRDIFF_T_DECLARED
typedef __ptrdiff_t ptrdiff_t;
Expand All @@ -61,7 +61,9 @@ typedef __max_align_t max_align_t;
#endif
#endif

#define offsetof(type, field) __offsetof(type, field)
#ifndef offsetof
#define offsetof(type, field) __builtin_offsetof(type, field)
#endif

#if __EXT1_VISIBLE
/* ISO/IEC 9899:2011 K.3.3.2 */
Expand Down
2 changes: 1 addition & 1 deletion include/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ typedef __off64_t off64_t;

#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#ifndef _VA_LIST_DECLARED
typedef __va_list va_list;
typedef __builtin_va_list va_list;
#define _VA_LIST_DECLARED
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion include/wchar.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ typedef __size_t size_t;

#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
#ifndef _VA_LIST_DECLARED
typedef __va_list va_list;
typedef __builtin_va_list va_list;
#define _VA_LIST_DECLARED
#endif
#endif
Expand Down
1 change: 1 addition & 0 deletions lib/msun/src/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#ifndef _MATH_H_
#define _MATH_H_

#include <sys/cdefs.h>
#include <sys/_types.h>
#include <machine/_limits.h>

Expand Down
2 changes: 1 addition & 1 deletion share/man/man9/PCI_IOV_ADD_VF.9
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
.Nd inform a PF driver that a VF is being created
.Sh SYNOPSIS
.In sys/bus.h
.In machine/stdarg.h
.In sys/stdarg.h
.In sys/nv.h
.In dev/pci/pci_iov.h
.Ft int
Expand Down
2 changes: 1 addition & 1 deletion share/man/man9/PCI_IOV_INIT.9
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
.Nd enable SR-IOV on a PF device
.Sh SYNOPSIS
.In sys/bus.h
.In machine/stdarg.h
.In sys/stdarg.h
.In sys/nv.h
.In dev/pci/pci_iov.h
.Ft int
Expand Down
2 changes: 1 addition & 1 deletion share/man/man9/pci_iov_schema.9
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
.Nm pci_iov_schema_add_unicast_mac
.Nd PCI SR-IOV config schema interface
.Sh SYNOPSIS
.In machine/stdarg.h
.In sys/stdarg.h
.In sys/nv.h
.In sys/iov_schema.h
.Ft nvlist_t *
Expand Down
3 changes: 2 additions & 1 deletion stand/common/dev_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@
* for use by the NFS open code (NFS/lookup).
*/

#include <machine/stdarg.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stdarg.h>

#include <net/if.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
Expand Down
2 changes: 1 addition & 1 deletion stand/common/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <sys/param.h>
#include <sys/endian.h>
#include <sys/queue.h>
#include <machine/stdarg.h>
#include <sys/stdarg.h>

#include "bootstrap.h"

Expand Down
4 changes: 3 additions & 1 deletion stand/efi/boot1/boot1.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
*/

#include <sys/param.h>
#include <sys/stdarg.h>

#include <machine/elf.h>
#include <machine/stdarg.h>

#include <stand.h>

#include <efi.h>
Expand Down
4 changes: 3 additions & 1 deletion stand/efi/boot1/proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
*/

#include <sys/param.h>
#include <sys/stdarg.h>

#include <machine/elf.h>
#include <machine/stdarg.h>

#include <stand.h>

#include <efi.h>
Expand Down
4 changes: 3 additions & 1 deletion stand/efi/gptboot/proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
*/

#include <sys/param.h>
#include <sys/stdarg.h>

#include <machine/elf.h>
#include <machine/stdarg.h>

#include <stand.h>

#include <efi.h>
Expand Down
2 changes: 1 addition & 1 deletion stand/i386/libi386/biosacpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

#include <stand.h>
#include <machine/stdarg.h>
#include <sys/stdarg.h>
#include <bootstrap.h>
#include <btxv86.h>
#include "libi386.h"
Expand Down
2 changes: 1 addition & 1 deletion stand/i386/libi386/biospci.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/

#include <stand.h>
#include <machine/stdarg.h>
#include <sys/stdarg.h>
#include <bootstrap.h>
#include <isapnp.h>
#include <btxv86.h>
Expand Down
2 changes: 1 addition & 1 deletion stand/i386/libi386/biospnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/

#include <stand.h>
#include <machine/stdarg.h>
#include <sys/stdarg.h>
#include <bootstrap.h>
#include <isapnp.h>
#include <btxv86.h>
Expand Down
2 changes: 1 addition & 1 deletion stand/liblua/lstd.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@

#include <stand.h>
#include <sys/types.h>
#include <sys/stdarg.h>
#include <sys/stdint.h>
#include <limits.h>
#include <string.h>
#include <machine/stdarg.h>

/*
* Mini stdio FILE and DIR routines. These are the minimal routines needed by
Expand Down
3 changes: 1 addition & 2 deletions stand/libofw/ofw_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@
*/

#include <sys/param.h>
#include <sys/stdarg.h>

#include <netinet/in.h>

#include <machine/stdarg.h>

#include <stand.h>
#include <sys/disk.h>

Expand Down
3 changes: 1 addition & 2 deletions stand/libofw/openfirm.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
*/

#include <sys/endian.h>

#include <machine/stdarg.h>
#include <sys/stdarg.h>

#include <stand.h>

Expand Down
2 changes: 1 addition & 1 deletion stand/libsa/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ beforedepend:
for i in ${SAFE_INCS}; do \
ln -sf ${SRCTOP}/include/$$i $$i; \
done; \
ln -sf ${SYSDIR}/${MACHINE}/include/stdarg.h stdarg.h; \
ln -sf ${SYSDIR}/sys/errno.h errno.h; \
ln -sf ${SYSDIR}/sys/stdarg.h stdarg.h; \
ln -sf ${SYSDIR}/sys/stdint.h stdint.h; \
ln -sf ${SRCTOP}/include/arpa/inet.h arpa/inet.h; \
ln -sf ${SRCTOP}/include/arpa/tftp.h arpa/tftp.h; \
Expand Down
2 changes: 1 addition & 1 deletion stand/libsa/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/

#include <stand.h>
#include <machine/stdarg.h>
#include <sys/stdarg.h>

/*
* Boot loaders and other standalone programs that wish to have a
Expand Down
7 changes: 1 addition & 6 deletions stand/libsa/printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,13 @@
*/

#include <sys/types.h>
#include <sys/stdarg.h>
#include <sys/stddef.h>
#include <sys/stdint.h>
#include <limits.h>
#include <string.h>
#include "stand.h"

/*
* Note that stdarg.h and the ANSI style va_start macro is used for both
* ANSI and traditional C compilers.
*/
#include <machine/stdarg.h>

#define MAXNBUF (sizeof(intmax_t) * CHAR_BIT + 1)

typedef void (kvprintf_fn_t)(int, void *);
Expand Down
4 changes: 3 additions & 1 deletion stand/powerpc/boot1.chrp/boot1.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
#include <sys/param.h>
#include <sys/dirent.h>
#include <sys/endian.h>
#include <sys/stdarg.h>

#include <machine/elf.h>
#include <machine/stdarg.h>
#include <machine/md_var.h>

#include <ufs/ffs/fs.h>

#include "paths.h"
Expand Down
3 changes: 2 additions & 1 deletion stand/uboot/uboot_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@

#include <sys/param.h>
#include <sys/disk.h>
#include <machine/stdarg.h>
#include <sys/stdarg.h>

#include <stand.h>

#include "api_public.h"
Expand Down
2 changes: 1 addition & 1 deletion sys/amd64/linux/linux_vdso_gtod.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <sys/elf.h>
#include <sys/errno.h>
#include <sys/proc.h>
#include <sys/stdarg.h>
#include <sys/stddef.h>
#define _KERNEL
#include <sys/vdso.h>
Expand All @@ -36,7 +37,6 @@

#include <machine/atomic.h>
#include <machine/cpufunc.h>
#include <machine/stdarg.h>

#include <amd64/linux/linux.h>
#include <amd64/linux/linux_syscall.h>
Expand Down
4 changes: 1 addition & 3 deletions sys/arm/include/stdarg.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

#include <sys/_stdarg.h>

#ifndef va_start
#error this file needs to be ported to your compiler
#endif
#warning "machine/stdarg.h is obsolete, use sys/stdarg.h"

#endif /* !_MACHINE_STDARG_H_ */
2 changes: 1 addition & 1 deletion sys/arm/ti/cpsw/if_cpsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
#include <sys/rman.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/stdarg.h>
#include <sys/sysctl.h>

#include <machine/bus.h>
#include <machine/resource.h>
#include <machine/stdarg.h>

#include <net/ethernet.h>
#include <net/bpf.h>
Expand Down
2 changes: 1 addition & 1 deletion sys/arm/xilinx/zy7_devcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/stdarg.h>
#include <sys/sysctl.h>
#include <sys/lock.h>
#include <sys/mutex.h>
Expand All @@ -49,7 +50,6 @@

#include <machine/bus.h>
#include <machine/resource.h>
#include <machine/stdarg.h>

#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
Expand Down
2 changes: 1 addition & 1 deletion sys/arm/xilinx/zy7_ehci.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
#include <sys/condvar.h>
#include <sys/resource.h>
#include <sys/rman.h>
#include <sys/stdarg.h>

#include <machine/bus.h>
#include <machine/resource.h>
#include <machine/stdarg.h>

#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
Expand Down
2 changes: 1 addition & 1 deletion sys/arm/xilinx/zy7_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
#include <sys/mutex.h>
#include <sys/resource.h>
#include <sys/rman.h>
#include <sys/stdarg.h>
#include <sys/gpio.h>

#include <machine/bus.h>
#include <machine/resource.h>
#include <machine/stdarg.h>

#include <dev/gpio/gpiobusvar.h>
#include <dev/ofw/ofw_bus.h>
Expand Down
2 changes: 1 addition & 1 deletion sys/arm/xilinx/zy7_qspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
#include <sys/mutex.h>
#include <sys/resource.h>
#include <sys/rman.h>
#include <sys/stdarg.h>
#include <sys/uio.h>

#include <machine/bus.h>
#include <machine/resource.h>
#include <machine/stdarg.h>

#include <dev/fdt/fdt_common.h>
#include <dev/ofw/ofw_bus.h>
Expand Down
2 changes: 1 addition & 1 deletion sys/arm/xilinx/zy7_slcr.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/resource.h>
#include <sys/stdarg.h>
#include <sys/sysctl.h>
#include <sys/rman.h>

#include <machine/bus.h>
#include <machine/resource.h>
#include <machine/stdarg.h>

#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
Expand Down
2 changes: 1 addition & 1 deletion sys/arm/xilinx/zy7_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
#include <sys/mutex.h>
#include <sys/resource.h>
#include <sys/rman.h>
#include <sys/stdarg.h>
#include <sys/uio.h>

#include <machine/bus.h>
#include <machine/resource.h>
#include <machine/stdarg.h>

#include <dev/fdt/fdt_common.h>
#include <dev/ofw/ofw_bus.h>
Expand Down
Loading