This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

asm volatile () elicits warning sometimes


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?  If not, here's a patch:

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 ();
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]