aports/main/dev86/gcc15.patch
J. Neuschäfer e5f37b108d main/dev86: fix build with gcc15
gcc15.patch is based on gcc14.patch, but covers more errors that appeared
with GCC 15.
2025-08-04 20:47:27 +00:00

509 lines
13 KiB
Diff

diff --git a/ar/ar.c b/ar/ar.c
index f808a3a..fce2ab7 100644
--- a/ar/ar.c
+++ b/ar/ar.c
@@ -612,7 +612,7 @@ print_descr (member, instream)
return;
}
print_modes (member.mode);
- timestring = ctime (&member.date);
+ timestring = ctime ((const time_t *)&member.date);
printf (" %2d/%2d %6d %12.12s %4.4s %s\n",
member.uid, member.gid,
member.size, timestring + 4, timestring + 20,
diff --git a/bcc/dbprintf.c b/bcc/dbprintf.c
index a77a012..bc0b498 100644
--- a/bcc/dbprintf.c
+++ b/bcc/dbprintf.c
@@ -1,6 +1,8 @@
#include <sys/types.h>
#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
#if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__)
#include <stdarg.h>
@@ -10,6 +12,8 @@
#define va_strt(p,i) va_start(p)
#endif
+int vdbprintf(register __const char *fmt, register va_list ap);
+
#if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__)
int dbprintf(const char * fmt, ...)
#else
diff --git a/cpp/cpp.c b/cpp/cpp.c
index a6e7337..1ca4422 100644
--- a/cpp/cpp.c
+++ b/cpp/cpp.c
@@ -545,7 +545,7 @@ chget()
}
static void
-unchget(ch)
+unchget(int ch)
{
#if CPP_DEBUG
fprintf(stderr, "\b", ch);
diff --git a/ld/catimage.c b/ld/catimage.c
index 1f5e160..6e726a6 100644
--- a/ld/catimage.c
+++ b/ld/catimage.c
@@ -27,6 +27,15 @@
#endif
#include "x86_aout.h"
+#include <string.h>
+
+void fatal(char * str);
+void open_obj(char * fname);
+void copy_segment(long out_offset, long in_offset, long length);
+void patch_bin(long file_off, int value);
+void read_symtable();
+void fatal(char * str);
+
#ifndef __OUT_OK
#error "Compile error: struct exec invalid (long not 32 bit ?)"
#endif
@@ -39,7 +48,7 @@ FILE * ofd;
FILE * ifd = 0;
struct exec header;
-main(argc, argv)
+void main(argc, argv)
int argc;
char ** argv;
{
@@ -100,7 +109,7 @@ char ** argv;
exit(0);
}
-open_obj(fname)
+void open_obj(fname)
char * fname;
{
input_file = fname;
@@ -117,7 +126,7 @@ char * fname;
fatal("Input file has bad magic number");
}
-copy_segment(out_offset, in_offset, length)
+void copy_segment(out_offset, in_offset, length)
long out_offset, in_offset, length;
{
char buffer[1024];
@@ -143,7 +152,7 @@ long out_offset, in_offset, length;
}
}
-patch_bin(file_off, value)
+void patch_bin(file_off, value)
long file_off;
int value;
{
@@ -163,7 +172,7 @@ int value;
}
}
-read_symtable()
+void read_symtable()
{
struct nlist item;
int nitems;
@@ -234,7 +243,7 @@ read_symtable()
}
}
-fatal(str)
+void fatal(str)
char * str;
{
fprintf(stderr, "catimage:%s: %s\n", input_file, str);
diff --git a/ld/objchop.c b/ld/objchop.c
index c7631c1..7d09619 100644
--- a/ld/objchop.c
+++ b/ld/objchop.c
@@ -6,9 +6,12 @@
#endif
#include "x86_aout.h"
+void fatal(char * str);
+void write_file(char * fname, long bsize);
+
#ifndef __OUT_OK
-main()
+void main()
{
fprintf(stderr, "Compile error: struct exec invalid\n");
exit(1);
@@ -19,7 +22,7 @@ main()
FILE * ifd;
struct exec header;
-main(argc, argv)
+void main(argc, argv)
int argc;
char ** argv;
{
@@ -56,7 +59,7 @@ char ** argv;
exit(0);
}
-write_file(fname, bsize)
+void write_file(fname, bsize)
char * fname;
long bsize;
{
@@ -81,7 +84,7 @@ long bsize;
fclose(ofd);
}
-fatal(str)
+void fatal(str)
char * str;
{
fprintf(stderr, "objchop: %s\n", str);
diff --git a/unproto/error.c b/unproto/error.c
index 667d978..1f42a06 100644
--- a/unproto/error.c
+++ b/unproto/error.c
@@ -52,8 +52,7 @@ static char error_sccsid[] = "@(#) error.c 1.2 92/01/15 21:53:10";
/* C library */
#include <stdio.h>
-
-extern void exit();
+#include <stdlib.h>
/* Application-specific stuff */
diff --git a/unproto/error.h b/unproto/error.h
index dfb27e9..cb52ae6 100644
--- a/unproto/error.h
+++ b/unproto/error.h
@@ -1,6 +1,6 @@
/* @(#) error.h 1.2 92/01/15 21:53:14 */
extern int errcount; /* error counter */
-extern void error(); /* default context */
-extern void error_where(); /* user-specified context */
-extern void fatal(); /* fatal error */
+extern void error(char *text); /* default context */
+extern void error_where(char *path, int line, char *text); /* user-specified context */
+extern void fatal(char *text); /* fatal error */
diff --git a/unproto/strsave.c b/unproto/strsave.c
index c2a4b15..fc97801 100644
--- a/unproto/strsave.c
+++ b/unproto/strsave.c
@@ -26,11 +26,13 @@ static char strsave_sccsid[] = "@(#) strsave.c 1.1 92/01/15 21:53:13";
/* C library */
-extern char *strcpy();
-extern char *malloc();
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
/* Application-specific stuff */
+int hash(char *s, unsigned size);
#include "error.h"
#define STR_TABSIZE 100
diff --git a/unproto/symbol.c b/unproto/symbol.c
index ce9f7d9..9e1329e 100644
--- a/unproto/symbol.c
+++ b/unproto/symbol.c
@@ -42,11 +42,13 @@ static char symbol_sccsid[] = "@(#) symbol.c 1.4 92/02/15 18:59:56";
/* C library */
-extern char *strcpy();
-extern char *malloc();
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
/* Application-specific stuff */
+int hash(char *s, unsigned size);
#include "error.h"
#include "token.h"
#include "symbol.h"
diff --git a/unproto/symbol.h b/unproto/symbol.h
index 0711c1f..0e2b1d8 100644
--- a/unproto/symbol.h
+++ b/unproto/symbol.h
@@ -6,6 +6,6 @@ struct symbol {
struct symbol *next;
};
-extern void sym_enter(); /* add symbol to table */
-extern struct symbol *sym_find(); /* locate symbol */
+extern void sym_enter(char *name, int type); /* add symbol to table */
+extern struct symbol *sym_find(register char *name); /* locate symbol */
extern void sym_init(); /* prime the table */
diff --git a/unproto/tok_class.c b/unproto/tok_class.c
index 38ccd0d..06aaff5 100644
--- a/unproto/tok_class.c
+++ b/unproto/tok_class.c
@@ -49,10 +49,8 @@ static char class_sccsid[] = "@(#) tok_class.c 1.4 92/01/15 21:53:02";
/* C library */
#include <stdio.h>
-
-extern char *strcpy();
-extern long time();
-extern char *ctime();
+#include <string.h>
+#include <time.h>
/* Application-specific stuff */
@@ -61,16 +59,16 @@ extern char *ctime();
#include "token.h"
#include "symbol.h"
-static struct token *tok_list();
-static void tok_list_struct();
-static void tok_list_append();
-static void tok_strcat();
-static void tok_time();
-static void tok_date();
-static void tok_space_append();
+static struct token *tok_list(struct token *t);
+static void tok_list_struct(register struct token *list, register struct token *t);
+static void tok_list_append(struct token *h, struct token *t);
+static void tok_strcat(register struct token *t1);
+static void tok_time(struct token *t);
+static void tok_date(struct token *t);
+static void tok_space_append(register struct token *list, register struct token *t);
#if defined(MAP_VOID_STAR) || defined(MAP_VOID)
-static void tok_void(); /* rewrite void keyword */
+static void tok_void(register struct token *t); /* rewrite void keyword */
#endif
static struct token *tok_buf = 0; /* token push-back storage */
diff --git a/unproto/tok_io.c b/unproto/tok_io.c
index 3cae52e..6347949 100644
--- a/unproto/tok_io.c
+++ b/unproto/tok_io.c
@@ -80,11 +80,8 @@ static char io_sccsid[] = "@(#) tok_io.c 1.3 92/01/15 21:52:59";
#include <stdio.h>
#include <ctype.h>
-
-extern char *strchr();
-extern char *malloc();
-extern char *realloc();
-extern char *strcpy();
+#include <string.h>
+#include <stdlib.h>
/* Application-specific stuff */
@@ -92,7 +89,7 @@ extern char *strcpy();
#include "vstring.h"
#include "error.h"
-extern char *strsave(); /* XXX need include file */
+extern char *strsave(register char *str); /* XXX need include file */
/* Stuff to keep track of original source file name and position */
@@ -107,12 +104,12 @@ int last_ch; /* type of last output */
/* Forward declarations */
-static int read_quoted();
-static void read_comment();
+static int read_quoted(register struct vstring *vs, int ch);
+static void read_comment(register struct vstring *vs);
static int backslash_newline();
-static char *read_hex();
-static char *read_octal();
-static void fix_line_control();
+static char *read_hex(struct vstring *vs, register char *cp);
+static char *read_octal(register struct vstring *vs, register char *cp, register int c);
+static void fix_line_control(register char *path, register int line);
/*
* Character input with one level of pushback. The INPUT() macro recursively
@@ -228,7 +225,7 @@ static int do_control()
}
out_line = in_line = line; /* synchronize */
out_path = in_path = path; /* synchronize */
- return;
+ return 0;
#ifdef IGNORE_DIRECTIVES
@@ -247,7 +244,7 @@ static int do_control()
do {
tok_free(t);
} while (t->tokno != '\n' && (t = tok_get()));
- return;
+ return 0;
}
}
}
@@ -259,12 +256,12 @@ static int do_control()
do {
tok_flush(t);
} while (t->tokno != '\n' && (t = tok_get()));
- return;
+ return 0;
case 0:
/* Hit EOF, punt. */
put_ch('#');
- return;
+ return 0;
}
}
}
diff --git a/unproto/tok_pool.c b/unproto/tok_pool.c
index e2ed107..6b1bbfe 100644
--- a/unproto/tok_pool.c
+++ b/unproto/tok_pool.c
@@ -37,7 +37,7 @@ static char pool_sccsid[] = "@(#) tok_pool.c 1.2 92/01/15 21:53:04";
/* C library */
-extern char *malloc();
+#include <stdlib.h>
/* Application-specific stuff */
diff --git a/unproto/token.h b/unproto/token.h
index bb2f50a..e3752a0 100644
--- a/unproto/token.h
+++ b/unproto/token.h
@@ -27,11 +27,11 @@ struct token {
/* Input/output functions and macros */
extern struct token *tok_get(); /* read next single token */
-extern void tok_show(); /* display (composite) token */
+extern void tok_show(register struct token *t); /* display (composite) token */
extern struct token *tok_class(); /* classify tokens */
-extern void tok_unget(); /* stuff token back into input */
+extern void tok_unget(register struct token *t); /* stuff token back into input */
extern void put_nl(); /* print newline character */
-extern void tok_show_ch(); /* emit single-character token */
+extern void tok_show_ch(register struct token *t); /* emit single-character token */
#define tok_flush(t) (tok_show(t), tok_free(t))
@@ -46,7 +46,7 @@ extern void tok_show_ch(); /* emit single-character token */
/* Memory management */
struct token *tok_alloc(); /* allocate token storage */
-extern void tok_free(); /* re-cycle storage */
+extern void tok_free(register struct token *t); /* re-cycle storage */
/* Context */
diff --git a/unproto/unproto.c b/unproto/unproto.c
index 1f29bff..c5ccd33 100644
--- a/unproto/unproto.c
+++ b/unproto/unproto.c
@@ -138,11 +138,9 @@ static char unproto_sccsid[] = "@(#) unproto.c 1.6 93/06/18 22:29:37";
#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>
-
-extern void exit();
-extern int optind;
-extern char *optarg;
-extern int getopt();
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
/* Application-specific stuff */
@@ -158,16 +156,16 @@ extern int getopt();
/* Forward declarations. */
-static struct token *dcl_flush();
-static void block_flush();
+static struct token *dcl_flush(register struct token *t);
+static void block_flush(register struct token *t);
static void block_dcls();
-static struct token *show_func_ptr_type();
-static struct token *show_struct_type();
-static void show_arg_name();
-static void show_type();
-static void pair_flush();
-static void check_cast();
-static void show_empty_list();
+static struct token *show_func_ptr_type(struct token *t1, struct token *t2);
+static struct token *show_struct_type(register struct token *p);
+static void show_arg_name(register struct token *s);
+static void show_type(register struct token *s);
+static void pair_flush(register struct token *t, register int start, register int stop);
+static void check_cast(struct token *t);
+static void show_empty_list(register struct token *t);
#define check_cast_flush(t) (check_cast(t), tok_free(t))
diff --git a/unproto/vstring.c b/unproto/vstring.c
index 220bd53..7397f8c 100644
--- a/unproto/vstring.c
+++ b/unproto/vstring.c
@@ -67,8 +67,7 @@ static char vstring_sccsid[] = "@(#) vstring.c 1.3 92/01/15 21:53:06";
/* C library */
-extern char *malloc();
-extern char *realloc();
+#include <stdlib.h>
/* Application-specific stuff */
diff --git a/unproto/vstring.h b/unproto/vstring.h
index c2e1f88..c4226f4 100644
--- a/unproto/vstring.h
+++ b/unproto/vstring.h
@@ -5,9 +5,10 @@ struct vstring {
char *last; /* last position */
};
-extern struct vstring *vs_alloc(); /* initial allocation */
-extern char *vs_realloc(); /* string extension */
-extern char *vs_strcpy(); /* copy string */
+extern struct vstring *vs_alloc(int len); /* initial allocation */
+extern char *vs_realloc(register struct vstring *vp, char *cp); /* string extension */
+extern char *vs_strcpy(register struct vstring *vp, register char *dst, register char *src); /* copy string */
+
/* macro to add one character to auto-resized string */
diff --git a/unproto/tok_class.c b/unproto/tok_class.c
index 06aaff5..cb7881c 100644
--- a/unproto/tok_class.c
+++ b/unproto/tok_class.c
@@ -363,7 +363,7 @@ register struct token *t;
static void tok_time(t)
struct token *t;
{
- long now;
+ time_t now;
char *cp;
char buf[BUFSIZ];
@@ -385,7 +385,7 @@ struct token *t;
static void tok_date(t)
struct token *t;
{
- long now;
+ time_t now;
char *cp;
char buf[BUFSIZ];