mescc: Mes C Library: Fix compile warnings.

* include/stdlib.h (abort): Add prototype.
This commit is contained in:
Jan Nieuwenhuizen 2019-06-12 15:59:06 +02:00
parent 396e96c056
commit 18195b4d05
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
13 changed files with 35 additions and 13 deletions

View File

@ -36,6 +36,7 @@ typedef int (*comparison_fn_t) (void const *, void const *);
#include <sys/types.h>
#include <alloca.h>
void abort (void);
double atof (char const *s);
int atoi (char const *s);
int atexit (void (*function) (void));

View File

@ -38,7 +38,7 @@ execl (char const *file_name, char const *arg, ...)
va_start (ap, arg);
argv[i++] = (char *)file_name;
arg = va_arg (ap, char const *);
arg = (char *) va_arg (ap, char const *);
while (arg)
{
argv[i++] = arg;

View File

@ -33,7 +33,7 @@ vfprintf (FILE * f, char const *format, va_list ap)
if (*p != '%')
{
count++;
fputc (*p++, fd);
fputc (*p++, f);
}
else
{
@ -88,7 +88,7 @@ vfprintf (FILE * f, char const *format, va_list ap)
{
case '%':
{
fputc (*p, fd);
fputc (*p, f);
count++;
break;
}
@ -96,7 +96,7 @@ vfprintf (FILE * f, char const *format, va_list ap)
{
char _c;
_c = va_arg (ap, long);
fputc (_c, fd);
fputc (_c, f);
break;
}
case 'd':
@ -108,7 +108,7 @@ vfprintf (FILE * f, char const *format, va_list ap)
{
long d = va_arg (ap, long);
int base = c == 'o' ? 8 : c == 'x' || c == 'X' ? 16 : 10;
char const *s = ntoab (d, base, c != 'u' && c != 'x' && c != 'X');
char *s = ntoab (d, base, c != 'u' && c != 'x' && c != 'X');
if (c == 'X')
strupr (s);
int length = strlen (s);

View File

@ -114,7 +114,7 @@ vsnprintf (char *str, size_t size, char const *format, va_list ap)
{
long d = va_arg (ap, long);
int base = c == 'o' ? 8 : c == 'x' || c == 'X' ? 16 : 10;
char const *s = ntoab (d, base, c != 'u' && c != 'x' && c != 'X');
char *s = ntoab (d, base, c != 'u' && c != 'x' && c != 'X');
if (c == 'X')
strupr (s);
int length = strlen (s);

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -18,6 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
int
__exit (int status)
{

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -18,6 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
void
abort (void)
{

View File

@ -18,7 +18,9 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <stdlib.h>
#include <string.h>
#if !__MESC__
typedef char wchar_t[];

View File

@ -21,8 +21,15 @@
#include <stdlib.h>
#include <string.h>
#if BZERO_INT
int
#else
void
#endif
bzero (void *block, size_t size)
{
return (int) (long) memset (block, 0, size);
#if BZERO_INT
return (int) (long)
#endif
memset (block, 0, size);
}

View File

@ -20,8 +20,12 @@
#include <string.h>
#if INDEX_INT
int
#else
char *
#endif
index (char const *s, int c)
{
return (int) (long) strchr (s, c);
return strchr (s, c);
}

View File

@ -20,7 +20,11 @@
#include <string.h>
#if INDEX_INT
int
#else
char *
#endif
rindex (char const *s, int c)
{
return strrchr (s, c);

View File

@ -23,7 +23,7 @@
size_t
strcspn (char const *string, char const *stopset)
{
char *p = string;
char *p = (char *) string;
while (*p)
if (strchr (stopset, *p))
break;

View File

@ -23,7 +23,7 @@
char *
strpbrk (char const *string, char const *stopset)
{
char *p = string;
char *p = (char *) string;
while (*p)
if (strchr (stopset, *p))
break;

View File

@ -20,7 +20,7 @@
#include <mes/lib.h>
int
double
frexp (int x)
{
static int stub = 0;