return 0;
}
+STATIC int
+ex_error(nd, mess)
+ t_node *nd;
+ char *mess;
+{
+ node_error(nd, "\"%s\": %s", symbol2str(nd->nd_symb), mess);
+ return 0;
+}
+
MkCoercion(pnd, tp)
t_node **pnd;
register t_type *tp;
tp = expp->nd_right->nd_type;
if (tp->tp_fund != T_POINTER) {
- node_error(expp, "\"^\": illegal operand");
- return 0;
+ return ex_error(expp, "illegal operand type");
}
expp->nd_type = RemoveEqual(PointedtoType(tp));
*/
if (expp->nd_symb == IN) {
if (tpr->tp_fund != T_SET) {
- node_error(expp, "\"IN\": right operand must be a set");
- return 0;
+ return ex_error(expp, "right operand must be a set");
}
if (!TstAssCompat(ElementType(tpr), tpl)) {
/* Assignment compatible ???
if (!(tpr->tp_fund & allowed) || !(tpl->tp_fund & allowed)) {
if (!((T_CARDINAL & allowed) &&
ChkAddress(tpl, tpr))) {
- node_error(expp, "\"%s\": illegal operand type(s)",
- symbol2str(expp->nd_symb));
- return 0;
+ return ex_error(expp, "illegal operand type(s)");
}
if (expp->nd_type->tp_fund & T_CARDINAL) {
expp->nd_type = address_type;
}
if (Boolean(expp->nd_symb) && tpl != bool_type) {
- node_error(expp, "\"%s\": illegal operand type(s)",
- symbol2str(expp->nd_symb));
- return 0;
+ return ex_error(expp, "illegal operand type(s)");
}
/* Operands must be compatible (distilled from Def 8.2)
*/
if (!TstCompat(tpr, tpl)) {
- node_error(expp,"\"%s\": incompatible types",
- symbol2str(expp->nd_symb));
- return 0;
+ return ex_error(expp, "incompatible operand types");
}
MkCoercion(&(expp->nd_left), tpl);
default:
crash("ChkUnOper");
}
- node_error(expp, "\"%s\": illegal operand", symbol2str(expp->nd_symb));
- return 0;
+ return ex_error(expp, "illegal operand type");
}
STATIC t_node *
#include "scope.h"
#include "node.h"
#include "Lpars.h"
+#include "warning.h"
STATIC
DefInFront(df)
return MkDef(id, scope, kind);
}
-RemoveImports(pdf)
+end_definition_list(pdf)
register t_def **pdf;
{
/* Remove all imports from a definition module. This is
neccesary because the implementation module might import
them again.
+ Also, mark all other definitions "QUALIFIED EXPORT".
*/
register t_def *df = *pdf;
while (df) {
if (df->df_kind & D_IMPORTED) {
+ if (! (df->df_flags & D_USED)) {
+ warning(W_ORDINARY, "identifier \"%s\" imported but not used", df->df_idf->id_text);
+ }
RemoveFromIdList(df);
*pdf = df->df_nextinscope;
free_def(df);
}
else {
+ df->df_flags |= D_QEXPORTED;
pdf = &(df->df_nextinscope);
}
df = *pdf;
/* empty */
]
definition* END IDENT
- { register t_def *df1 = CurrentScope->sc_def;
- while (df1) {
- /* Make all definitions "QUALIFIED EXPORT" */
- df1->df_flags |= D_QEXPORTED;
- df1 = df1->df_nextinscope;
- }
+ { end_definition_list(&(CurrentScope->sc_def));
DefinitionModule--;
match_id(df->df_idf, dot.TOK_IDF);
df->df_flags &= ~D_BUSY;
IDENT { if (state == IMPLEMENTATION) {
df = GetDefinitionModule(dot.TOK_IDF, 0);
CurrVis = df->mod_vis;
- RemoveImports(&(CurrentScope->sc_def));
}
else {
Defined = df = define(dot.TOK_IDF, GlobalScope, D_MODULE);