Remove references to stdc

Note: currently there are no third party linker libraries available that
could stop linking due to name changes, thus this and previous changes
are considered backwards compatible. In case some problems surface,
an .alias can be added with the old name.
This commit is contained in:
deadwood 2024-04-13 22:27:27 +02:00
parent 421d0b9e86
commit 99ab254f6f
13 changed files with 35 additions and 26 deletions

View File

@ -158,7 +158,7 @@ long telldir(DIR *dir)
#void *dlsym(void *restrict, const char *restrict)
#
# * errno.h: no functions in errno.h
int *__stdc_geterrnoptr(void)
int *___geterrnoptr(void)
#
# * fcntl.h
int creat (const char * filename, int mode)
@ -235,7 +235,7 @@ char *dirname(char *filename)
#locale_t uselocale (locale_t)
#
# * math.h:
int *__stdc_getsigngamptr(void)
int *___getsigngamptr(void)
double lgamma(double d)
.alias gamma
float lgammaf(float f)
@ -641,7 +641,7 @@ int vscanf(const char *restrict format, va_list args)
#int vsscanf(const char *restrict, const char *restrict, va_list)
#
# * stdlib.h: POSIX.1-2008 specific functions and some C99 functions
int __stdc_mb_cur_max(void)
int ___mb_cur_max(void)
.skip 1
#long a64l(const char *)
double drand48(void)

View File

@ -12,3 +12,16 @@
/* Needs to be included here, as posixc/strerror is already included in mmakefile.src and
these two files overalap by name */
#include "../stdc/strerror.c"
#define __stdc_geterrnoptr(a) ___geterrnoptr(a)
#include "../stdc/__stdc_geterrnoptr.c"
#define __stdc_getsigngamptr(a) ___getsigngamptr(a)
#include "../stdc/__stdc_getsigngamptr.c"
#define __stdc_mb_cur_max(a) ___mb_cur_max(a)
#include "../stdc/__stdc_mb_cur_max.c"
#define __stdc_gmtoffset(a) ___gmtoffset(a)
#include "../posixc/gettimeofday.c"
#include "../posixc/clock_gettime.c"

View File

@ -400,7 +400,6 @@ STDLIB := \
../stdc/gmtime_r \
../stdc/imaxabs \
../stdc/imaxdiv \
../stdc/localtime_r \
../stdc/localeconv \
../stdc/longjmp \
../stdc/mblen \
@ -523,7 +522,6 @@ CRT := \
../posixc/chmod \
../posixc/chown \
../posixc/clearerr \
../posixc/clock_gettime \
../posixc/close \
../posixc/closedir \
../posixc/creat \
@ -603,7 +601,6 @@ CRT := \
../posixc/getpwuid \
../posixc/getrlimit \
../posixc/gets \
../posixc/gettimeofday \
../posixc/getuid \
../posixc/ioctl \
../posixc/isatty \
@ -713,10 +710,7 @@ CRT := \
../stdc/__exitfunc \
../stdc/__optionallibs \
../stdc/__signal \
../stdc/__stdc_geterrnoptr \
../stdc/__stdc_getsigngamptr \
../stdc/__stdc_ioerr2errno \
../stdc/__stdc_mb_cur_max \
../stdc/_exit \
../stdc/abort \
../stdc/asctime \

View File

@ -1,5 +1,5 @@
##begin config
version 1.3
version 1.4
basename Stdlib
libbasetypeextern struct StdlibBase
libbasetype struct StdlibIntBase
@ -25,7 +25,7 @@ libbasetype struct StdlibIntBase
##end startup
##begin functionlist
int __stdc_gmtoffset(void)
int ___gmtoffset(void)
.skip 19
# == C99 functions ordered per include file ==
.skip 1
@ -141,7 +141,7 @@ size_t strspn (const char * s1, const char * s2)
char *strstr (const char * buf, const char * str)
.skip 1 # char *strtok (char * str, const char * sep)
void *memset (void * dest, int c, size_t n)
.skip 1 # char *__stdc_strerror (int n)
.skip 1 # char *strerror (int n)
#.alias strerror
size_t strlen (const char * str)
#
@ -210,7 +210,7 @@ char *ctime_r(const time_t * tt, char * buf)
struct tm *gmtime_r(const time_t * tt, struct tm * tm)
struct tm *localtime_r(const time_t * tt, struct tm * tm)
#
# * wchar.h: mostly unimplemented in stdc.library
# * wchar.h: mostly unimplemented in stdlib.library
#
.skip 14
#wint_t btowc(int)
@ -266,7 +266,7 @@ wchar_t *wcsncpy(wchar_t * wcdst, const wchar_t * wcsrc, size_t cnt)
#int wprintf(const wchar_t *, ...)
#int wscanf(const wchar_t *, ...)
#
# * wctype.h: unimplemented in stdc.library
# * wctype.h: unimplemented in stdlib.library
#
.skip 18
#int iswalnum(wint_t)

