+2004-01-12 Borut Razem <borut.razem@siol.net>
+
+ * src/SDCC.lex, support/Util/SDCCerr.h, support/Util/SDCCerr.c,
+ doc/sdccman.lyx: upper case pragmas are deprecated
+
2004-01-12 Bernhard Held <bernhard@bernhardheld.de>
* src/SDCCast.c (decorateType): replacing 'ul > 0' by '!ul' results
A warning message will be generated when this happens and the compiler
will indicate the number of extra bytes it allocated.
It is recommended that this option NOT be used, #pragma\SpecialChar ~
-NOGCSE
-\begin_inset LatexCommand \index{\#pragma NOGCSE}
+nogcse
+\begin_inset LatexCommand \index{\#pragma nogcse}
\end_inset
explained for the previous option.
For more details of loop optimizations performed see section Loop Invariants.
It is recommended that this option NOT be used, #pragma\SpecialChar ~
-NOINVARIANT
-\begin_inset LatexCommand \index{\#pragma NOINVARIANT}
+noinvariant
+\begin_inset LatexCommand \index{\#pragma noinvariant}
\end_inset
Will not do loop induction optimizations, see section strength reduction
for more details.
It is recommended that this option is NOT used, #pragma\SpecialChar ~
-NOINDUCTION
-\begin_inset LatexCommand \index{\#pragma NOINDUCTION}
+noinduction
+\begin_inset LatexCommand \index{\#pragma noinduction}
\end_inset
\SpecialChar ~
Switch Statements for more details.
It is recommended that this option is NOT used, #pragma\SpecialChar ~
-NOJTBOUND
-\begin_inset LatexCommand \index{\#pragma NOJTBOUND}
+nojtbound
+\begin_inset LatexCommand \index{\#pragma nojtbound}
\end_inset
-callee-saves option string.
Also see #pragma\SpecialChar ~
-CALLEE-SAVES
-\begin_inset LatexCommand \index{\#pragma CALLEE-SAVES}
+callee_saves
+\begin_inset LatexCommand \index{\#pragma callee\_saves}
\end_inset
g the data items.
Functions that are called from an interrupt service routine should be preceded
by a #pragma\SpecialChar ~
-NOOVERLAY
-\begin_inset LatexCommand \index{\#pragma NOOVERLAY}
+nooverlay
+\begin_inset LatexCommand \index{\#pragma nooverlay}
\end_inset
of a function into the overlay segment if the inline assembler code calls
other c-functions that might use the overlay.
In that case the #pragma\SpecialChar ~
-NOOVERLAY should be used.
+nooverlay should be used.
\layout Standard
Parameters and local variables of functions that contain 16 or 32 bit multiplica
\family typewriter
-#pragma SAVE
+#pragma save
\newline
-#pragma NOOVERLAY
-\begin_inset LatexCommand \index{\#pragma NOOVERLAY}
+#pragma nooverlay
+\begin_inset LatexCommand \index{\#pragma nooverlay}
\end_inset
\newline
}
\newline
-#pragma RESTORE
+#pragma restore
\newline
\newline
set_error
\emph default
would be assigned to the overlayable segment if the #pragma\SpecialChar ~
-NOOVERLAY was
+nooverlay was
not present, this could cause unpredictable runtime behavior when called
from an interrupt service routine.
The #pragma\SpecialChar ~
-NOOVERLAY ensures that the parameters and local variables for
+nooverlay ensures that the parameters and local variables for
the function are NOT overlayed.
\layout Section
avoid it if possible.
Note that when some function is called from an interrupt service routine
it should be preceded by a #pragma\SpecialChar ~
-NOOVERLAY
-\begin_inset LatexCommand \index{\#pragma NOOVERLAY}
+nooverlay
+\begin_inset LatexCommand \index{\#pragma nooverlay}
\end_inset
; MUST explicitly include ret or reti in _naked function
\layout Standard
-The related #pragma directive EXCLUDE
-\begin_inset LatexCommand \index{\#pragma EXCLUDE}
+The related directive #pragma exclude
+\begin_inset LatexCommand \index{\#pragma exclude}
\end_inset
SDCC supports the following #pragma directives:
\layout Itemize
-SAVE
-\begin_inset LatexCommand \index{\#pragma SAVE}
+save
+\begin_inset LatexCommand \index{\#pragma save}
\end_inset
- - this will save all current options to the SAVE/RESTORE stack.
- See RESTORE.
+ - this will save all current options to the save/restore stack.
+ See restore.
\layout Itemize
-RESTORE
-\begin_inset LatexCommand \index{\#pragma RESTORE}
+restore
+\begin_inset LatexCommand \index{\#pragma restore}
\end_inset
- will restore saved options from the last save.
- SAVEs & RESTOREs can be nested.
- SDCC uses a SAVE/RESTORE stack: SAVE pushes current options to the stack,
- RESTORE pulls current options from the stack.
- See SAVE.
+ saves & restores can be nested.
+ SDCC uses a save/restore stack: save pushes current options to the stack,
+ restore pulls current options from the stack.
+ See save.
\layout Itemize
-NOGCSE
-\begin_inset LatexCommand \index{\#pragma NOGCSE}
+nogcse
+\begin_inset LatexCommand \index{\#pragma nogcse}
\end_inset
- will stop global common subexpression elimination.
\layout Itemize
-NOINDUCTION
-\begin_inset LatexCommand \index{\#pragma NOINDUCTION}
+noinduction
+\begin_inset LatexCommand \index{\#pragma noinduction}
\end_inset
- will stop loop induction optimizations.
\layout Itemize
-NOJTBOUND
-\begin_inset LatexCommand \index{\#pragma NOJTBOUND}
+nojtbound
+\begin_inset LatexCommand \index{\#pragma nojtbound}
\end_inset
.
\layout Itemize
-NOOVERLAY
-\begin_inset LatexCommand \index{\#pragma NOOVERLAY}
+nooverlay
+\begin_inset LatexCommand \index{\#pragma nooverlay}
\end_inset
function.
\layout Itemize
-LESS_PEDANTIC
-\begin_inset LatexCommand \index{\#pragma LESS\_PEDANTIC}
+less_pedantic
+\begin_inset LatexCommand \index{\#pragma less\_pedantic}
\end_inset
your own now ;-(
\layout Itemize
-NOLOOPREVERSE
-\begin_inset LatexCommand \index{\#pragma NOLOOPREVERSE}
+noloopreverse
+\begin_inset LatexCommand \index{\#pragma noloopreverse}
\end_inset
- Will not do loop reversal optimization
\layout Itemize
-EXCLUDE
-\begin_inset LatexCommand \index{\#pragma EXCLUDE}
+exclude
+\begin_inset LatexCommand \index{\#pragma exclude}
\end_inset
- NONE | {acc[,b[,dpl[,dph]]] - The exclude pragma disables generation of
+ none | {acc[,b[,dpl[,dph]]] - The exclude pragma disables generation of
pair of push/pop
\begin_inset LatexCommand \index{push/pop}
The directive should be placed immediately before the ISR function definition
and it affects ALL ISR functions following it.
To enable the normal register saving for ISR functions use #pragma\SpecialChar ~
-EXCLUDE\SpecialChar ~
+exclude\SpecialChar ~
none
-\begin_inset LatexCommand \index{\#pragma EXCLUDE}
+\begin_inset LatexCommand \index{\#pragma exclude}
\end_inset
.
\layout Itemize
-NOIV
-\begin_inset LatexCommand \index{\#pragma NOIV}
+noiv
+\begin_inset LatexCommand \index{\#pragma noiv}
\end_inset
about interrupts.
\layout Itemize
-CALLEE-SAVES
-\begin_inset LatexCommand \index{\#pragma CALLEE-SAVES}
+callee_saves
+\begin_inset LatexCommand \index{\#pragma callee\_saves}
\end_inset
-callee-saves command line option is used, the function names specified
in #pragma\SpecialChar ~
-CALLEE-SAVES
-\begin_inset LatexCommand \index{\#pragma CALLEE-SAVES}
+callee_saves
+\begin_inset LatexCommand \index{\#pragma callee\_saves}
\end_inset
is appended to the list of functions specified in the command line.
+\layout Standard
+
+SDCPP supports the following #pragma directives:
\layout Itemize
preproc_asm
\family typewriter
-#pragma SAVE
-\begin_inset LatexCommand \index{\#pragma SAVE}
+#pragma save
+\begin_inset LatexCommand \index{\#pragma save}
\end_inset
\SpecialChar ~
/* save the current settings */
\newline
-#pragma NOGCSE
-\begin_inset LatexCommand \index{\#pragma NOGCSE}
+#pragma nogcse
+\begin_inset LatexCommand \index{\#pragma nogcse}
\end_inset
\SpecialChar ~
/* turnoff global subexpression elimination */
\newline
-#pragma NOINDUCTION
-\begin_inset LatexCommand \index{\#pragma NOINDUCTION}
+#pragma noinduction
+\begin_inset LatexCommand \index{\#pragma noinduction}
\end_inset
\newline
}
\newline
-#pragma RESTORE
-\begin_inset LatexCommand \index{\#pragma RESTORE}
+#pragma restore
+\begin_inset LatexCommand \index{\#pragma restore}
\end_inset
\layout Standard
The compiler will generate a warning message when extra space is allocated.
- It is strongly recommended that the SAVE and RESTORE pragma's be used when
+ It is strongly recommended that the save and restore pragma's be used when
changing options for a function.
\layout Section
\end_inset
-noinduction option) or for a given function only using #pragma\SpecialChar ~
-NOINDUCTION
-\begin_inset LatexCommand \index{\#pragma NOINDUCTION}
+noinduction
+\begin_inset LatexCommand \index{\#pragma noinduction}
\end_inset
You might also consider inserting dummy cases 0 and 5 to 8 in this example.
\newline
-The pragma NOJTBOUND
-\begin_inset LatexCommand \index{\#pragma NOJTBOUND}
+The pragma nojtbound
+\begin_inset LatexCommand \index{\#pragma nojtbound}
\end_inset
#define PRAGMA_STR "#pragma"
#define PRAGMA_LEN ((sizeof PRAGMA_STR) - 1)
- static struct pragma_s {
- const char *name;
- enum pragma_id id;
- } pragma_tbl[] = {
- { "SAVE", P_SAVE },
- { "RESTORE", P_RESTORE },
- { "NOINDUCTION", P_NOINDUCTION },
- { "NOINVARIANT", P_NOINVARIANT },
- { "NOLOOPREVERSE", P_LOOPREV },
- { "INDUCTION", P_INDUCTION },
- { "STACKAUTO", P_STACKAUTO },
- { "NOJTBOUND", P_NOJTBOUND },
- { "NOGCSE", P_NOGCSE },
- { "NOOVERLAY", P_NOOVERLAY },
- { "CALLEE-SAVES", P_CALLEE_SAVES },
- { "EXCLUDE", P_EXCLUDE },
- { "NOIV", P_NOIV },
- { "OVERLAY", P_OVERLAY_ },
- { "LESS_PEDANTIC", P_LESSPEDANTIC },
+ static struct pragma_s
+ {
+ const char *name;
+ enum pragma_id id;
+ char deprecated;
+ } pragma_tbl[] = {
+ { "save", P_SAVE, 0 },
+ { "restore", P_RESTORE, 0 },
+ { "noinduction", P_NOINDUCTION, 0 },
+ { "noinvariant", P_NOINVARIANT, 0 },
+ { "noloopreverse", P_LOOPREV, 0 },
+ { "induction", P_INDUCTION, 0 },
+ { "stackauto", P_STACKAUTO, 0 },
+ { "nojtbound", P_NOJTBOUND, 0 },
+ { "nogcse", P_NOGCSE, 0 },
+ { "nooverlay", P_NOOVERLAY, 0 },
+ { "callee_saves", P_CALLEE_SAVES, 0 },
+ { "exclude", P_EXCLUDE, 0 },
+ { "noiv", P_NOIV, 0 },
+ { "overlay", P_OVERLAY_, 0 },
+ { "less_pedantic", P_LESSPEDANTIC, 0 },
+
+ /*
+ * The following lines are deprecated pragmas,
+ * only for bacward compatibility.
+ * They should be removed in next major release after 1.4.0
+ */
+
+ { "SAVE", P_SAVE, 1 },
+ { "RESTORE", P_RESTORE, 1 },
+ { "NOINDUCTION", P_NOINDUCTION, 1 },
+ { "NOINVARIANT", P_NOINVARIANT, 1 },
+ { "NOLOOPREVERSE", P_LOOPREV, 1 },
+ { "INDUCTION", P_INDUCTION, 1 },
+ { "STACKAUTO", P_STACKAUTO, 1 },
+ { "NOJTBOUND", P_NOJTBOUND, 1 },
+ { "NOGCSE", P_NOGCSE, 1 },
+ { "NOOVERLAY", P_NOOVERLAY, 1 },
+ { "CALLEE-SAVES", P_CALLEE_SAVES, 1 },
+ { "EXCLUDE", P_EXCLUDE, 1 },
+ { "NOIV", P_NOIV, 1 },
+ { "OVERLAY", P_OVERLAY_, 1 },
+ { "LESS_PEDANTIC", P_LESSPEDANTIC, 1 },
};
- char *cp ;
+ char *cp;
int i;
/* find the pragma */
if (port->process_pragma && !port->process_pragma(cp))
return 0;
- for (i = 0; i < NELEM(pragma_tbl); i++) {
- /* now compare and do what needs to be done */
- size_t len = strlen(pragma_tbl[i].name);
+ for (i = 0; i < NELEM(pragma_tbl); i++)
+ {
+ /* now compare and do what needs to be done */
+ size_t len = strlen(pragma_tbl[i].name);
- if (strncmp(cp, pragma_tbl[i].name, len) == 0) {
- doPragma(pragma_tbl[i].id, cp + len);
- return 0;
+ if (strncmp(cp, pragma_tbl[i].name, len) == 0)
+ {
+ if (pragma_tbl[i].deprecated != 0)
+ werror(W_DEPRECATED_PRAGMA, pragma_tbl[i].name);
+
+ doPragma(pragma_tbl[i].id, cp + len);
+ return 0;
+ }
}
- }
- werror(W_UNKNOWN_PRAGMA,cp);
+ werror(W_UNKNOWN_PRAGMA, cp);
return 0;
}
{ E_FUNC_ATTR, ERROR_LEVEL_ERROR,
"function attribute following non-function declaration"},
{ W_SAVE_RESTORE, ERROR_LEVEL_PEDANTIC,
- "unmatched #pragma SAVE and #pragma RESTORE" },
+ "unmatched #pragma save and #pragma restore" },
{ E_INVALID_CRITICAL, ERROR_LEVEL_ERROR,
"not allowed in a critical section" },
{ E_NOT_ALLOWED, ERROR_LEVEL_ERROR,
"'%s' is not a %s tag" },
{ E_ENUM_NON_INTEGER, ERROR_LEVEL_ERROR,
"enumeration constant not an integer" },
+{ W_DEPRECATED_PRAGMA, ERROR_LEVEL_WARNING,
+ "pragma %s is deprecated, please see documentation for details" },
};
/*
#define E_NOT_ALLOWED 172 /* %s not allowed here */
#define E_BAD_TAG 173 /* '%s' is not a %s tag */
#define E_ENUM_NON_INTEGER 174 /* enumeration constant not an integer */
+#define W_DEPRECATED_PRAGMA 175 /* deprecated pragma */
/** Describes the maximum error level that will be logged. Any level
* includes all of the levels listed after it.