From 255e9b552b63777822a1859276552028b0285b16 Mon Sep 17 00:00:00 2001 From: Mario Carneiro Date: Thu, 30 Dec 2021 04:19:18 -0500 Subject: [PATCH] add gitignore, fix c99 warnings --- .gitignore | 14 ++++++++++++++ metamath.c | 5 ++++- mminou.c | 12 +----------- 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..8a56084e --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +*.o +*.Po +autom4te.cache/ +stamp-h1 +missing +metamath +Makefile +Makefile.in +compile +configure +config.* +depcomp +install-sh +aclocal.m4 diff --git a/metamath.c b/metamath.c index c351ae5c..f94bace7 100644 --- a/metamath.c +++ b/metamath.c @@ -1058,7 +1058,10 @@ void command(int argc, char *argv[]) { } } /* Do the operating system command */ - (void)system(str1); + /* The use of (void)!f() is to ignore the value on both + clang (which takes (void) as an ignore indicator) + and gcc (which doesn't but is fooled by the ! operator). */ + (void)!system(str1); #ifdef VAXC printf("\n"); /* Last line from VAX doesn't have new line */ #endif diff --git a/mminou.c b/mminou.c index 2d2e16e1..872cc78c 100644 --- a/mminou.c +++ b/mminou.c @@ -81,16 +81,6 @@ flag print2(char* fmt, ...) { long i; char *printBuffer; /* Allocated dynamically */ - /* gcc (Debian 4.9.2-10+deb8u2) 4.9.2 gives error for ssize_t if -c99 - is specified; gcc (GCC) 7.3.0 doesn't complain if -c99 is specified */ - /* See https://sourceforge.net/p/predef/wiki/Compilers/ for __LCC__ */ -#ifdef __LCC__ /* ssize_t not defined for lcc compiler */ - long bufsiz; -#else - ssize_t bufsiz; /* ssize_t (signed size_t) can represent the number -1 for - error checking */ -#endif - if (backBufferPos == 0) { /* Initialize backBuffer - 1st time in program */ @@ -216,7 +206,7 @@ flag print2(char* fmt, ...) { /* Allow unlimited output size */ va_start(ap, fmt); - bufsiz = vsnprintf(NULL, 0, fmt, ap); /* Get the buffer size we need */ + int bufsiz = vsnprintf(NULL, 0, fmt, ap); /* Get the buffer size we need */ va_end(ap); /* Warning: some older complilers, including lcc-win32 version 3.8 (2004), return -1 instead of the buffer size */