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 <sys/types.h>
#include <alloca.h> #include <alloca.h>
void abort (void);
double atof (char const *s); double atof (char const *s);
int atoi (char const *s); int atoi (char const *s);
int atexit (void (*function) (void)); int atexit (void (*function) (void));

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * 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. * This file is part of GNU Mes.
* *
@ -18,6 +18,8 @@
* 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 <stdlib.h>
int int
__exit (int status) __exit (int status)
{ {

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * 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. * This file is part of GNU Mes.
* *
@ -18,6 +18,8 @@
* 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 <stdlib.h>
void void
abort (void) abort (void)
{ {

View file

@ -18,7 +18,9 @@
* 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 <stdlib.h> #include <stdlib.h>
#include <string.h>
#if !__MESC__ #if !__MESC__
typedef char wchar_t[]; typedef char wchar_t[];

View file

@ -21,8 +21,15 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if BZERO_INT
int int
#else
void
#endif
bzero (void *block, size_t size) 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> #include <string.h>
#if INDEX_INT
int int
#else
char *
#endif
index (char const *s, int c) 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> #include <string.h>
#if INDEX_INT
int int
#else
char *
#endif
rindex (char const *s, int c) rindex (char const *s, int c)
{ {
return strrchr (s, c); return strrchr (s, c);

View file

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

View file

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

View file

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