mescc: Support binutils-2.20.1a: header tweaks.

* include/signal.h: Include sys/types.h; remove type declaration copies.
* include/stdarg.h: Likewise.
* include/stdio.h: Likewise.
* include/stdlib.h: Likewise.
* include/unistd.h: Likewise.
This commit is contained in:
Jan Nieuwenhuizen 2018-06-19 20:23:38 +02:00
parent 63bf9bb2f7
commit 98a8f3f23e
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
8 changed files with 76 additions and 105 deletions

View File

@ -24,31 +24,12 @@
#undef __MES_SIGNAL_H
#include_next <signal.h>
#else //! WITH_GLIBC
typedef int sigset_t;
typedef int sigset_t;
typedef int stack_t;
#ifndef __MES_PID_T
#define __MES_PID_T
typedef int pid_t;
#endif
#ifndef __MES_UID_T
#define __MES_UID_T
typedef int uid_t;
#endif
#ifndef __MES_CLOCK_T
#define __MES_CLOCK_T
#undef clock_t
typedef long clock_t;
#endif
#ifndef __MES_SIGVAL_T
#define __MES_SIGVAL_T
#undef clock_t
typedef int sigval_t;
#endif
#include <sys/types.h>
#define NSIG 30
#define SIGHUP 1

View File

@ -25,11 +25,7 @@
#include_next <stdarg.h>
#else // ! WITH_GLIBC
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
#undef size_t
typedef unsigned long size_t;
#endif
#include <sys/types.h>
#if __GNUC__
typedef char* va_list;
@ -43,6 +39,7 @@ typedef int va_list;
#define va_end(ap) (void)((ap) = 0)
#define va_copy(dest, src) dest = src
int vfprintf (FILE *stream, char const *template, va_list ap);
int vprintf (char const* format, va_list ap);
int vsprintf (char *str, char const *format, va_list ap);
int vsnprintf (char *str, size_t size, char const *format, va_list ap);

View File

@ -45,18 +45,6 @@ int g_stdout;
#else // ! WITH_GLIBC
#ifndef __MESCCLIB__
#define __MESCCLIB__ 15
#endif
#ifndef EOF
#define EOF -1
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef BUFSIZ
#define BUFSIZ 256
#endif
@ -65,11 +53,7 @@ int g_stdout;
#define L_tmpnam 100
#endif
#if !defined (__MES_FILE_T) && ! defined (_FILE_T)
#define __MES_FILE_T
#define _FILE_T
typedef int FILE;
#endif
#include <sys/types.h>
#define stdin (FILE*)0
#define stdout (FILE*)1
@ -79,12 +63,6 @@ typedef int FILE;
#define SEEK_CUR 1
#define SEEK_END 2
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
#undef size_t
typedef unsigned long size_t;
#endif
FILE *fdopen (int fd, char const *mode);
FILE *fopen (char const *file_name, char const *mode);
int eputc (int c);
@ -101,7 +79,7 @@ int fputc (int c, FILE *stream);
int fputs (char const* s, FILE *stream);
int fseek (FILE *stream, long offset, int whence);
int getc (FILE *stream);
int getchar ();
int getchar (void);
int printf (char const* format, ...);
int putc (int c, FILE* stream);
int putchar (int c);

View File

@ -28,11 +28,7 @@
#include_next <stdlib.h>
#else // ! WITH_GLIBC
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
#undef size_t
typedef unsigned long size_t;
#endif
#include <sys/types.h>
#if _ALLOCA_UNSIGNED
void * alloca (unsigned size);
@ -62,20 +58,13 @@ unsigned long long strtoull (char const *string, char **tailptr, int base);
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#ifndef NULL
#define NULL 0
#endif
#if __MESC__
#ifndef __MES_COMPARISON_FN_T
#define __MES_COMPARISON_FN_T
typedef int (*comparison_fn_t) (void const *, void const *);
#else
typedef void (*comparison_fn_t) ();
#endif
void * bsearch (void const *key, void const *array, size_t count, size_t size, comparison_fn_t compare);
#include <endian.h>
#endif // ! WITH_GLIBC
#endif // __MES_STDLIB_H

View File

