changeset 1563:b0a691de8cc7

Fixed bug #349 , now emits error.
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Sun, 02 Aug 2009 17:56:30 +0200
parents 95d710d405e3
children 68dea5bae9e9
files gen/asm-x86-32.h gen/asm-x86-64.h
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gen/asm-x86-32.h	Sat Aug 01 18:23:52 2009 +0200
+++ b/gen/asm-x86-32.h	Sun Aug 02 17:56:30 2009 +0200
@@ -1555,7 +1555,13 @@
         }
         void addOperand2 ( const char * fmtpre, const char * fmtpost, AsmArgType type, Expression * e, AsmCode * asmcode, AsmArgMode mode = Mode_Input )
         {
-            assert ( !sc->func->naked );
+            if ( sc->func->naked )
+            {
+                // taken from above
+                stmt->error ( "only global variables can be referenced by identifier in naked asm" );
+                return;
+            }
+
             insnTemplate << fmtpre
                          << "<<" << (mode==Mode_Input ? "in" : "out") << ">>"
                          << fmtpost;
--- a/gen/asm-x86-64.h	Sat Aug 01 18:23:52 2009 +0200
+++ b/gen/asm-x86-64.h	Sun Aug 02 17:56:30 2009 +0200
@@ -1676,7 +1676,13 @@
         }
         void addOperand2 ( const char * fmtpre, const char * fmtpost, AsmArgType type, Expression * e, AsmCode * asmcode, AsmArgMode mode = Mode_Input )
         {
-            assert ( !sc->func->naked );
+            if ( sc->func->naked )
+            {
+                // taken from above
+                stmt->error ( "only global variables can be referenced by identifier in naked asm" );
+                return;
+            }
+
             insnTemplate << fmtpre
                          << "<<" << (mode==Mode_Input ? "in" : "out") << ">>"
                          << fmtpost;