From patchwork Wed Jun 26 17:50:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 33427 Received: (qmail 11960 invoked by alias); 26 Jun 2019 17:50:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 11597 invoked by uid 89); 26 Jun 2019 17:50:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_PASS autolearn=ham version=3.3.1 spammy=arrangement, Exchange, 81 X-HELO: mailbackend.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 10/25] Swap sys/syslog.h with syslog.h. Date: Wed, 26 Jun 2019 13:50:14 -0400 Message-Id: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 Our installed syslog.h is a trivial wrapper around sys/syslog.h, which is where all the actual declarations are. This is backward from POSIX, which specifies syslog.h and its contents, and does not specify sys/syslog.h. This arrangement appears to have been inherited from some BSD-phylum C library, and probably pre-dates any standardization of syslog. This patch swaps the contents of syslog.h and sys/syslog.h, so that the actual declarations appear under the standardized name. Since it is necessary to adjust all of syslog.h’s bits headers, I also added multiple-include guards to those files that didn’t already have them. (All installed headers should have multiple-include guards, even if they are internal and only used in one public header. The “never include this file directly” #error convention doesn’t protect against including the internal header a second time after its parent header has already been included.) * misc/sys/syslog.h: Exchange contents with... * misc/syslog.h: ...this file. Adjust multiple-include guards. * include/sys/syslog.h: Exchange contents with... * include/syslog.h: ...this file. Adjust multiple-include guards. * bits/syslog-path.h, misc/bits/syslog-ldbl.h * misc/bits/syslog.h: Allow inclusion by syslog.h, not sys/syslog.h. Add multiple-include guard where not already present. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update. --- bits/syslog-path.h | 8 +- include/sys/syslog.h | 19 +-- include/{sys => }/syslog.h | 5 +- misc/bits/syslog-ldbl.h | 9 +- misc/bits/syslog.h | 9 +- misc/sys/syslog.h | 218 +-------------------------- misc/{sys => }/syslog.h | 4 +- scripts/check-obsolete-constructs.py | 2 +- 8 files changed, 29 insertions(+), 245 deletions(-) rewrite include/sys/syslog.h (93%) copy include/{sys => }/syslog.h (81%) rewrite misc/sys/syslog.h (99%) copy misc/{sys => }/syslog.h (99%) diff --git a/bits/syslog-path.h b/bits/syslog-path.h index 5b97fa7db5..5677f468b5 100644 --- a/bits/syslog-path.h +++ b/bits/syslog-path.h @@ -16,13 +16,13 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_SYSLOG_H -# error "Never include this file directly. Use instead" -#endif - #ifndef _BITS_SYSLOG_PATH_H #define _BITS_SYSLOG_PATH_H 1 +#ifndef _SYSLOG_H +# error "Never include directly. Use instead" +#endif + #define _PATH_LOG "/dev/log" #endif /* bits/syslog-path.h */ diff --git a/include/sys/syslog.h b/include/sys/syslog.h dissimilarity index 93% index 89d3479ebc..7d6e3bc46c 100644 --- a/include/sys/syslog.h +++ b/include/sys/syslog.h @@ -?,? +1,3 @@ +#ifndef _SYSLOG_H +#include +#endif diff --git a/include/sys/syslog.h b/include/syslog.h similarity index 81% copy from include/sys/syslog.h copy to include/syslog.h index 89d3479ebc..5dc6e76b7e 100644 --- a/include/sys/syslog.h +++ b/include/syslog.h @@ -1,6 +1,5 @@ -#ifndef _LIBC_SYS_SYSLOG_H -#define _LIBC_SYS_SYSLOG_H 1 -#include +#ifndef _SYSLOG_H +# include #ifndef _ISOMAC libc_hidden_proto (syslog) diff --git a/misc/bits/syslog-ldbl.h b/misc/bits/syslog-ldbl.h index e3117552ae..4c2eea74e6 100644 --- a/misc/bits/syslog-ldbl.h +++ b/misc/bits/syslog-ldbl.h @@ -16,8 +16,11 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_SYSLOG_H -# error "Never include directly; use instead." +#ifndef _BITS_SYSLOG_LDBL_H +#define _BITS_SYSLOG_LDBL_H 1 + +#ifndef _SYSLOG_H +# error "Never include directly; use instead." #endif __LDBL_REDIR_DECL (syslog) @@ -33,3 +36,5 @@ __LDBL_REDIR_DECL (__syslog_chk) __LDBL_REDIR_DECL (__vsyslog_chk) # endif #endif + +#endif /* bits/syslog-ldbl.h */ diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h index 86d94536ee..e796955c1c 100644 --- a/misc/bits/syslog.h +++ b/misc/bits/syslog.h @@ -16,8 +16,11 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_SYSLOG_H -# error "Never include directly; use instead." +#ifndef _BITS_SYSLOG_H +#define _BITS_SYSLOG_H 1 + +#ifndef _SYSLOG_H +# error "Never include directly; use instead." #endif @@ -47,3 +50,5 @@ vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } #endif + +#endif /* bits/syslog.h */ diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h dissimilarity index 99% index ee01478c4b..9fc15930fb 100644 --- a/misc/sys/syslog.h +++ b/misc/sys/syslog.h @@ -?,? +1,3 @@ +#ifndef _SYSLOG_H +# include +#endif diff --git a/misc/sys/syslog.h b/misc/syslog.h similarity index 99% copy from misc/sys/syslog.h copy to misc/syslog.h index ee01478c4b..406133ba71 100644 --- a/misc/sys/syslog.h +++ b/misc/syslog.h @@ -29,8 +29,8 @@ * @(#)syslog.h 8.1 (Berkeley) 6/2/93 */ -#ifndef _SYS_SYSLOG_H -#define _SYS_SYSLOG_H 1 +#ifndef _SYSLOG_H +#define _SYSLOG_H 1 #include #define __need___va_list diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 5efe824b8d..c437c8e00b 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -635,12 +635,12 @@ HEADER_ALLOWED_INCLUDES = { "memory.h": [ "string.h" ], "poll.h": [ "sys/poll.h" ], "re_comp.h": [ "regex.h" ], - "syslog.h": [ "sys/syslog.h" ], "sys/bitypes.h": [ "sys/types.h" ], "sys/dir.h": [ "dirent.h" ], "sys/errno.h": [ "errno.h" ], "sys/fcntl.h": [ "fcntl.h" ], "sys/signal.h": [ "signal.h" ], + "sys/syslog.h": [ "syslog.h" ], "sys/termios.h": [ "termios.h" ], "sys/unistd.h": [ "unistd.h" ], "syscall.h": [ "sys/syscall.h" ],