@ -48,14 +48,17 @@ typedef long ssize_t;
void *memcpy (void *dest, void const *src, size_t n);
void *memmove (void *dest, void const *src, size_t n);
void *memset (void *s, int c, size_t n);
void * memchr (void const *block, int c, size_t size);
int memcmp (void const *s1, void const *s2, size_t n);
char *strcat (char *dest, char const *src);
char *strchr (char const *s, int c);
int strcasecmp (char const *s1, char const *s2);
int strcmp (char const*, char const*);
char *strcpy (char *dest, char const *src);
size_t strlen (char const*);
char *strncpy (char *to, char const *from, size_t size);
int strncasecmp (char const *s1, char const *s2, size_t size);
int strncmp (char const*, char const*, size_t);
char *strrchr (char const *s, int c);
char *strstr (char const *haystack, char const *needle);

View File

@ -26,6 +26,7 @@
#else // ! WITH_GLIBC
#include <time.h>
#include <sys/types.h>
#ifndef __MES_MODE_T
@ -45,11 +46,11 @@ struct stat
long st_size;
unsigned int st_blksize;
unsigned int st_blocks;
long st_atime;
time_t st_atime;
unsigned long st_atime_usec;
long st_mtime;
time_t st_mtime;
unsigned long st_mtime_usec;
long st_ctime;
time_t st_ctime;
unsigned long st_ctime_usec;
unsigned int __foo0;
unsigned int __foo1;

View File

@ -24,14 +24,39 @@
#undef __MES_SYS_TYPES_H
#include_next <sys/types.h>
#else // ! WITH_GLIBC
#include <endian.h>
#ifndef __MESCCLIB__
#define __MESCCLIB__ 15
#endif
#ifndef EOF
#define EOF -1
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef __MES_CLOCK_T
#define __MES_CLOCK_T
#undef clock_t
typedef long clock_t;
#endif
#ifndef __MES_DEV_T
#define __MES_DEV_T
#undef dev_t
typedef int dev_t;
#endif
#if !defined (__MES_FILE_T) && ! defined (_FILE_T)
#define __MES_FILE_T
#define _FILE_T
typedef int FILE;
#endif
#ifndef __MES_GID_T
#define __MES_GID_T
#undef gid_t
@ -44,18 +69,48 @@ typedef int gid_t;
typedef unsigned ino_t;
#endif
#ifndef __MES_INTPTR_T
#define __MES_INTPTR_T
#undef intptr_t
typedef long intptr_t;
#endif
#ifndef __MES_OFF_T
#define __MES_OFF_T
#undef off_t
typedef unsigned long off_t;
#endif
#ifndef __MES_PID_T
#define __MES_PID_T
#undef pid_t
typedef int pid_t;
#endif
#ifndef __MES_PTRDIFF_T
#define __MES_PTRDIFF_T
#undef ptrdiff_t
typedef long ptrdiff_t;
#endif
#ifndef __MES_SIGVAL_T
#define __MES_SIGVAL_T
#undef clock_t
typedef int sigval_t;
#endif
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
#undef size_t
typedef unsigned long size_t;
#endif
#ifndef __MES_SSIZE_T
#define __MES_SSIZE_T
#undef ssize_t
typedef long ssize_t;
#endif
#ifndef __MES_UID_T
#define __MES_UID_T
#undef uid_t

View File

@ -29,6 +29,7 @@
#else // ! WITH_GLIBC
#include <sys/types.h>
#ifndef NULL
#define NULL 0
#endif
@ -45,42 +46,6 @@
#define STDERR_FILE_NO 2
#endif // STDIN_FILE_NO
#ifndef __MES_OFF_T
#define __MES_OFF_T
#undef off_t
typedef unsigned long off_t;
#endif
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
#undef size_t
typedef unsigned long size_t;
#endif
#ifndef __MES_SSIZE_T
#define __MES_SSIZE_T
#undef ssize_t
typedef long ssize_t;
#endif
#ifndef __MES_INTPTR_T
#define __MES_INTPTR_T
#undef intptr_t
typedef long intptr_t;
#endif
#ifndef __MES_PTRDIFF_T
#define __MES_PTRDIFF_T
#undef ptrdiff_t
typedef long ptrdiff_t;
#endif
#ifndef __MES_PID_T
#define __MES_PID_T
#undef pid_t
typedef int pid_t;
#endif
#ifndef R_OK
#define F_OK 0
#define X_OK 1
@ -94,8 +59,10 @@ int close (int fd);
int execv (char const *file_name, char *const argv[]);
int execve (char const *file, char *const argv[], char *const env[]);
int execvp (char const *file, char *const argv[]);
int fork ();
int fork (void);
char *getcwd (char *buf, size_t size);
uid_t getgid (void);
uid_t getuid (void);
int isatty (int fd);
int link (char const *oldname, char const *newname);
off_t lseek (int fd, off_t offset, int whence);