Replace fake-varargs, which doesn't work on 64-bit machines, with real varargs.
authorDavid Given <dg@cowlark.com>
Fri, 22 Jun 2018 20:29:52 +0000 (22:29 +0200)
committerDavid Given <dg@cowlark.com>
Fri, 22 Jun 2018 20:29:52 +0000 (22:29 +0200)
util/ass/ass00.h
util/ass/ass80.c

index 42bd5b0..3f393c2 100644 (file)
@@ -256,3 +256,6 @@ struct  proctab {
        cons_t  pr_off;         /* distance from pb */
        cons_t  pr_loc;         /* number of bytes locals */
 };
+
+extern void error(const char* string1, ...);
+extern void werror(const char* string1, ...);
index 514c8db..122796c 100644 (file)
@@ -4,9 +4,10 @@
  *
  */
 
-#include        "ass00.h"
-#include        "assex.h"
-#include        <em_path.h>
+#include "ass00.h"
+#include "assex.h"
+#include <em_path.h>
+#include <stdarg.h>
 
 #ifndef NORCSID
 static char rcs_id[] = "$Id$" ;
@@ -29,7 +30,7 @@ zero(area,length) char *area; unsigned length ; {
 }
 
 /* VARARGS1 */
-static void pr_error(string1,a1,a2,a3,a4) char *string1 ; {
+static void pr_error(const char* string1, va_list ap) {
        /*
         * diagnostic output
         */
@@ -44,20 +45,28 @@ static void pr_error(string1,a1,a2,a3,a4) char *string1 ; {
                fprintf(stderr,"proc %s, ",pstate.s_curpro->p_name);
        }
        fprintf(stderr,"line %d: ",line_num);
-       fprintf(stderr,string1,a1,a2,a3,a4);
+       vfprintf(stderr,string1,ap);
        fprintf(stderr,"\n");
 }
 
 /* VARARGS1 */
-void error(string1,a1,a2,a3,a4) char *string1 ; {
-       pr_error(string1,a1,a2,a3,a4) ;
+void error(const char* string1, ...)
+{
+       va_list ap;
+       va_start(ap, string1);
+       pr_error(string1, ap);
+       va_end(ap);
        nerrors++ ;
 }
 
 /* VARARGS1 */
-void werror(string1,a1,a2,a3,a4) char *string1 ; {
+void werror(const char* string1, ...) {
+       va_list ap;
        if ( wflag ) return ;
-       pr_error(string1,a1,a2,a3,a4) ;
+
+       va_start(ap, string1);
+       pr_error(string1, ap);
+       va_end(ap);
 }
 
 fatal(s) char *s; {