Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!mcsun!cernvax!chx400!ethz!iis!prl From: prl@iis.UUCP (Peter Lamb) Newsgroups: comp.lang.c++ Subject: Re: stdarg on sparc Message-ID: <2832@iis.UUCP> Date: 14 Dec 89 08:50:31 GMT References: <2030@diamond.warwick.ac.uk> Organization: Integrated Systems Lab., ETH Zuerich Lines: 62 If you have source, another approach to the varargs problem on Sun4 (and DS[23]100) is to change the compiler not to add the _aunnn__ that it tacks onto the variable names IFF they begin with the magic string for varargs. The following patch will do this for 1.2.1 on Sun4. For DS[23]100, you will need to change the magic string to "va_alist". 2.0 may be patchable in a similar manner. Doing this saves having to run yet another pre/postprocessor.... Peter Lamb uucp: uunet!mcvax!ethz!prl eunet: prl@iis.ethz.ch Tel: +411 256 5241 Integrated Systems Laboratory ETH-Zentrum, 8092 Zurich @ @ Recognise the __builtin_ construct for Sun4 systems - used by the @ varargs.h stuff to tell the compiler that the arguments passed in @ registers have to be saved on the stack. Needed for the fix in @ form() in lib/stream/out.c @ *** print.c_dist Tue Feb 24 16:44:40 1987 --- print.c Mon Oct 16 11:10:42 1989 *************** *** 17,22 **** --- 17,23 ---- #include "cfront.h" #include "size.h" + extern int strncmp(const char*, const char*, int); extern FILE* out_file; char emode = 0; extern int ntok; *************** *** 581,587 **** fprintf(out_file,"_auto__O%d.__C%d_",i,i); else // putstring("_auto_"); ! fprintf(out_file,"_au%d_",lex_level); } break; case CLASS: --- 582,595 ---- fprintf(out_file,"_auto__O%d.__C%d_",i,i); else // putstring("_auto_"); ! // fprintf(out_file,"_au%d_",lex_level); ! // Hack for sun4 varargs; ! // Don't add _au%d if the name starts ! // with "__builtin_". prl 16/10/89 ! if(!string ! || strncmp(string, "__builtin_",10)) ! fprintf(out_file, ! "_au%d_",lex_level); } break; case CLASS: -- Peter Lamb uucp: uunet!mcvax!ethz!prl eunet: prl@iis.ethz.ch Tel: +411 256 5241 Integrated Systems Laboratory ETH-Zentrum, 8092 Zurich