/* Given an expression, ensure that it is validly formed and that all named
attribute values are valid for the given attribute. Issue a fatal error
- if not. If no attribute is specified, assume a numeric attribute.
+ if not.
Return a perhaps modified replacement expression for the value. */
switch (GET_CODE (exp))
{
case CONST_INT:
- if (attr && ! attr->is_numeric)
+ if (!attr->is_numeric)
{
error_with_line (attr->lineno,
"CONST_INT not valid for non-numeric attribute %s",
if (! strcmp (XSTR (exp, 0), "*"))
break;
- if (attr == 0 || attr->is_numeric)
+ if (attr->is_numeric)
{
p = XSTR (exp, 0);
for (; *p; p++)
if (! ISDIGIT (*p))
{
- error_with_line (attr ? attr->lineno : 0,
+ error_with_line (attr->lineno,
"non-numeric value for numeric attribute %s",
- attr ? attr->name : "internal");
+ attr->name);
break;
}
break;
if (av == NULL)
error_with_line (attr->lineno,
"unknown value `%s' for `%s' attribute",
- XSTR (exp, 0), attr ? attr->name : "internal");
+ XSTR (exp, 0), attr->name);
break;
case IF_THEN_ELSE:
- XEXP (exp, 0) = check_attr_test (XEXP (exp, 0),
- attr ? attr->is_const : 0,
- attr ? attr->lineno : 0);
+ XEXP (exp, 0) = check_attr_test (XEXP (exp, 0), attr->is_const,
+ attr->lineno);
XEXP (exp, 1) = check_attr_value (XEXP (exp, 1), attr);
XEXP (exp, 2) = check_attr_value (XEXP (exp, 2), attr);
break;
case MULT:
case DIV:
case MOD:
- if (attr && !attr->is_numeric)
+ if (!attr->is_numeric)
{
error_with_line (attr->lineno,
"invalid operation `%s' for non-numeric"
for (i = 0; i < XVECLEN (exp, 0); i += 2)
{
XVECEXP (exp, 0, i) = check_attr_test (XVECEXP (exp, 0, i),
- attr ? attr->is_const : 0,
- attr ? attr->lineno : 0);
+ attr->is_const,
+ attr->lineno);
XVECEXP (exp, 0, i + 1)
= check_attr_value (XVECEXP (exp, 0, i + 1), attr);
}
{
struct attr_desc *attr2 = find_attr (&XSTR (exp, 0), 0);
if (attr2 == NULL)
- error_with_line (attr ? attr->lineno : 0,
- "unknown attribute `%s' in ATTR",
+ error_with_line (attr->lineno, "unknown attribute `%s' in ATTR",
XSTR (exp, 0));
- else if (attr && attr->is_const && ! attr2->is_const)
+ else if (attr->is_const && ! attr2->is_const)
error_with_line (attr->lineno,
"non-constant attribute `%s' referenced from `%s'",
XSTR (exp, 0), attr->name);
- else if (attr
- && attr->is_numeric != attr2->is_numeric)
+ else if (attr->is_numeric != attr2->is_numeric)
error_with_line (attr->lineno,
"numeric attribute mismatch calling `%s' from `%s'",
XSTR (exp, 0), attr->name);
return attr_rtx (SYMBOL_REF, XSTR (exp, 0));
default:
- error_with_line (attr ? attr->lineno : 0,
+ error_with_line (attr->lineno,
"invalid operation `%s' for attribute value",
GET_RTX_NAME (GET_CODE (exp)));
break;
case CONST_STRING:
if (! strcmp (XSTR (exp, 0), "*"))
{
- if (attr == 0 || attr->default_val == 0)
+ if (attr->default_val == 0)
fatal ("(attr_value \"*\") used in invalid context");
exp = attr->default_val->value;
}