View File

@ -18,7 +18,7 @@
NAME */
#include <time.h>
int __stdc_gmtoffset (
int ___gmtoffset (
/* SYNOPSIS */
void)

View File

@ -74,7 +74,7 @@ static int __init_timerbase(struct StdlibIntBase *StdlibBase);
GetSysTime(&tv);
tv.tv_sec += 2922 * 1440 * 60;
tv.tv_sec += __stdc_gmtoffset() * 60;
tv.tv_sec += ___gmtoffset() * 60;
if (tloc)
*tloc = tv.tv_sec;

View File

@ -26,4 +26,6 @@
#include "../stdc/stch_l.c"
#include "../stdc/stco_l.c"
#define __stdc_gmtoffset(a) ___gmtoffset(a)
#include "../stdc/localtime_r.c"

View File

@ -825,7 +825,7 @@ static void __fill_statbuffer(
st_atim, st_mtim and st_ctim */
sb->st_atime =
sb->st_ctime =
sb->st_mtime = (fib->fib_Date.ds_Days * 24*60 + fib->fib_Date.ds_Minute + __stdc_gmtoffset()) * 60 +
sb->st_mtime = (fib->fib_Date.ds_Days * 24*60 + fib->fib_Date.ds_Minute + ___gmtoffset()) * 60 +
fib->fib_Date.ds_Tick / TICKS_PER_SECOND + OFFSET_FROM_1970;
sb->st_uid = __id_a2u(fib->fib_OwnerUID);
sb->st_gid = __id_a2u(fib->fib_OwnerGID);
@ -915,7 +915,7 @@ static void __fill_stat64buffer(
st_atim, st_mtim and st_ctim */
sb->st_atime =
sb->st_ctime =
sb->st_mtime = (fib->fib_Date.ds_Days * 24*60 + fib->fib_Date.ds_Minute + __stdc_gmtoffset()) * 60 +
sb->st_mtime = (fib->fib_Date.ds_Days * 24*60 + fib->fib_Date.ds_Minute + ___gmtoffset()) * 60 +
fib->fib_Date.ds_Tick / TICKS_PER_SECOND + OFFSET_FROM_1970;
sb->st_uid = __id_a2u(fib->fib_OwnerUID);
sb->st_gid = __id_a2u(fib->fib_OwnerGID);

View File

@ -82,9 +82,9 @@ __BEGIN_DECLS
This way errno.h include file can be kept clean without
exposing AROS specific defines as defined in exec/types.h etc.
*/
int *__stdc_geterrnoptr(void);
int *___geterrnoptr(void);
#ifndef errno
#define errno (*__stdc_geterrnoptr())
#define errno (*___geterrnoptr())
#endif
/* AROS specific functions to translate DOS error numbers to errno.

View File

@ -174,9 +174,9 @@ typedef long double float_t;
* to just declare extern int signgam; in the program but this is not
* supported.
*/
int *__stdc_getsigngamptr(void);
int *___getsigngamptr(void);
#ifndef signgam
#define signgam (*__stdc_getsigngamptr())
#define signgam (*___getsigngamptr())
#endif
/* #endif __BSD_VISIBLE || __XSI_VISIBLE */

View File

@ -37,7 +37,7 @@ typedef struct lldiv_t {
#define EXIT_FAILURE 20 /* Failing exit status */
/* Gives the largest size of a multibyte character for the current locale */
#define MB_CUR_MAX (__stdc_mb_cur_max())
#define MB_CUR_MAX (___mb_cur_max())
#define RAND_MAX 2147483647
@ -120,7 +120,7 @@ int mblen(const char *s, size_t n);
/* INLINE size_t wcstombs(char * restrict s, const wchar_t * restrict pwcs, size_t n); */
/* AROS extra */
int __stdc_mb_cur_max(void);
int ___mb_cur_max(void);
void *malloc_align(size_t size, size_t alignment); /* AROS specific */
void *realloc_nocopy(void *oldmem, size_t newsize); /* AROS specific */
int on_exit(void (*func)(int, void *), void *);

View File

@ -55,7 +55,7 @@ struct tm *gmtime_r(const time_t *, struct tm *);
struct tm *localtime_r(const time_t *, struct tm *);
/* AROS extension */
int __stdc_gmtoffset(void);
int ___gmtoffset(void);
__END_DECLS

View File

@ -1,6 +1,6 @@
int errno;
int *__stdc_geterrnoptr(void)
int *___geterrnoptr(void)
{
return &errno;
}