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:
parent
f4ed4b2806
commit
cdca6fc113
3 changed files with 17 additions and 10 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <bits/wchar_size.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
|
15
Userland/Libraries/LibC/bits/wchar_size.h
Normal file
15
Userland/Libraries/LibC/bits/wchar_size.h
Normal 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
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue