Lines 4586-4609
Link Here
|
4586 |
} |
4586 |
} |
4587 |
|
4587 |
|
4588 |
/* Warn for unused variables, but not if they're inside a common |
4588 |
/* Warn for unused variables, but not if they're inside a common |
4589 |
block, a namelist, or are use-associated. */ |
4589 |
block or a namelist. */ |
4590 |
else if (warn_unused_variable |
4590 |
else if (warn_unused_variable |
4591 |
&& !(sym->attr.in_common || sym->attr.use_assoc || sym->mark |
4591 |
&& !(sym->attr.in_common || sym->mark || sym->attr.in_namelist)) |
4592 |
|| sym->attr.in_namelist)) |
|
|
4593 |
{ |
4592 |
{ |
4594 |
gfc_warning ("Unused variable '%s' declared at %L", sym->name, |
4593 |
if (sym->attr.use_only) |
4595 |
&sym->declared_at); |
4594 |
{ |
4596 |
if (sym->backend_decl != NULL_TREE) |
4595 |
gfc_warning ("Unused module variable '%s' which has been " |
4597 |
TREE_NO_WARNING(sym->backend_decl) = 1; |
4596 |
"explicitly imported at %L", sym->name, |
|
|
4597 |
&sym->declared_at); |
4598 |
if (sym->backend_decl != NULL_TREE) |
4599 |
TREE_NO_WARNING(sym->backend_decl) = 1; |
4600 |
} |
4601 |
else if (!sym->attr.use_assoc) |
4602 |
{ |
4603 |
gfc_warning ("Unused variable '%s' declared at %L", |
4604 |
sym->name, &sym->declared_at); |
4605 |
if (sym->backend_decl != NULL_TREE) |
4606 |
TREE_NO_WARNING(sym->backend_decl) = 1; |
4607 |
} |
4598 |
} |
4608 |
} |
4599 |
else if (warn_unused_variable && sym->attr.use_only) |
4609 |
|
4600 |
{ |
|
|
4601 |
gfc_warning ("Unused module variable '%s' which has been explicitly " |
4602 |
"imported at %L", sym->name, &sym->declared_at); |
4603 |
if (sym->backend_decl != NULL_TREE) |
4604 |
TREE_NO_WARNING(sym->backend_decl) = 1; |
4605 |
} |
4606 |
|
4607 |
/* For variable length CHARACTER parameters, the PARM_DECL already |
4610 |
/* For variable length CHARACTER parameters, the PARM_DECL already |
4608 |
references the length variable, so force gfc_get_symbol_decl |
4611 |
references the length variable, so force gfc_get_symbol_decl |
4609 |
even when not referenced. If optimize > 0, it will be optimized |
4612 |
even when not referenced. If optimize > 0, it will be optimized |