public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* asm volatile () elicits warning sometimes
@ 1998-04-10  3:43 Greg McGary
  0 siblings, 0 replies; only message in thread
From: Greg McGary @ 1998-04-10  3:43 UTC (permalink / raw)
  To: egcs

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-04-10  3:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-10  3:43 asm volatile () elicits warning sometimes Greg McGary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).