From 89393d9335a96395aea8ea3ff3f05eedd96cebb7 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Wed, 1 Mar 2017 20:36:39 +0100 Subject: [PATCH] Clean up the namespace in a number of standard headers. * In most cases, instead of the full load of , include which defines the __-types that , , , and only need. * Additionally, extend the visibility of the size_t definition and adjust WRDE_NOSYS's visibility because it was only in the standard up to Issue 6. * In , include to get at __pid_t too. * Likewise, include in and provide a definition of pid_t as required. --- include/monetary.h | 2 +- include/pwd.h | 12 ++++++------ include/search.h | 2 +- include/strings.h | 2 +- include/time.h | 2 +- include/wordexp.h | 6 +++--- sys/sys/wait.h | 7 +++++-- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/include/monetary.h b/include/monetary.h index 3c9e1df118..80464514be 100644 --- a/include/monetary.h +++ b/include/monetary.h @@ -30,7 +30,7 @@ #define _MONETARY_H_ #include -#include +#include #ifndef _SIZE_T_DECLARED typedef __size_t size_t; diff --git a/include/pwd.h b/include/pwd.h index f4edf7c54c..166520a80e 100644 --- a/include/pwd.h +++ b/include/pwd.h @@ -39,13 +39,18 @@ #define _PWD_H_ #include -#include +#include #ifndef _GID_T_DECLARED typedef __uint32_t gid_t; #define _GID_T_DECLARED #endif +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED @@ -56,11 +61,6 @@ typedef __uint32_t uid_t; #define _UID_T_DECLARED #endif -#ifndef _SIZE_T_DECLARED -typedef __size_t size_t; -#define _SIZE_T_DECLARED -#endif - #define _PATH_PWD "/etc" #define _PATH_PASSWD "/etc/passwd" #define _PASSWD "passwd" diff --git a/include/search.h b/include/search.h index d3a6127a1b..fa80b697c1 100644 --- a/include/search.h +++ b/include/search.h @@ -10,7 +10,7 @@ #define _SEARCH_H_ #include -#include +#include #ifndef _SIZE_T_DECLARED typedef __size_t size_t; diff --git a/include/strings.h b/include/strings.h index 65a999299c..1e82a759be 100644 --- a/include/strings.h +++ b/include/strings.h @@ -30,7 +30,7 @@ #define _STRINGS_H_ #include -#include +#include #ifndef _SIZE_T_DECLARED typedef __size_t size_t; diff --git a/include/time.h b/include/time.h index 14d96d7aa7..1dde064176 100644 --- a/include/time.h +++ b/include/time.h @@ -43,7 +43,7 @@ #include #include -#include +#include #if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE /* diff --git a/include/wordexp.h b/include/wordexp.h index 197a0e0553..bdae3d747e 100644 --- a/include/wordexp.h +++ b/include/wordexp.h @@ -30,9 +30,9 @@ #define _WORDEXP_H_ #include -#include +#include -#if __XSI_VISIBLE && !defined(_SIZE_T_DECLARED) +#ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif @@ -62,7 +62,7 @@ typedef struct { #define WRDE_BADVAL 2 /* undefined variable */ #define WRDE_CMDSUB 3 /* command substitution not allowed */ #define WRDE_NOSPACE 4 /* no memory for result */ -#if __XSI_VISIBLE +#if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 700) #define WRDE_NOSYS 5 /* obsolete, reserved */ #endif #define WRDE_SYNTAX 6 /* shell syntax error */ diff --git a/sys/sys/wait.h b/sys/sys/wait.h index 02bb8029a7..ecbd953d6b 100644 --- a/sys/sys/wait.h +++ b/sys/sys/wait.h @@ -89,8 +89,11 @@ #endif /* __BSD_VISIBLE */ #if !defined(_KERNEL) || defined(_KERNEL_VIRTUAL) -#ifndef _SYS_TYPES_H_ -#include +#include + +#ifndef _PID_T_DECLARED +typedef __pid_t pid_t; /* process id */ +#define _PID_T_DECLARED #endif __BEGIN_DECLS -- 2.41.0