summaryrefslogtreecommitdiff
path: root/devel/as31/patches/patch-as31.y
blob: 1e00fd4922f508a57cf4c892028af35ed13277dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
$NetBSD: patch-as31.y,v 1.1 2012/07/03 18:13:26 joerg Exp $

--- as31.y.orig	2012-07-03 10:49:15.000000000 +0000
+++ as31.y
@@ -28,6 +28,10 @@
 
 #define YYSTYPE union ystack
 
+void genbyte(int);
+void emitbyte(int);
+void emitaddr(unsigned long);
+
 extern int lineno;
 extern int dashl;
 extern char *asmfile;
@@ -948,6 +952,10 @@ relative	: expr
 
 %%
 
+#include <stdarg.h>
+void error(const char *, ...);
+void warning(const char *, ...);
+
 /* ---------------------------------------------------------------------- */
 
 yyerror(s)
@@ -963,11 +971,13 @@ char *s;
  *	termination.
  */
 
-error(cs,a1,a2,a3,a4,a5,a6)
-char *cs,*a1,*a2,*a3,*a4,*a5,*a6;
+void error(const char *cs, ...)
 {
+	va_list ap;
+	va_start(ap, cs);
 	fprintf(stderr,"File: %s, line: %d, ",asmfile,lineno);
-	fprintf(stderr,cs,a1,a2,a3,a4,a5,a6);
+	vfprintf(stderr,cs, ap);
+	va_end(ap);
 	fprintf(stderr,".\n");
 	longjmp(main_env,1);
 }
@@ -979,12 +989,14 @@ char *cs,*a1,*a2,*a3,*a4,*a5,*a6;
  *
  */
 
-warning(cs,a1,a2,a3,a4,a5,a6)
-char *cs,*a1,*a2,*a3,*a4,*a5,*a6;
+void warning(const char *cs, ...)
 {
+	va_list ap;
+	va_start(ap, cs);
 	fatal++;
 	fprintf(stderr,"File: %s, line: %d, ",asmfile,lineno);
-	fprintf(stderr,cs,a1,a2,a3,a4,a5,a6);
+	vfprintf(stderr,cs, ap);
+	va_end(ap);
 	fprintf(stderr,".\n");
 }
 
@@ -1095,7 +1107,7 @@ char *txt;
 {
 	int i,j;
 
-	fprintf(listing,show?"%04X: ":"      ",lc);
+	fprintf(listing,show?"%04lX: ":"      ",lc);
 
 	j=0;
 	for(i=0; i<bytecount; i++ ) {
@@ -1118,8 +1130,7 @@ char *txt;
  *
  */
 
-genbyte(b)
-int b;
+void genbyte(int b)
 {
 	if( bytecount < sizeof(bytebuf) )
 		bytebuf[bytecount++] = b;