Page MenuHomeFreeBSD

D41983.diff
No OneTemporary

D41983.diff

diff --git a/include/_ctype.h b/include/_ctype.h
--- a/include/_ctype.h
+++ b/include/_ctype.h
@@ -46,6 +46,12 @@
#include <sys/cdefs.h>
#include <sys/_types.h>
+/*
+ * The markers below allow bootstrap build of localedef to extract the required
+ * ctype definitions without directly including this header.
+ */
+
+/* BEGIN CTYPEDEFS */
#define _CTYPE_A 0x00000100L /* Alpha */
#define _CTYPE_C 0x00000200L /* Control */
#define _CTYPE_D 0x00000400L /* Digit */
@@ -67,6 +73,7 @@
#define _CTYPE_SW3 0xc0000000L /* 3 width character */
#define _CTYPE_SWM 0xe0000000L /* Mask for screen width data */
#define _CTYPE_SWS 30 /* Bits to shift to get width */
+/* END CTYPEDEFS */
/* See comments in <sys/_types.h> about __ct_rune_t. */
__BEGIN_DECLS
diff --git a/usr.bin/localedef/Makefile b/usr.bin/localedef/Makefile
--- a/usr.bin/localedef/Makefile
+++ b/usr.bin/localedef/Makefile
@@ -16,7 +16,7 @@
${SRCS:M*.c}: parser.h
parser.h: parser.y
-IGNORE_PRAGMA= yes
+ctype.c: ctypedefs.h
CFLAGS+= -I. -I${.CURDIR}
.if defined(BOOTSTRAPPING)
@@ -25,4 +25,7 @@
CFLAGS+= -I${SRCTOP}/lib/libc/locale
CFLAGS+= -I${SRCTOP}/lib/libc/stdtime
+ctypedefs.h: ${SRCTOP}/include/_ctype.h
+ sed -n '/BEGIN CTYPEDEF/,/END CTYPEDEF/p' ${.ALLSRC} >${.TARGET}
+
.include <bsd.prog.mk>
diff --git a/usr.bin/localedef/bootstrap/_ctype.h b/usr.bin/localedef/bootstrap/_ctype.h
deleted file mode 100644
--- a/usr.bin/localedef/bootstrap/_ctype.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright 2018-2020 Alex Richardson <arichardson@FreeBSD.org>
- *
- * This software was developed by SRI International and the University of
- * Cambridge Computer Laboratory (Department of Computer Science and
- * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
- * DARPA SSITH research programme.
- *
- * This software was developed by SRI International and the University of
- * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
- * ("CTSRD"), as part of the DARPA CRASH research programme.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * We have to ensure that we use the same constants as the target system when
- * bootstrapping localedef so that we generate compatible databases.
- */
-#ifndef __FreeBSD__
-typedef int __ct_rune_t; /* arg type for ctype funcs */
-typedef __ct_rune_t __rune_t; /* rune_t (see above) */
-typedef __ct_rune_t __wint_t; /* wint_t (see above) */
-#endif
-#include "../../include/_ctype.h"
diff --git a/usr.bin/localedef/ctype.c b/usr.bin/localedef/ctype.c
--- a/usr.bin/localedef/ctype.c
+++ b/usr.bin/localedef/ctype.c
@@ -32,24 +32,24 @@
/*
* LC_CTYPE database generation routines for localedef.
*/
-#include <sys/cdefs.h>
+
+#include <sys/types.h>
#include <sys/tree.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
-#include <stddef.h>
#include <string.h>
-#include <sys/types.h>
-#include <wchar.h>
#include <unistd.h>
-#include "localedef.h"
-#include "parser.h"
+/* Don't include _ctype.h via wchar.h */
+#define __CTYPE_H_
+#include <wchar.h>
-/* Always include the defines for the target: */
-#define _DONT_USE_CTYPE_INLINE_ /* Avoid dependencies on runetype.h */
-#include "_ctype.h"
-#include "runefile.h"
+#include <runefile.h>
+#include "ctypedefs.h"
+#include "localedef.h"
+#include "parser.h"
/* Needed for bootstrapping, _CTYPE_N */
#ifndef _CTYPE_N

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 24, 5:59 PM (17 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16094445
Default Alt Text
D41983.diff (4 KB)

Event Timeline