File: error.h

package info (click to toggle)
flang 20181226-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 181,072 kB
  • sloc: cpp: 1,182,685; ansic: 598,652; objc: 103,775; f90: 57,054; python: 15,041; fortran: 13,601; lisp: 10,416; perl: 2,460; asm: 2,148; sh: 1,544; awk: 995; cs: 565; xml: 403; lex: 295; makefile: 225; pascal: 130
file content (133 lines) | stat: -rw-r--r-- 4,090 bytes parent folder | download
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
 * Copyright (c) 2015-2018, NVIDIA CORPORATION.  All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

/** \file
 * \brief Compiler Error handling and reporting.
 */

#ifndef COMPILER_ERROR_H_
#define COMPILER_ERROR_H_

#include "gbldefs.h"
/* Get the error_code enum which is generated by the errmsg util. */
#include "errmsgdf.h"

/* The rest of error definitions */
#include "flang/Error/pgerror.h"

/**
 * \brief Convert an integer to a string, for printing numbers in error
 * messages.
 *
 * This returns a pointer to static data, so only use it once.
 */
char *errnum(int num);

/**
   \brief ...
 */
enum error_severity error_max_severity(void);

/** Write either error summary message for current subprogram unit, or final
 * execution summary line to user's terminal. Return the maximum error severity
 * seen for the entire file.
 */
int summary(bool final, int ipafollows);

/**
  * Prints information on behalf of failed asrt.
  * \param file: filename: name of file where assertion failed.
  * \param line: line number where assertion failed
  */
void asrt_failed(const char *filename, int line);

/**
 * Prints information on behalf of failed DEBUG_ASSERT.
 * \param filename name of file where assertion failed.
 * \param line     line number where assertion failed.
 * \param expr     string representation of assertion that failed.
 * \param txt      optional text to print via interr. Use NULL if no text
 */
void dassert_err(const char *filename, int line, const char *expr,
                 const char *txt);

/// \brief Set the emit error flag(s)
void erremit(int x);

/// \brief Issue a fatal error for gbl.lineno.
void errfatal(error_code_t ecode);

/// \brief Issue an informational message for gbl.lineno.
void errinfo(error_code_t ecode);

/// \brief Initialize error counts for new user subprogram
void errini(void);

/** 
    \brief Massage label name if necesseary.
    \param ecode  error number
    \param sev    error severity in range 1 ... 4
    \param eline  source file line number
    \param nm     label name
    \param op2    extra string
 */
void errlabel(error_code_t ecode, enum error_severity sev, int eline, char *nm,
              char *op2);

/** 
 * \brief Construct and issue an error message.
 * \param ecode  error number
 * \param sev    error severity (a value in the err_severity enum)
 * \param eline  source file line number
 * \param op1    string to be expanded into error message * or 0
 * \param op2    string to be expanded into error message * or 0
 *
 * Construct error message and issue it to user terminal and to listing file
 * if appropriate.
 */
void error(error_code_t ecode, enum error_severity sev, int eline,
           const char *op1, const char *op2);

/// \brief Issue a severe error message for gbl.lineno.
void errsev(error_code_t ecode);

/// \brief Print version info
void errversion(void);

/// \brief Issue a warning for gbl.lineno.
void errwarn(error_code_t ecode);

/// \brief Floating point error
void fperror(int errcode);

/**
 * \brief Issue internal compiler error.
 * \param txt  null terminated text string identifying
 * \param val  integer value to be written with message
 * \param sev  error severity
 */
void interr(const char *txt, int val, enum error_severity sev);

/** \brief Issue internal compiler error using printf-style formatting.
 *
 * \param sev:   error severity.
 * \param fmt:   printf-style format string
 * \param ...:   args for format string
 */
void interrf(enum error_severity sev, const char *fmt, ...);

#endif /* COMPILER_ERROR_H_ */