ceriel пре 35 година
родитељ
комит
aa0e321971
4 измењених фајлова са 19 додато и 17 уклоњено
  1. 1 1
      lang/cem/cemcom/Version.c
  2. 3 3
      lang/cem/cemcom/ch7mon.c
  3. 13 11
      lang/cem/cemcom/domacro.c
  4. 2 2
      lang/cem/cemcom/options

+ 1 - 1
lang/cem/cemcom/Version.c

@@ -4,5 +4,5 @@
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
 #ifndef	lint
-static char Version[] = "ACK CEM compiler Version 3.1";
+static char Version[] = "ACK CEM compiler Version 3.2";
 #endif	lint

+ 3 - 3
lang/cem/cemcom/ch7mon.c

@@ -53,12 +53,12 @@ ch7mon(oper, expp)
 		break;
 	case '&':
 		if ((*expp)->ex_type->tp_fund == ARRAY) {
-			warning("& before array ignored");
+			expr_warning(*expp, "& before array ignored");
 			array2pointer(*expp);
 		}
 		else
 		if ((*expp)->ex_type->tp_fund == FUNCTION) {
-			warning("& before function ignored");
+			expr_warning(*expp, "& before function ignored");
 			function2pointer(*expp);
 		}
 		else
@@ -146,7 +146,7 @@ ch7mon(oper, expp)
 		break;
 	case SIZEOF:
 		if (ISNAME(*expp) && (*expp)->VL_IDF->id_def->df_formal_array)
-			warning("sizeof formal array %s is sizeof pointer!",
+			expr_warning(*expp, "sizeof formal array %s is sizeof pointer!",
 				(*expp)->VL_IDF->id_text);
 		expr = intexpr((*expp)->ex_class == String ?
 				   (arith)((*expp)->SG_LEN) :

+ 13 - 11
lang/cem/cemcom/domacro.c

@@ -132,7 +132,7 @@ domacro()
 }
 
 PRIVATE
-skip_block()
+skip_block(to_endif)
 {
 	/*	skip_block() skips the input from
 		1)	a false #if, #ifdef, #ifndef or #elif until the
@@ -173,7 +173,7 @@ skip_block()
 			push_if();
 			break;
 		case K_ELIF:
-			if (nestlevel == skiplevel) {
+			if (! to_endif && nestlevel == skiplevel) {
 				nestlevel--;
 				push_if();
 				if (ifexpr()) {
@@ -183,11 +183,13 @@ skip_block()
 			}
 			break;
 		case K_ELSE:
-			++(ifstack[nestlevel]);
-			if (nestlevel == skiplevel) {
-				SkipRestOfLine();
-				NoUnstack--;
-				return;
+			if (! to_endif) {
+				++(ifstack[nestlevel]);
+				if (nestlevel == skiplevel) {
+					SkipRestOfLine();
+					NoUnstack--;
+					return;
+				}
 			}
 			break;
 		case K_ENDIF:
@@ -328,7 +330,7 @@ do_elif()
 	else { /* restart at this level as if a #if is detected.  */
 		nestlevel--;
 		push_if();
-		skip_block();
+		skip_block(1);
 	}
 }
 
@@ -340,7 +342,7 @@ do_else()
 		lexerror("#else without corresponding #if");
 	else {	/* mark this level as else-d		*/
 		++(ifstack[nestlevel]);
-		skip_block();
+		skip_block(1);
 	}
 }
 
@@ -359,7 +361,7 @@ do_if()
 {
 	push_if();
 	if (!ifexpr())	/* a false #if/#elif expression */
-		skip_block();
+		skip_block(0);
 }
 
 PRIVATE
@@ -377,7 +379,7 @@ do_ifdef(how)
 		(how && !id->id_macro) || (!how && id->id_macro)
 	*/
 	if (how ^ (id && id->id_macro != 0))
-		skip_block();
+		skip_block(0);
 	else
 		SkipRestOfLine();
 }

+ 2 - 2
lang/cem/cemcom/options

@@ -5,8 +5,8 @@ E	run preprocessor only
 I	expand include table with directory name following
 M	set identifier length
 n	don't generate register messages
-p	generate linenumbers and filename indications
-	while generating EM code
+L	don't generate linenumbers and filename indications
+p	trace
 P	in running the preprocessor do not output '# line' lines
 R	restricted C
 T	take path following as directory for storing temporary file(s)