id = findidf(tk.tk_str);
if (!id) {
error("%s: unknown control", tk.tk_str);
- PushBack();
skipline();
free(tk.tk_str);
break;
case K_PRAGMA: /* "pragma" */
/* ignore for now
*/
- PushBack();
skipline();
break;
default:
/* invalid word seen after the '#' */
error("%s: unknown control", id->id_text);
- PushBack();
skipline();
}
break;
id = findidf(tk.tk_str);
free(tk.tk_str);
if (id) switch(id->id_resmac) {
+ default:
+ skipline();
+ break;
case K_IF:
case K_IFDEF:
case K_IFNDEF:
push_if();
+ skipline();
continue;
case K_ELIF:
+ if (ifstack[nestlevel])
+ warning("#elif after #else/#elif");
if (! to_endif && nestlevel == skiplevel) {
nestlevel--;
push_if();
- if (ifexpr()) {
+ if (ifexpr()) { /* implicit skipline() */
NoUnstack--;
return;
}
}
+ else skipline();
break;
case K_ELSE:
+ if (ifstack[nestlevel])
+ warning("#else after #else/#elif");
+ skipline();
if (! to_endif) {
++(ifstack[nestlevel]);
if (nestlevel == skiplevel) {
- PushBack();
- skipline();
NoUnstack--;
return;
}
break;
case K_ENDIF:
assert(nestlevel >= 0);
+ skipline();
if (nestlevel == skiplevel) {
- PushBack();
- skipline();
nestlevel--;
NoUnstack--;
return;
{
if (nestlevel <= svnestlevel[nestcount] || (ifstack[nestlevel])) {
error("#elif without corresponding #if");
- PushBack();
skipline();
}
else { /* restart at this level as if a #if is detected. */
PRIVATE
do_else()
{
- PushBack();
skipline();
if (nestlevel <= svnestlevel[nestcount] || (ifstack[nestlevel]))
error("#else without corresponding #if");
PRIVATE
do_endif()
{
- PushBack();
skipline();
if (nestlevel <= svnestlevel[nestcount])
error("#endif without corresponding #if");