source: mainline/uspace/app/pcc/f77/fcom/error.c@ 5974661

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 5974661 was a7de7182, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 14 years ago

Added pcc source tree (contents of pcc-1.0.0.tgz)

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/* $Id: error.c,v 1.8 2008/05/10 07:53:41 ragge Exp $ */
2/*
3 * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * Redistributions of source code and documentation must retain the above
10 * copyright notice, this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed or owned by Caldera
17 * International, Inc.
18 * Neither the name of Caldera International, Inc. nor the names of other
19 * contributors may be used to endorse or promote products derived from
20 * this software without specific prior written permission.
21 *
22 * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
23 * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
27 * FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#include <stdarg.h>
37
38#include "defines.h"
39#include "defs.h"
40
41void
42warn(char *s, ...)
43{
44 va_list ap;
45
46 if(nowarnflag)
47 return;
48
49 va_start(ap, s);
50 fprintf(diagfile, "Warning on line %d of %s: ", lineno, infname);
51 vfprintf(diagfile, s, ap);
52 fprintf(diagfile, "\n");
53 va_end(ap);
54 ++nwarn;
55}
56
57void
58err(char *s, ...)
59{
60 va_list ap;
61
62 va_start(ap, s);
63 fprintf(diagfile, "Error on line %d of %s: ", lineno, infname);
64 vfprintf(diagfile, s, ap);
65 fprintf(diagfile, "\n");
66 va_end(ap);
67 ++nerr;
68}
69
70void
71yyerror(s)
72char *s;
73{ err(s); }
74
75
76void
77dclerr(s, v)
78 char *s;
79 struct bigblock *v;
80{
81 char buff[100];
82
83 if(v) {
84 sprintf(buff, "Declaration error for %s: %s",
85 varstr(VL, v->b_name.varname), s);
86 err( buff);
87 } else
88 err1("Declaration error %s", s);
89}
90
91
92void
93execerr(char *s, ...)
94{
95 va_list ap;
96
97 va_start(ap, s);
98 fprintf(diagfile, "Error on line %d of %s: Execution error ",
99 lineno, infname);
100 vfprintf(diagfile, s, ap);
101 fprintf(diagfile, "\n");
102 va_end(ap);
103 ++nerr;
104}
105
106void
107fatal(char *s, ...)
108{
109 va_list ap;
110
111 va_start(ap, s);
112 fprintf(diagfile, "Compiler error line %d of %s: ", lineno, infname);
113 vfprintf(diagfile, s, ap);
114 fprintf(diagfile, "\n");
115 va_end(ap);
116
117 if(debugflag)
118 abort();
119 done(3);
120 exit(3);
121}
Note: See TracBrowser for help on using the repository browser.