mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
mlibc: bump version
This commit is contained in:
@@ -29,178 +29,6 @@ index 471604e..3c5bea0 100644
|
||||
else
|
||||
error('No sysdeps defined for OS: ' + host_machine.system())
|
||||
endif
|
||||
diff --git mlibc-clean/options/ansi/generic/stdio-stubs.cpp mlibc-workdir/options/ansi/generic/stdio-stubs.cpp
|
||||
index 574d4b5..698304b 100644
|
||||
--- mlibc-clean/options/ansi/generic/stdio-stubs.cpp
|
||||
+++ mlibc-workdir/options/ansi/generic/stdio-stubs.cpp
|
||||
@@ -349,6 +349,8 @@ static void store_int(void *dest, unsigned int size, unsigned long long i) {
|
||||
|
||||
template<typename H>
|
||||
static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
+ #define NOMATCH_CHECK(cond) if(cond) return match_count // if cond is true, matching error
|
||||
+ #define EOF_CHECK(cond) if(cond) return match_count ? match_count : EOF // if cond is true, no more data to read
|
||||
int match_count = 0;
|
||||
for (; *fmt; fmt++) {
|
||||
|
||||
@@ -468,8 +470,10 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
case 'i': {
|
||||
bool is_negative = false;
|
||||
unsigned long long res = 0;
|
||||
+ char c = handler.look_ahead();
|
||||
+ EOF_CHECK(c == '\0');
|
||||
|
||||
- if((*fmt == 'i' || *fmt == 'd') && handler.look_ahead() == '-') {
|
||||
+ if((*fmt == 'i' || *fmt == 'd') && c == '-') {
|
||||
handler.consume();
|
||||
is_negative = true;
|
||||
}
|
||||
@@ -484,11 +488,11 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
}
|
||||
}
|
||||
|
||||
- char c = handler.look_ahead();
|
||||
+ c = handler.look_ahead();
|
||||
+ int count = 0;
|
||||
switch (base) {
|
||||
case 10:
|
||||
- if(!isdigit(c))
|
||||
- return match_count;
|
||||
+ NOMATCH_CHECK(!isdigit(c));
|
||||
while (c >= '0' && c <= '9') {
|
||||
handler.consume();
|
||||
res = res * 10 + (c - '0');
|
||||
@@ -496,14 +500,6 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
- if (c == '0') {
|
||||
- handler.consume();
|
||||
- c = handler.look_ahead();
|
||||
- if (c == 'x') {
|
||||
- handler.consume();
|
||||
- c = handler.look_ahead();
|
||||
- }
|
||||
- }
|
||||
while (true) {
|
||||
if (c >= '0' && c <= '9') {
|
||||
handler.consume();
|
||||
@@ -517,8 +513,10 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
+ count++;
|
||||
c = handler.look_ahead();
|
||||
}
|
||||
+ NOMATCH_CHECK(count == 0);
|
||||
break;
|
||||
case 8:
|
||||
while (c >= '0' && c <= '7') {
|
||||
@@ -527,6 +525,7 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
c = handler.look_ahead();
|
||||
}
|
||||
break;
|
||||
+ // no need for a match check, the starting 0 was already consumed
|
||||
}
|
||||
if (dest) {
|
||||
if(is_negative)
|
||||
@@ -539,6 +538,8 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
case 'o': {
|
||||
unsigned long long res = 0;
|
||||
char c = handler.look_ahead();
|
||||
+ EOF_CHECK(c);
|
||||
+ NOMATCH_CHECK(!(c >= '0' && c <= '7'));
|
||||
while (c >= '0' && c <= '7') {
|
||||
handler.consume();
|
||||
res = res * 8 + (c - '0');
|
||||
@@ -552,6 +553,8 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
case 'X': {
|
||||
unsigned long long res = 0;
|
||||
char c = handler.look_ahead();
|
||||
+ int count = 0;
|
||||
+ EOF_CHECK(c == '\0');
|
||||
if (c == '0') {
|
||||
handler.consume();
|
||||
c = handler.look_ahead();
|
||||
@@ -573,8 +576,10 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
+ count++;
|
||||
c = handler.look_ahead();
|
||||
}
|
||||
+ NOMATCH_CHECK(count == 0);
|
||||
if (dest)
|
||||
store_int(dest, type, res);
|
||||
break;
|
||||
@@ -583,6 +588,7 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
char *typed_dest = (char *)dest;
|
||||
char c = handler.look_ahead();
|
||||
int count = 0;
|
||||
+ EOF_CHECK(c == '\0');
|
||||
while (c && !isspace(c)) {
|
||||
handler.consume();
|
||||
if (typed_dest)
|
||||
@@ -592,6 +598,7 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
if (width && count >= width)
|
||||
break;
|
||||
}
|
||||
+ NOMATCH_CHECK(count == 0);
|
||||
if (typed_dest)
|
||||
typed_dest[count] = '\0';
|
||||
break;
|
||||
@@ -599,6 +606,7 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
case 'c': {
|
||||
char *typed_dest = (char *)dest;
|
||||
char c = handler.look_ahead();
|
||||
+ EOF_CHECK(c == '\0');
|
||||
int count = 0;
|
||||
if (!width)
|
||||
width = 1;
|
||||
@@ -644,6 +652,7 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
char *typed_dest = (char *)dest;
|
||||
int count = 0;
|
||||
char c = handler.look_ahead();
|
||||
+ EOF_CHECK(c == '\0');
|
||||
while (c && (!width || count < width)) {
|
||||
handler.consume();
|
||||
if (!scanset[1 + c])
|
||||
@@ -653,6 +662,7 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
c = handler.look_ahead();
|
||||
count++;
|
||||
}
|
||||
+ NOMATCH_CHECK(count == 0);
|
||||
if (typed_dest)
|
||||
typed_dest[count] = '\0';
|
||||
break;
|
||||
@@ -660,6 +670,9 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
case 'p': {
|
||||
unsigned long long res = 0;
|
||||
char c = handler.look_ahead();
|
||||
+ int count = 0;
|
||||
+ EOF_CHECK(c == '\0');
|
||||
+
|
||||
if (c == '0') {
|
||||
handler.consume();
|
||||
c = handler.look_ahead();
|
||||
@@ -668,6 +681,7 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
c = handler.look_ahead();
|
||||
}
|
||||
}
|
||||
+
|
||||
while (true) {
|
||||
if (c >= '0' && c <= '9') {
|
||||
handler.consume();
|
||||
@@ -681,8 +695,10 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
+ count++;
|
||||
c = handler.look_ahead();
|
||||
}
|
||||
+ NOMATCH_CHECK(count == 0);
|
||||
void **typed_dest = (void **)dest;
|
||||
*typed_dest = (void *)(uintptr_t)res;
|
||||
break;
|
||||
diff --git mlibc-clean/options/ansi/generic/string-stubs.cpp mlibc-workdir/options/ansi/generic/string-stubs.cpp
|
||||
index 8defd0e..d6cb65b 100644
|
||||
--- mlibc-clean/options/ansi/generic/string-stubs.cpp
|
||||
@@ -230,19 +58,6 @@ index 3474615..e034881 100644
|
||||
}
|
||||
|
||||
char **backtrace_symbols(void *const *, int) {
|
||||
diff --git mlibc-clean/options/linux/include/bits/linux/linux_stat.h mlibc-workdir/options/linux/include/bits/linux/linux_stat.h
|
||||
index 59009c9..170d4a1 100644
|
||||
--- mlibc-clean/options/linux/include/bits/linux/linux_stat.h
|
||||
+++ mlibc-workdir/options/linux/include/bits/linux/linux_stat.h
|
||||
@@ -9,7 +9,7 @@ extern "C" {
|
||||
|
||||
#ifndef __MLIBC_ABI_ONLY
|
||||
|
||||
-int statx(int, const char *, int, unsigned int, struct statx *);
|
||||
+//int statx(int, const char *, int, unsigned int, struct statx *);
|
||||
|
||||
#endif /* !__MLIBC_ABI_ONLY */
|
||||
|
||||
diff --git mlibc-clean/options/posix/generic/dlfcn-stubs.cpp mlibc-workdir/options/posix/generic/dlfcn-stubs.cpp
|
||||
index fc34a3b..b1a95a9 100644
|
||||
--- mlibc-clean/options/posix/generic/dlfcn-stubs.cpp
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
name=mlibc
|
||||
version=fc49abcc8245c35b62e7b88322f6bda1d554fb19
|
||||
version=7b67d09bde0be6d53284d1583058483e1687880c
|
||||
source_method=tarball
|
||||
tarball_url="https://github.com/managarm/mlibc/archive/${version}.tar.gz"
|
||||
tarball_sha512="5c030d80743ff76da56f35bc946f20e7bd1ead3b27483629acb6b50d8eecee2509c4645e6a0fd58fe9836529afbd6a865c2f40b61f5302f96fe88658745ae09e"
|
||||
tarball_sha512="ca21cac9c4b5efd8ef70d3f43caa89d9c2cf00a1da64c1de797449d492ef21736339db30b7db542d88935856b4ffab43e36304a6895a774257df4ab3e1ff4cca"
|
||||
|
||||
regenerate() {
|
||||
mkdir -p ${source_dir}/sysdeps/astral/include/
|
||||
|
||||
Reference in New Issue
Block a user