[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Remove custom stdint.h and rely on freestanding headers
From: |
Samuel Thibault |
Subject: |
Re: [PATCH] Remove custom stdint.h and rely on freestanding headers |
Date: |
Mon, 19 Dec 2022 01:57:37 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Applied, thanks!
Flavio Cruz, le dim. 18 déc. 2022 19:48:24 -0500, a ecrit:
> GCC already provides this so we don't need to have our own.
> ---
>
> The mig and glibc patches I sent previously are required so that this
> works without breaking a full system boostrap like how it is done in
> https://github.com/flavioc/cross-hurd.
>
> Makefile.am | 3 +-
> i386/Makefrag.am | 1 -
> i386/i386at/acpi_parse_apic.c | 2 +-
> i386/i386at/acpi_parse_apic.h | 2 +-
> i386/include/mach/i386/stdint.h | 55 -------------------------------
> i386/include/mach/i386/vm_types.h | 34 ++++++++++---------
> include/stddef.h | 29 ----------------
> include/stdint.h | 44 -------------------------
> 8 files changed, 22 insertions(+), 148 deletions(-)
> delete mode 100644 i386/include/mach/i386/stdint.h
> delete mode 100644 include/stddef.h
> delete mode 100644 include/stdint.h
>
> diff --git a/Makefile.am b/Makefile.am
> index 5eddead7..8870c7ac 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -41,8 +41,9 @@ AM_LDFLAGS =
> # Compilation flags
> #
>
> +GCC_INSTALL = $(shell LANG=C gcc -print-search-dirs | sed -n -e 's/install:
> \(.*\)/\1/p')
> AM_CPPFLAGS += \
> - -ffreestanding -nostdinc -imacros config.h
> + -ffreestanding -nostdinc -imacros config.h -I $(GCC_INSTALL)/include
>
> AM_CPPFLAGS += \
> -I$(systype) \
> diff --git a/i386/Makefrag.am b/i386/Makefrag.am
> index 8d6ef8cd..c1043c4f 100644
> --- a/i386/Makefrag.am
> +++ b/i386/Makefrag.am
> @@ -257,7 +257,6 @@ include_mach_i386_HEADERS = \
> i386/include/mach/i386/machine_types.defs \
> i386/include/mach/i386/multiboot.h \
> i386/include/mach/i386/syscall_sw.h \
> - i386/include/mach/i386/stdint.h \
> i386/include/mach/i386/thread_status.h \
> i386/include/mach/i386/trap.h \
> i386/include/mach/i386/vm_param.h \
> diff --git a/i386/i386at/acpi_parse_apic.c b/i386/i386at/acpi_parse_apic.c
> index 712de689..22ed8979 100644
> --- a/i386/i386at/acpi_parse_apic.c
> +++ b/i386/i386at/acpi_parse_apic.c
> @@ -21,7 +21,7 @@
>
> #include <string.h> /* memcmp, memcpy... */
>
> -#include <include/stdint.h> /* uint16_t, uint32_t... */
> +#include <stdint.h> /* uint16_t, uint32_t... */
>
> #include <mach/machine.h> /* machine_slot */
>
> diff --git a/i386/i386at/acpi_parse_apic.h b/i386/i386at/acpi_parse_apic.h
> index 5a5cb14d..bad10054 100644
> --- a/i386/i386at/acpi_parse_apic.h
> +++ b/i386/i386at/acpi_parse_apic.h
> @@ -22,7 +22,7 @@
> #ifndef __ACPI_H__
> #define __ACPI_H__
>
> -#include <include/stdint.h>
> +#include <stdint.h>
>
> enum ACPI_RETURN {
> ACPI_BAD_CHECKSUM = -1,
> diff --git a/i386/include/mach/i386/stdint.h b/i386/include/mach/i386/stdint.h
> deleted file mode 100644
> index 5336400d..00000000
> --- a/i386/include/mach/i386/stdint.h
> +++ /dev/null
> @@ -1,55 +0,0 @@
> -/*
> - * Copyright (C) 2016 Free Software Foundation, Inc.
> - *
> - * This file is part of GNU Mach.
> - *
> - * GNU Mach is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU General Public License as published by the
> - * Free Software Foundation; either version 2, or (at your option) any later
> - * version.
> - *
> - * This program is distributed in the hope that it will be useful, but
> - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> - * for more details.
> - *
> - * You should have received a copy of the GNU General Public License along
> - * with this program; if not, write to the Free Software Foundation, Inc.,
> - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> - */
> -
> -#ifndef _MACH_MACHINE_STDINT_H_
> -#define _MACH_MACHINE_STDINT_H_
> -
> -/*
> - * These types are _exactly_ as wide as indicated in their names.
> - */
> -
> -typedef char __mach_int8_t;
> -typedef short __mach_int16_t;
> -typedef int __mach_int32_t;
> -#if __x86_64__
> -typedef long int __mach_int64_t;
> -#else
> -typedef long long int __mach_int64_t;
> -#endif /* __x86_64__ */
> -
> -typedef unsigned char __mach_uint8_t;
> -typedef unsigned short __mach_uint16_t;
> -typedef unsigned int __mach_uint32_t;
> -#if __x86_64__
> -typedef unsigned long int __mach_uint64_t;
> -#else
> -typedef unsigned long long int __mach_uint64_t;
> -#endif /* __x86_64__ */
> -
> -/* Types for `void *' pointers. */
> -#if __x86_64__
> -typedef long int __mach_intptr_t;
> -typedef unsigned long int __mach_uintptr_t;
> -#else
> -typedef int __mach_intptr_t;
> -typedef unsigned int __mach_uintptr_t;
> -#endif /* __x86_64__ */
> -
> -#endif /* _MACH_MACHINE_STDINT_H_ */
> diff --git a/i386/include/mach/i386/vm_types.h
> b/i386/include/mach/i386/vm_types.h
> index bb43a9fb..4522f48b 100644
> --- a/i386/include/mach/i386/vm_types.h
> +++ b/i386/include/mach/i386/vm_types.h
> @@ -37,7 +37,7 @@
> #ifdef __ASSEMBLER__
> #else /* __ASSEMBLER__ */
>
> -#include <mach/machine/stdint.h>
> +#include <stdint.h>
>
> #ifdef MACH_KERNEL
> #include <kern/assert.h>
> @@ -78,7 +78,7 @@ typedef long long_integer_t;
> * A vm_offset_t is a type-neutral pointer,
> * e.g. an offset into a virtual memory space.
> */
> -typedef __mach_uintptr_t vm_offset_t;
> +typedef uintptr_t vm_offset_t;
> typedef vm_offset_t * vm_offset_array_t;
>
> /*
> @@ -100,7 +100,7 @@ typedef unsigned long long rpc_phys_addr_t;
> * expressing the difference between two
> * vm_offset_t entities.
> */
> -typedef __mach_uintptr_t vm_size_t;
> +typedef uintptr_t vm_size_t;
> typedef vm_size_t * vm_size_array_t;
>
> /*
> @@ -110,32 +110,34 @@ typedef vm_size_t * vm_size_array_t;
> * functions.
> */
> #if defined(MACH_KERNEL) && defined(USER32)
> -typedef __mach_uint32_t rpc_vm_address_t;
> -typedef __mach_uint32_t rpc_vm_offset_t;
> -typedef __mach_uint32_t rpc_vm_size_t;
> +typedef uint32_t rpc_vm_address_t;
> +typedef uint32_t rpc_vm_offset_t;
> +typedef uint32_t rpc_vm_size_t;
>
> -static inline __mach_uint64_t convert_vm_from_user(__mach_uint32_t uaddr)
> +static inline uint64_t convert_vm_from_user(uint32_t uaddr)
> {
> - return (__mach_uint64_t)uaddr;
> + return (uint64_t)uaddr;
> }
> -static inline __mach_uint32_t convert_vm_to_user(__mach_uint64_t kaddr)
> +static inline uint32_t convert_vm_to_user(uint64_t kaddr)
> {
> assert(kaddr <= 0xFFFFFFFF);
> - return (__mach_uint32_t)kaddr;
> + return (uint32_t)kaddr;
> }
>
> -typedef __mach_uint32_t rpc_long_natural_t;
> -typedef __mach_int32_t rpc_long_integer_t;
> +typedef uint32_t rpc_long_natural_t;
> +typedef int32_t rpc_long_integer_t;
>
> -static inline __mach_int64_t convert_long_integer_from_user(__mach_int32_t i)
> +static inline int64_t convert_long_integer_from_user(int32_t i)
> {
> - return (__mach_int64_t)i;
> + return (int64_t)i;
> }
> -static inline __mach_int32_t convert_long_integer_to_user(__mach_int64_t i)
> +static inline int32_t convert_long_integer_to_user(int64_t i)
> {
> assert(i <= 0x7FFFFFFF);
> - return (__mach_int32_t)i;
> + return (int32_t)i;
> }
> +typedef uint32_t rpc_long_natural_t;
> +typedef int32_t rpc_long_integer_t;
> #else /* MACH_KERNEL */
> typedef vm_offset_t rpc_vm_address_t;
> typedef vm_offset_t rpc_vm_offset_t;
> diff --git a/include/stddef.h b/include/stddef.h
> deleted file mode 100644
> index dd677348..00000000
> --- a/include/stddef.h
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -/*
> - * Copyright (C) 2007 Free Software Foundation, Inc.
> - *
> - * This file is part of GNU Mach.
> - *
> - * GNU Mach is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU General Public License as published by the
> - * Free Software Foundation; either version 2, or (at your option) any later
> - * version.
> - *
> - * This program is distributed in the hope that it will be useful, but
> - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> - * for more details.
> - *
> - * You should have received a copy of the GNU General Public License along
> - * with this program; if not, write to the Free Software Foundation, Inc.,
> - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> - */
> -
> -#ifndef _STDDEF_H_
> -#define _STDDEF_H_
> -
> -/* From GCC's `/lib/gcc/X/X/include/stddef.h'. */
> -
> -/* Offset of member MEMBER in a struct of type TYPE. */
> -#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
> -
> -#endif /* _STDDEF_H_ */
> diff --git a/include/stdint.h b/include/stdint.h
> deleted file mode 100644
> index 55c7ab22..00000000
> --- a/include/stdint.h
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -/*
> - * Copyright (C) 2016 Free Software Foundation, Inc.
> - *
> - * This file is part of GNU Mach.
> - *
> - * GNU Mach is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU General Public License as published by the
> - * Free Software Foundation; either version 2, or (at your option) any later
> - * version.
> - *
> - * This program is distributed in the hope that it will be useful, but
> - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> - * for more details.
> - *
> - * You should have received a copy of the GNU General Public License along
> - * with this program; if not, write to the Free Software Foundation, Inc.,
> - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> - */
> -
> -#ifndef _STDINT_H_
> -#define _STDINT_H_
> -
> -/*
> - * These types are _exactly_ as wide as indicated in their names.
> - */
> -
> -#include <mach/machine/stdint.h>
> -
> -typedef __mach_int8_t int8_t;
> -typedef __mach_int16_t int16_t;
> -typedef __mach_int32_t int32_t;
> -typedef __mach_int64_t int64_t;
> -
> -typedef __mach_uint8_t uint8_t;
> -typedef __mach_uint16_t uint16_t;
> -typedef __mach_uint32_t uint32_t;
> -typedef __mach_uint64_t uint64_t;
> -
> -/* Types for `void *' pointers. */
> -typedef __mach_intptr_t intptr_t;
> -typedef __mach_uintptr_t uintptr_t;
> -
> -#endif /* _STDINT_H_ */
> --
> 2.37.2
>
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.