From: Waldemar Kozaczuk <[email protected]>
Committer: Nadav Har'El <[email protected]>
Branch: master

api: replace 3 more include/api headers with musl copies

This patch replaces following 3 headers with symlinks to musl copies:
- include/api/stdint.h
- include/api/stdio.h
- include/api/x64/bits/stdint.h

These files come from older version of musl and have not be been
touched on OSv side. However they had changed in newer version (0.9.12) of musl
in a way that requires changing alltypes.h.sh for both x64 and aarch64.
It turns out that this musl commit
(https://git.musl-libc.org/cgit/musl/commit/?id=9448b0513e2eec020fbca9c10412b83df5027a16)
has replaced alltypes.h.sh mechanism with alltypes.h.in +
tools/mkalltypes.sed and also split all types into common alltypes.h.in
and specific ones to given architecture. It would be nice to update
it OSv side as well (it might be necessary for the upgrade).

For now it was enough to manually add __isoc_va_list TYPEDEF
to both alltypes.h.sh files and *int_fast* typedefs to aarch64 version
of bits/stdint.h.

Signed-off-by: Waldemar Kozaczuk <[email protected]>
Message-Id: <[email protected]>

---
diff --git a/include/api/aarch64/bits/alltypes.h.sh 
b/include/api/aarch64/bits/alltypes.h.sh
--- a/include/api/aarch64/bits/alltypes.h.sh
+++ b/include/api/aarch64/bits/alltypes.h.sh
@@ -24,6 +24,7 @@ TYPEDEF unsigned long size_t;
 TYPEDEF long ssize_t;
 TYPEDEF long ptrdiff_t;
 TYPEDEF __builtin_va_list va_list;
+TYPEDEF __builtin_va_list __isoc_va_list;
 
 #ifndef __cplusplus
 TYPEDEF unsigned int wchar_t;
diff --git a/include/api/aarch64/bits/stdint.h 
b/include/api/aarch64/bits/stdint.h
--- a/include/api/aarch64/bits/stdint.h
+++ b/include/api/aarch64/bits/stdint.h
@@ -1,23 +1,20 @@
-#define INT_FAST8_MIN   INT8_MIN
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
 #define INT_FAST16_MIN  INT32_MIN
 #define INT_FAST32_MIN  INT32_MIN
-#define INT_FAST64_MIN  INT64_MIN
 
-#define INT_FAST8_MAX   INT8_MAX
 #define INT_FAST16_MAX  INT32_MAX
 #define INT_FAST32_MAX  INT32_MAX
-#define INT_FAST64_MAX  INT64_MAX
 
-#define UINT_FAST8_MAX  UINT8_MAX
 #define UINT_FAST16_MAX UINT32_MAX
 #define UINT_FAST32_MAX UINT32_MAX
-#define UINT_FAST64_MAX UINT64_MAX
 
 #define INTPTR_MIN      INT64_MIN
 #define INTPTR_MAX      INT64_MAX
 #define UINTPTR_MAX     UINT64_MAX
 #define PTRDIFF_MIN     INT64_MIN
 #define PTRDIFF_MAX     INT64_MAX
-#define SIG_ATOMIC_MIN  INT64_MIN
-#define SIG_ATOMIC_MAX  INT64_MAX
 #define SIZE_MAX        UINT64_MAX
diff --git a/include/api/stdint.h b/include/api/stdint.h
--- a/include/api/stdint.h
+++ b/include/api/stdint.h
@@ -1,109 +0,0 @@
-#ifndef _STDINT_H
-#define _STDINT_H
-
-#define __NEED_int8_t
-#define __NEED_int16_t
-#define __NEED_int32_t
-#define __NEED_int64_t
-
-#define __NEED_uint8_t
-#define __NEED_uint16_t
-#define __NEED_uint32_t
-#define __NEED_uint64_t
-
-#define __NEED_int_fast8_t
-#define __NEED_int_fast16_t
-#define __NEED_int_fast32_t
-#define __NEED_int_fast64_t
-
-#define __NEED_uint_fast8_t
-#define __NEED_uint_fast16_t
-#define __NEED_uint_fast32_t
-#define __NEED_uint_fast64_t
-
-#define __NEED_intptr_t
-#define __NEED_uintptr_t
-
-#define __NEED_intmax_t
-#define __NEED_uintmax_t
-
-#include <bits/alltypes.h>
-
-typedef int8_t  int_least8_t;
-typedef int16_t int_least16_t;
-typedef int32_t int_least32_t;
-typedef int64_t int_least64_t;
-
-typedef uint8_t  uint_least8_t;
-typedef uint16_t uint_least16_t;
-typedef uint32_t uint_least32_t;
-typedef uint64_t uint_least64_t;
-
-#define INT8_MIN   (-1-0x7f)
-#define INT16_MIN  (-1-0x7fff)
-#define INT32_MIN  (-1-0x7fffffff)
-#define INT64_MIN  (-1-0x7fffffffffffffff)
-
-#define INT8_MAX   (0x7f)
-#define INT16_MAX  (0x7fff)
-#define INT32_MAX  (0x7fffffff)
-#define INT64_MAX  (0x7fffffffffffffff)
-
-#define UINT8_MAX  (0xff)
-#define UINT16_MAX (0xffff)
-#define UINT32_MAX (0xffffffff)
-#define UINT64_MAX (0xffffffffffffffff)
-
-#define INT_LEAST8_MIN   INT8_MIN
-#define INT_LEAST16_MIN  INT16_MIN
-#define INT_LEAST32_MIN  INT32_MIN
-#define INT_LEAST64_MIN  INT64_MIN
-
-#define INT_LEAST8_MAX   INT8_MAX
-#define INT_LEAST16_MAX  INT16_MAX
-#define INT_LEAST32_MAX  INT32_MAX
-#define INT_LEAST64_MAX  INT64_MAX
-
-#define UINT_LEAST8_MAX  UINT8_MAX
-#define UINT_LEAST16_MAX UINT16_MAX
-#define UINT_LEAST32_MAX UINT32_MAX
-#define UINT_LEAST64_MAX UINT64_MAX
-
-#define INTMAX_MIN  INT64_MIN
-#define INTMAX_MAX  INT64_MAX
-#define UINTMAX_MAX UINT64_MAX
-
-#define WINT_MIN INT32_MIN
-#define WINT_MAX INT32_MAX
-
-#if L'\0'-1 > 0
-#define WCHAR_MAX (0xffffffffu+L'\0')
-#define WCHAR_MIN (0+L'\0')
-#else
-#define WCHAR_MAX (0x7fffffff+L'\0')
-#define WCHAR_MIN (-1-0x7fffffff+L'\0')
-#endif
-
-#include <bits/stdint.h>
-
-#define INT8_C(c)  c
-#define INT16_C(c) c
-#define INT32_C(c) c
-
-#define UINT8_C(c)  c
-#define UINT16_C(c) c
-#define UINT32_C(c) c ## U
-
-#if UINTPTR_MAX == UINT64_MAX
-#define INT64_C(c) c ## L
-#define UINT64_C(c) c ## UL
-#define INTMAX_C(c)  c ## L
-#define UINTMAX_C(c) c ## UL
-#else
-#define INT64_C(c) c ## LL
-#define UINT64_C(c) c ## ULL
-#define INTMAX_C(c)  c ## LL
-#define UINTMAX_C(c) c ## ULL
-#endif
-
-#endif
diff --git a/include/api/stdint.h b/include/api/stdint.h
--- a/include/api/stdint.h
+++ b/include/api/stdint.h
@@ -0,0 +1 @@
+../../musl/include/stdint.h
\ No newline at end of file
diff --git a/include/api/stdio.h b/include/api/stdio.h
--- a/include/api/stdio.h
+++ b/include/api/stdio.h
@@ -1,198 +0,0 @@
-#ifndef _STDIO_H
-#define _STDIO_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <features.h>
-
-#define __NEED_FILE
-#define __NEED_va_list
-#define __NEED_size_t
-
-#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
- || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
- || defined(_BSD_SOURCE)
-#define __NEED_ssize_t
-#define __NEED_off_t
-#endif
-
-#include <bits/alltypes.h>
-
-#define NULL 0L
-
-#undef EOF
-#define EOF (-1)
-
-#undef SEEK_SET
-#undef SEEK_CUR
-#undef SEEK_END
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-
-#define _IOFBF 0
-#define _IOLBF 1
-#define _IONBF 2
-
-#define BUFSIZ 1024
-#define FILENAME_MAX 4095
-#define FOPEN_MAX 1000
-#define TMP_MAX 10000
-#define L_tmpnam 20
-
-typedef union {
-       char __opaque[16];
-       double __align;
-} fpos_t;
-
-extern FILE *const stdin;
-extern FILE *const stdout;
-extern FILE *const stderr;
-
-#define stdin  (stdin)
-#define stdout (stdout)
-#define stderr (stderr)
-
-FILE *fopen(const char *__restrict, const char *__restrict);
-FILE *freopen(const char *__restrict, const char *__restrict, FILE 
*__restrict);
-int fclose(FILE *);
-
-int remove(const char *);
-int rename(const char *, const char *);
-
-int feof(FILE *);
-int ferror(FILE *);
-int fflush(FILE *);
-void clearerr(FILE *);
-
-int fseek(FILE *, long, int);
-long ftell(FILE *);
-void rewind(FILE *);
-
-int fgetpos(FILE *__restrict, fpos_t *__restrict);
-int fsetpos(FILE *, const fpos_t *);
-
-size_t fread(void *__restrict, size_t, size_t, FILE *__restrict);
-size_t fwrite(const void *__restrict, size_t, size_t, FILE *__restrict);
-
-int fgetc(FILE *);
-int getc(FILE *);
-int getchar(void);
-int ungetc(int, FILE *);
-
-int fputc(int, FILE *);
-int putc(int, FILE *);
-int putchar(int);
-
-char *fgets(char *__restrict, int, FILE *__restrict);
-#if __STDC_VERSION__ < 201112L
-char *gets(char *);
-#endif
-
-int fputs(const char *__restrict, FILE *__restrict);
-int puts(const char *);
-
-int printf(const char *__restrict, ...);
-int fprintf(FILE *__restrict, const char *__restrict, ...);
-int sprintf(char *__restrict, const char *__restrict, ...);
-int snprintf(char *__restrict, size_t, const char *__restrict, ...);
-
-int vprintf(const char *__restrict, va_list);
-int vfprintf(FILE *__restrict, const char *__restrict, va_list);
-int vsprintf(char *__restrict, const char *__restrict, va_list);
-int vsnprintf(char *__restrict, size_t, const char *__restrict, va_list);
-
-int scanf(const char *__restrict, ...);
-int fscanf(FILE *__restrict, const char *__restrict, ...);
-int sscanf(const char *__restrict, const char *__restrict, ...);
-int vscanf(const char *__restrict, va_list);
-int vfscanf(FILE *__restrict, const char *__restrict, va_list);
-int vsscanf(const char *__restrict, const char *__restrict, va_list);
-
-void perror(const char *);
-
-int setvbuf(FILE *__restrict, char *__restrict, int, size_t);
-void setbuf(FILE *__restrict, char *__restrict);
-
-char *tmpnam(char *);
-FILE *tmpfile(void);
-
-#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
- || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
- || defined(_BSD_SOURCE)
-FILE *fmemopen(void *__restrict, size_t, const char *__restrict);
-FILE *open_memstream(char **, size_t *);
-FILE *fdopen(int, const char *);
-FILE *popen(const char *, const char *);
-int pclose(FILE *);
-int fileno(FILE *);
-int fseeko(FILE *, off_t, int);
-off_t ftello(FILE *);
-int dprintf(int, const char *__restrict, ...);
-int vdprintf(int, const char *__restrict, va_list);
-void flockfile(FILE *);
-int ftrylockfile(FILE *);
-void funlockfile(FILE *);
-int getc_unlocked(FILE *);
-int getchar_unlocked(void);
-int putc_unlocked(int, FILE *);
-int putchar_unlocked(int);
-ssize_t getdelim(char **__restrict, size_t *__restrict, int, FILE *__restrict);
-ssize_t getline(char **__restrict, size_t *__restrict, FILE *__restrict);
-int renameat(int, const char *, int, const char *);
-char *ctermid(char *);
-#define L_ctermid 20
-#endif
-
-
-#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
- || defined(_BSD_SOURCE)
-#define P_tmpdir "/tmp"
-char *tempnam(const char *, const char *);
-#endif
-
-#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-#define L_cuserid 20
-char *cuserid(char *);
-void setlinebuf(FILE *);
-void setbuffer(FILE *, char *, size_t);
-int fgetc_unlocked(FILE *);
-int fputc_unlocked(int, FILE *);
-int fflush_unlocked(FILE *);
-size_t fread_unlocked(void *, size_t, size_t, FILE *);
-size_t fwrite_unlocked(const void *, size_t, size_t, FILE *);
-void clearerr_unlocked(FILE *);
-int feof_unlocked(FILE *);
-int ferror_unlocked(FILE *);
-int fileno_unlocked(FILE *);
-int getw(FILE *);
-int putw(int, FILE *);
-char *fgetln(FILE *, size_t *);
-int asprintf(char **, const char *, ...);
-int vasprintf(char **, const char *, va_list);
-#endif
-
-#ifdef _GNU_SOURCE
-char *fgets_unlocked(char *, int, FILE *);
-int fputs_unlocked(const char *, FILE *);
-#endif
-
-#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
-#define tmpfile64 tmpfile
-#define fopen64 fopen
-#define freopen64 freopen
-#define fseeko64 fseeko
-#define ftello64 ftello
-#define fgetpos64 fgetpos
-#define fsetpos64 fsetpos
-#define fpos64_t fpos_t
-#define off64_t off_t
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/api/stdio.h b/include/api/stdio.h
--- a/include/api/stdio.h
+++ b/include/api/stdio.h
@@ -0,0 +1 @@
+../../musl/include/stdio.h
\ No newline at end of file
diff --git a/include/api/x64/bits/alltypes.h.sh 
b/include/api/x64/bits/alltypes.h.sh
--- a/include/api/x64/bits/alltypes.h.sh
+++ b/include/api/x64/bits/alltypes.h.sh
@@ -23,6 +23,7 @@ TYPEDEF unsigned long size_t;
 TYPEDEF long ssize_t;
 TYPEDEF long ptrdiff_t;
 TYPEDEF __builtin_va_list va_list;
+TYPEDEF __builtin_va_list __isoc_va_list;
 
 #ifndef __cplusplus
 TYPEDEF int wchar_t;
diff --git a/include/api/x64/bits/stdint.h b/include/api/x64/bits/stdint.h
--- a/include/api/x64/bits/stdint.h
+++ b/include/api/x64/bits/stdint.h
@@ -1,23 +0,0 @@
-#define INT_FAST8_MIN   INT8_MIN
-#define INT_FAST16_MIN  INT32_MIN
-#define INT_FAST32_MIN  INT32_MIN
-#define INT_FAST64_MIN  INT64_MIN
-
-#define INT_FAST8_MAX   INT8_MAX
-#define INT_FAST16_MAX  INT32_MAX
-#define INT_FAST32_MAX  INT32_MAX
-#define INT_FAST64_MAX  INT64_MAX
-
-#define UINT_FAST8_MAX  UINT8_MAX
-#define UINT_FAST16_MAX UINT32_MAX
-#define UINT_FAST32_MAX UINT32_MAX
-#define UINT_FAST64_MAX UINT64_MAX
-
-#define INTPTR_MIN      INT64_MIN
-#define INTPTR_MAX      INT64_MAX
-#define UINTPTR_MAX     UINT64_MAX
-#define PTRDIFF_MIN     INT64_MIN
-#define PTRDIFF_MAX     INT64_MAX
-#define SIG_ATOMIC_MIN  INT64_MIN
-#define SIG_ATOMIC_MAX  INT64_MAX
-#define SIZE_MAX        UINT64_MAX
diff --git a/include/api/x64/bits/stdint.h b/include/api/x64/bits/stdint.h
--- a/include/api/x64/bits/stdint.h
+++ b/include/api/x64/bits/stdint.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/stdint.h
\ No newline at end of file

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/0000000000000d9d2405ae196d8c%40google.com.

Reply via email to