* build-aux/build-lib.sh: Avoid building libc for --with-system-libc.
Make libmes richer.
build-aux/check-mescc.sh: Enable 50-malloc test.
* include/dirstream.h: Use HAVE_DIRSTREAM_H to cater for non-existing
dirstream.h.
* include/grp.h[SYSTEM_LIBC]: Typo.
* include/mes/lib.h (__brk, __call_at_exit)[SYSTEM_LIBC]: Declare.
* include/stdlib.h (comparison_fn_t)[SYSTEM_LIBC]: Declare.
* include/time.h (mktime): Return time_t.
* lib/posix/isatty.c [SYSTEM_LIBC]: Do not (re)declare termios.
* lib/stub/mktime.c (mktime): Return time_t.
* lib/tests/scaffold/41-ternary.c (main): Remove assumption that
locals are initialized.
* lib/tests/scaffold/70-stdarg.c: Cater for SYSTEM_LIBC.
* lib/tests/setjmp/80-setjmp.c: Declare jmp buf.
* lib/*/*.c: Add missing mes/lib.h, errno.h includes.
44 files changed:
libmes_SOURCES="
$libc_mini_SOURCES
libmes_SOURCES="
$libc_mini_SOURCES
+lib/ctype/isnumber.c
+lib/mes/abtol.c
lib/mes/itoa.c
lib/mes/ltoa.c
lib/mes/ltoab.c
lib/mes/itoa.c
lib/mes/ltoa.c
lib/mes/ltoab.c
if test $mes_libc = mes; then
libmes_SOURCES="$libmes_SOURCES
lib/stdlib/atoi.c
if test $mes_libc = mes; then
libmes_SOURCES="$libmes_SOURCES
lib/stdlib/atoi.c
lib/ctype/isspace.c
lib/ctype/isxdigit.c
"
lib/ctype/isspace.c
lib/ctype/isxdigit.c
"
+else
+ libmes_SOURCES="$libmes_SOURCES
+"
lib/stub/mprotect.c
lib/stub/localtime.c
lib/stub/sigemptyset.c
lib/stub/mprotect.c
lib/stub/localtime.c
lib/stub/sigemptyset.c
-lib/ctype/islower.c
-lib/ctype/isupper.c
-lib/ctype/tolower.c
-lib/ctype/toupper.c
-lib/mes/search-path.c
-lib/posix/execvp.c
-lib/stdio/fclose.c
-lib/stdio/fdopen.c
-lib/stdio/ferror.c
-lib/stdio/fflush.c
-lib/stdio/fopen.c
-lib/stdio/fprintf.c
-lib/stdio/fread.c
-lib/stdio/fseek.c
-lib/stdio/ftell.c
-lib/stdio/fwrite.c
-lib/stdio/printf.c
-lib/stdio/remove.c
-lib/stdio/snprintf.c
-lib/stdio/sprintf.c
-lib/stdio/sscanf.c
-lib/stdio/vfprintf.c
-lib/stdio/vprintf.c
-lib/stdio/vsnprintf.c
-lib/stdio/vsprintf.c
-lib/stdio/vsscanf.c
-lib/stdlib/calloc.c
-lib/stdlib/qsort.c
-lib/stdlib/strtof.c
-lib/stdlib/strtol.c
-lib/stdlib/strtold.c
-lib/stdlib/strtoll.c
-lib/stdlib/strtoul.c
-lib/stdlib/strtoull.c
-lib/string/memmem.c
-lib/string/memmove.c
-lib/string/strcat.c
-lib/string/strchr.c
-lib/string/strlwr.c
-lib/string/strncpy.c
-lib/string/strrchr.c
-lib/string/strstr.c
-lib/string/strupr.c
-lib/stub/sigaction.c
-lib/stub/ldexp.c
-lib/stub/mprotect.c
-lib/stub/localtime.c
-lib/stub/sigemptyset.c
-xslib/stub/strtod.c
lib/$mes_cpu-mes-$compiler/setjmp.c
"
lib/$mes_cpu-mes-$compiler/setjmp.c
"
cp libmes.s $mes_cpu-mes
fi
cp libmes.s $mes_cpu-mes
fi
-archive libc.a $libc_SOURCES
-cp libc.a $mes_cpu-mes
-if test -e libc.s; then
- cp libc.S $mes_cpu-mes
+if test $mes_libc = mes; then
+ archive libc.a $libc_SOURCES
+ cp libc.a $mes_cpu-mes
+ if test -e libc.s; then
+ cp libc.s $mes_cpu-mes
+ fi
fi
archive libc+tcc.a $libc_tcc_SOURCES
fi
archive libc+tcc.a $libc_tcc_SOURCES
lib/tests/assert/50-assert.c
lib/tests/mes/50-itoa.c
lib/tests/posix/50-getenv.c
lib/tests/assert/50-assert.c
lib/tests/mes/50-itoa.c
lib/tests/posix/50-getenv.c
+lib/tests/stdlib/50-malloc.c
lib/tests/string/50-strcmp.c
lib/tests/string/50-strcpy.c
lib/tests/string/50-strncmp.c
lib/tests/string/50-strcmp.c
lib/tests/string/50-strcpy.c
lib/tests/string/50-strncmp.c
if test $mes_libc = system; then
crt1=
if test $mes_libc = system; then
crt1=
#ifndef __MES_DIRSTREAM_H
#define __MES_DIRSTREAM_H 1
#ifndef __MES_DIRSTREAM_H
#define __MES_DIRSTREAM_H 1
+#if SYSTEM_LIBC && HAVE_DIRSTREAM_H
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#if SYSTEM_LIBC
#undef __MES_GRP_H
#if SYSTEM_LIBC
#undef __MES_GRP_H
#else // ! SYSTEM_LIBC
#include <sys/types.h>
#else // ! SYSTEM_LIBC
#include <sys/types.h>
int fdputc (int c, int fd);
int fdputs (char const *s, int fd);
int fdungetc (int c, int fd);
int fdputc (int c, int fd);
int fdputs (char const *s, int fd);
int fdungetc (int c, int fd);
+int isnumber (int c, int base);
int mes_open (char const *file_name, int flags, int mask);
int _open2 (char const *file_name, int flags);
int _open3 (char const *file_name, int flags, int mask);
int mes_open (char const *file_name, int flags, int mask);
int _open2 (char const *file_name, int flags);
int _open3 (char const *file_name, int flags, int mask);
int oputs (char const *s);
char *search_path (char const *file_name);
int oputs (char const *s);
char *search_path (char const *file_name);
extern char *__brk;
extern void (*__call_at_exit) (void);
extern char *__brk;
extern void (*__call_at_exit) (void);
void __assert_fail (char *s);
void _exit (int code);
long brk (void *addr);
void __assert_fail (char *s);
void _exit (int code);
long brk (void *addr);
#ifndef __MES_STDLIB_H
#define __MES_STDLIB_H 1
#ifndef __MES_STDLIB_H
#define __MES_STDLIB_H 1
+#ifndef __MES_COMPARISON_FN_T
+#define __MES_COMPARISON_FN_T
+typedef int (*comparison_fn_t) (void const *, void const *);
+#endif
+
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
-#ifndef __MES_COMPARISON_FN_T
-#define __MES_COMPARISON_FN_T
-typedef int (*comparison_fn_t) (void const *, void const *);
-#endif
-
void *bsearch (void const *key, void const *array, size_t count, size_t size, comparison_fn_t compare);
#endif // ! SYSTEM_LIBC
void *bsearch (void const *key, void const *array, size_t count, size_t size, comparison_fn_t compare);
#endif // ! SYSTEM_LIBC
int clock_gettime (clockid_t clk_id, struct timespec *tp);
struct tm *localtime (time_t const *timep);
struct tm *gmtime (time_t const *time);
int clock_gettime (clockid_t clk_id, struct timespec *tp);
struct tm *localtime (time_t const *timep);
struct tm *gmtime (time_t const *time);
+int nanosleep (struct timespec const *requested_time, struct timespec const *remaining);
time_t time (time_t * tloc);
#endif // ! SYSTEM_LIBC
time_t time (time_t * tloc);
#endif // ! SYSTEM_LIBC
// Taken from GNU C Library 1.06.4
// Taken from GNU C Library 1.06.4
#include <dirent.h>
#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <stdio.h>
#include <unistd.h>
// Taken from GNU C Library 2.2.5
// Taken from GNU C Library 2.2.5
#include <errno.h>
#include <limits.h>
#include <stddef.h>
#include <errno.h>
#include <limits.h>
#include <stddef.h>
#include <string.h>
#include <termio.h>
#include <string.h>
#include <termio.h>
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
cc_t c_line;
cc_t c_cc[NCCS];
};
cc_t c_line;
cc_t c_cc[NCCS];
};
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <mes/lib.h>
+#include <errno.h>
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
-#if __GNUC__ && __x86_64__
+#if __GNUC__ && __x86_64__ && !SYSTEM_LIBC
#define __FUNCTION_ARGS 1
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
#define __FUNCTION_ARGS 1
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
-#if __GNUC__ && __x86_64__
+#if __GNUC__ && __x86_64__ && !SYSTEM_LIBC
#define __FUNCTION_ARGS 3
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
#define __FUNCTION_ARGS 3
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
-#if __GNUC__ && __x86_64__
+#if __GNUC__ && __x86_64__ && !SYSTEM_LIBC
#define __FUNCTION_ARGS 2
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
#define __FUNCTION_ARGS 2
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdio.h>
size_t
#include <stdio.h>
size_t
#include <unistd.h>
char *
#include <unistd.h>
char *
#include <pwd.h>
struct passwd *
#include <pwd.h>
struct passwd *
#include <pwd.h>
struct passwd *
#include <pwd.h>
struct passwd *
{
static int stub = 0;
if (__mes_debug () && !stub)
{
static int stub = 0;
if (__mes_debug () && !stub)
#include <time.h>
#include <sys/time.h>
#include <time.h>
#include <sys/time.h>
#include <time.h>
#include <sys/time.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
char *
#include <unistd.h>
char *
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
- * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+ * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
*
* This file is part of GNU Mes.
*
int r;
va_start (ap, one);
int r;
va_start (ap, one);
-#if __GNUC__ && __x86_64__
+#if __GNUC__ && __x86_64__ && !SYSTEM_LIBC
#define __FUNCTION_ARGS 1
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
#define __FUNCTION_ARGS 1
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
int r;
va_start (ap, two);
int r;
va_start (ap, two);
-#if __GNUC__ && __x86_64__
+#if __GNUC__ && __x86_64__ && !SYSTEM_LIBC
#define __FUNCTION_ARGS 2
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
#define __FUNCTION_ARGS 2
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
int r;
va_start (ap, three);
int r;
va_start (ap, three);
-#if __GNUC__ && __x86_64__
+#if __GNUC__ && __x86_64__ && !SYSTEM_LIBC
#define __FUNCTION_ARGS 3
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
#define __FUNCTION_ARGS 3
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
#include <setjmp.h>
int foo;
#include <setjmp.h>
int foo;