1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 05:54:58 +00:00

LibC: Make wchar size definitions available from stdint.h

POSIX describes WCHAR_MIN and WCHAR_MAX in stdint.h(0P), while
wchar.h(0P) only says "as described in stdint.h".

As there isn't a trivial path of "may make visible", just move it to a
shared header and include it from both files.
This commit is contained in:
Tim Schumacher 2022-03-29 00:22:27 +02:00 committed by Andreas Kling
parent f4ed4b2806
commit cdca6fc113
3 changed files with 17 additions and 10 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include <bits/wchar_size.h>
#include <sys/cdefs.h>
__BEGIN_DECLS

View file

@ -0,0 +1,15 @@
/*
* Copyright (c) 2022, Tim Schumacher <timschumi@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#define WCHAR_MAX __WCHAR_MAX__
#ifdef __WCHAR_MIN__
# define WCHAR_MIN __WCHAR_MIN__
#else
// Note: This assumes that wchar_t is a signed type.
# define WCHAR_MIN (-WCHAR_MAX - 1)
#endif

View file

@ -7,6 +7,7 @@
#pragma once
#include <bits/FILE.h>
#include <bits/wchar_size.h>
#include <stdarg.h>
#include <stddef.h>
#include <sys/cdefs.h>
@ -17,16 +18,6 @@ __BEGIN_DECLS
# define WEOF (0xffffffffu)
#endif
#undef WCHAR_MAX
#undef WCHAR_MIN
#define WCHAR_MAX __WCHAR_MAX__
#ifdef __WCHAR_MIN__
# define WCHAR_MIN __WCHAR_MIN__
#else
// Note: This assumes that wchar_t is a signed type.
# define WCHAR_MIN (-WCHAR_MAX - 1)
#endif
typedef __WINT_TYPE__ wint_t;
typedef unsigned long int wctype_t;