1 /* Pieces of mars.c needed for for GCC
3 Original copyright from mars.c:
5 // Copyright (c) 1999-2007 by Digital Mars
7 // written by Walter Bright
9 // License for redistribution is by either the Artistic License
10 // in artistic.txt, or the GNU General Public License in gnu.txt.
11 // See the included readme.txt for details.
37 copyright
= "Copyright (c) 1999-2007 by Digital Mars";
38 written
= "written by Walter Bright";
40 global
.structalign
= 8;
42 memset(¶ms
, 0, sizeof(Param
));
51 buf
.printf("%s", filename
);
55 buf
.printf(":%u", linnum
);
57 return (char *)buf
.extractData();
60 Loc::Loc(Module
*mod
, unsigned linnum
)
62 this->linnum
= linnum
;
63 this->filename
= mod
? mod
->srcfile
->toChars() : NULL
;
66 /**************************************
67 * Print error message and exit.
70 void error(Loc loc
, const char *format
, ...)
74 verror(loc
, format
, ap
);
78 void verror(Loc loc
, const char *format
, va_list ap
)
82 char *p
= loc
.toChars();
85 fprintf(stderr
, "%s: ", p
);
88 fprintf(stderr
, "Error: ");
89 vfprintf(stderr
, format
, ap
);
90 fprintf(stderr
, "\n");
96 /***************************************
97 * Call this after printing out fatal error messages to clean up and exit