mescc: Mes C Library: Fix compile warnings.

* include/libmes.h (dtoab, itoa, ltoa, ntoab, ultoa, utoa): Return
char* (WAS: char const*).
* lib/*/*c: Update, add missing includes.
This commit is contained in:
Jan Nieuwenhuizen 2019-03-03 10:04:33 +01:00
parent c5e098bc35
commit 66019c8421
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
12 changed files with 33 additions and 28 deletions

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 © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -24,13 +24,17 @@
#include <libmes-mini.h> #include <libmes-mini.h>
int __mes_debug (); int __mes_debug ();
long abtol (char const** p, int base); void __ungetc_init ();
char const* ntoab (long number, int base, int signed_p); void __ungetc_clear (int filedes);
char const* itoa (int number); void __ungetc_set (int filedes, int c);
char const* ltoa (long number); int __ungetc_p (int filedes);
char const* ultoa (unsigned long number); long abtol (char const **p, int base);
char const* utoa (unsigned number); char *itoa (int number);
char const* ltoab (long x, int base); char *ltoa (long number);
char *ltoab (long x, int base);
char *ntoab (long number, int base, int signed_p);
char *ultoa (unsigned long number);
char *utoa (unsigned number);
int atoi (char const *s); int atoi (char const *s);
int eputc (int c); int eputc (int c);
int fdgetc (int fd); int fdgetc (int fd);

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 © 2017 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.
* *
@ -31,7 +31,7 @@
#define __FOO_VARARGS 1 #define __FOO_VARARGS 1
#endif #endif
typedef long va_list; typedef char *va_list;
#define va_start(ap, last) (void)((ap) = (char*)(&(last) + 1)) #define va_start(ap, last) (void)((ap) = (char*)(&(last) + 1))
#define va_arg(ap, type) (type)(((long*)((ap) = ((ap) + sizeof (void*))))[-1]) #define va_arg(ap, type) (type)(((long*)((ap) = ((ap) + sizeof (void*))))[-1])
#define va_end(ap) (void)((ap) = 0) #define va_end(ap) (void)((ap) = 0)

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 © 2017 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.
* *
@ -31,6 +31,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <alloca.h> #include <alloca.h>
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));
void * calloc (size_t nmemb, size_t size); void * calloc (size_t nmemb, size_t size);

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 © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *

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 © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -20,7 +20,7 @@
#include <libmes.h> #include <libmes.h>
char const* char *
itoa (int x) itoa (int x)
{ {
return ntoab (x, 10, 1); return ntoab (x, 10, 1);

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.
* *
@ -20,7 +20,7 @@
#include <libmes.h> #include <libmes.h>
char const* char *
ltoa (long x) ltoa (long x)
{ {
return ntoab (x, 10, 1); return ntoab (x, 10, 1);

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 © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -20,7 +20,7 @@
#include <libmes.h> #include <libmes.h>
char const* char *
ltoab (long x, int base) ltoab (long x, int base)
{ {
return ntoab (x, base, 1); return ntoab (x, base, 1);

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 © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -20,7 +20,7 @@
#include <libmes.h> #include <libmes.h>
char const* char *
ntoab (long x, int base, int signed_p) ntoab (long x, int base, int signed_p)
{ {
static char itoa_buf[20]; static char itoa_buf[20];

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.
* *
@ -20,7 +20,7 @@
#include <libmes.h> #include <libmes.h>
char const* char *
ultoa (unsigned long x) ultoa (unsigned long x)
{ {
return ntoab (x, 10, 1); return ntoab (x, 10, 1);

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 © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -20,7 +20,7 @@
#include <libmes.h> #include <libmes.h>
char const* char *
utoa (unsigned x) utoa (unsigned x)
{ {
return ntoab (x, 10, 0); return ntoab (x, 10, 0);

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 © 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.
* *
@ -24,5 +24,5 @@
int int
vprintf (char const* format, va_list ap) vprintf (char const* format, va_list ap)
{ {
return vfprintf (STDOUT, format, ap); return vfprintf (stdout, format, ap);
} }

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 © 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.
* *
@ -18,8 +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 <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h>
int int
vsprintf (char *str, char const* format, va_list ap) vsprintf (char *str, char const* format, va_list ap)