asm volatile () elicits warning sometimes
Mark Mitchell
mmitchell@usa.net
Mon Apr 13 11:44:00 GMT 1998
As the code is written now, egcs c++ warns that volatile is ignored if
the asm has no inputs, outputs or clobbers. If it has any of those
things, no warning is issued. Is there a good reason for such
inconsistent behavior?
Yes. The expand_asm function doesn't take any cv-qualifiers as
input. If, and I don't know one way or the other, it assumes
volatility then your patch makes sense. My thought when writing the
code was that saying "asm volatile" doesn't help you much in this
case; nobody every learns about the `volatile'.
Fri Apr 10 01:22:16 1998 Greg McGary <gkm@gnu.org>
* semantics.c (finish_asm_stmt): Allow volatile without warning.
--- semantics.c 1998/04/10 03:03:46
+++ semantics.c-orig 1998/04/10 08:27:46
@@ -721,28 +721,17 @@ finish_asm_stmt (cv_qualifier, string, o
else
{
emit_line_note (input_filename, lineno);
+ if (cv_qualifier != NULL_TREE
+ && cv_qualifier != ridpointers[(int) RID_VOLATILE])
+ cp_warning ("%s qualifier ignored on asm",
+ IDENTIFIER_POINTER (cv_qualifier));
if (output_operands != NULL_TREE || input_operands != NULL_TREE
|| clobbers != NULL_TREE)
- {
- if (cv_qualifier != NULL_TREE
- && cv_qualifier != ridpointers[(int) RID_VOLATILE])
- cp_warning ("%s qualifier ignored on asm",
- IDENTIFIER_POINTER (cv_qualifier));
-
- c_expand_asm_operands (string, output_operands,
- input_operands,
- clobbers,
- cv_qualifier
- == ridpointers[(int) RID_VOLATILE],
- input_filename, lineno);
- }
+ c_expand_asm_operands (string, output_operands, input_operands, clobbers,
+ cv_qualifier == ridpointers[(int) RID_VOLATILE],
+ input_filename, lineno);
else
- {
- if (cv_qualifier != NULL_TREE)
- cp_warning ("%s qualifier ignored on asm",
- IDENTIFIER_POINTER (cv_qualifier));
- expand_asm (string);
- }
+ expand_asm (string);
finish_stmt ();
}
--
Mark Mitchell <mmitchell@usa.net>
http://home.earthlink.net/~mbmitchell
Consulting Services Available
More information about the Gcc-bugs
mailing list