Made the constant following the "interrupt" keyword optional. If omitted,
[fw/sdcc] / src / SDCC.y
index 5847cbe78db16c5e367a4fdd63dc059e473b48dd..564837930411bdd6b7d8739ea231284dd3f10c76 100644 (file)
@@ -550,7 +550,17 @@ storage_class_specifier
    ;
 
 Interrupt_storage
-   : INTERRUPT CONSTANT  { $$ = (int) floatFromVal($2) ;  }
+   : INTERRUPT { $$ = INTNO_UNSPEC ; }
+   | INTERRUPT CONSTANT
+        { int intno = (int) floatFromVal($2);
+          if ((intno >= 0) && (intno <= INTNO_MAX))
+            $$ = intno;
+          else
+            {
+              werror(E_INT_BAD_INTNO, intno);
+              $$ = INTNO_UNSPEC;
+            }
+        }
    ;
 
 type_specifier