the function will not automatically be given an entry in the interrupt
vector table (similar to #pragma NOIV, but less syntacticly kludgy). The
interrupt number is also now range checked.
* src/SDCC.y
* src/SDCCmem.c
* src/SDCCglue.c
* src/SDCCsymt.h
* support/Util/SDCCerr.c
* support/Util/SDCCerr.h
* doc/sdccman.lyx
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2823
4a8a32a2-be11-0410-ad9d-
d568d2c75423
}
\layout Standard
-The number following the
+The optional number following the
\emph on
interrupt
\begin_inset LatexCommand \index{interrupt}
\emph default
keyword is the interrupt number this routine will service.
- The compiler will insert a call to this routine in the interrupt vector
- table for the interrupt number specified.
+ When present, the compiler will insert a call to this routine in the
+ interrupt vector table for the interrupt number specified.
The
\emph on
using
\SpecialChar ~
\SpecialChar ~
mov\SpecialChar ~
+\SpecialChar ~
a,(_gint + 1)
\newline
-000C 33\SpecialChar ~
+000C 23\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
- rlc\SpecialChar ~
- a
-\newline
-000D E4\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
+ rl\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-\SpecialChar ~
- 64\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
- clr\SpecialChar ~
a
\newline
-000E 13\SpecialChar ~
+000D 54 01\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
- 65\SpecialChar ~
+ 64\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
- rrc\SpecialChar ~
- a
+ andl\SpecialChar ~
+ a,#0x01
\newline
000F F5*02\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
- 66\SpecialChar ~
+ 65\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
mov\SpecialChar ~
+\SpecialChar ~
_foo_hob_1_1,a
\layout Standard
;
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
#include <unistd.h>
#endif
-symbol *interrupts[256];
+symbol *interrupts[INTNO_MAX+1];
void printIval (symbol *, sym_link *, initList *, FILE *);
set *publics = NULL; /* public variables */
SPEC_OCLS (sym->etype) = code;
/* if this is an interrupt service routine
then put it in the interrupt service array */
- if (FUNC_ISISR (sym->type) && !options.noiv)
+ if (FUNC_ISISR (sym->type) && !options.noiv
+ && (FUNC_INTNO (sym->type) != INTNO_UNSPEC))
{
-
if (interrupts[FUNC_INTNO (sym->type)])
werror (E_INT_DEFINED,
FUNC_INTNO (sym->type),
#include "SDCChasht.h"
#include "SDCCglobl.h"
+#define INTNO_MAX 255 /* maximum allowed interrupt number */
+#define INTNO_UNSPEC (INTNO_MAX+1) /* interrupt number unspecified */
+
enum {
TYPEOF_INT=1,
TYPEOF_SHORT,
"integer overflow in expression" },
{ W_USELESS_DECL, ERROR_LEVEL_WARNING,
"useless declaration (possible use of keyword as variable name)" },
+{ E_INT_BAD_INTNO, ERROR_LEVEL_ERROR,
+ "interrupt number '%u' is not valid" },
};
/*
#define E_STACK_VIOLATION 164 /* internal stack violation */
#define W_INT_OVL 165 /* integer overflow in expression */
#define W_USELESS_DECL 166 /* useless declaration */
+#define E_INT_BAD_INTNO 167 /* invalid interrupt number */
/** Describes the maximum error level that will be logged. Any level
* includes all of the levels listed after it.