shithub: scc

Download patch

ref: 929f5e2ff45a91d85948ecd5583c0ff90958c218
parent: eede1482b3b6450105ed2a24d4c71db47c43b9d0
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue May 26 20:28:02 EDT 2015

Give better message errors in preprocessor

--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -515,7 +515,7 @@
 	struct ifstatus *ip;
 
 	if (cppctx == 0)
-		error("#else without #if");
+		error("#else without #ifdef/ifndef");
 	cleanup(s);
 	cppoff += (ifstatus[cppctx-1] ^= 1) ? -1 : 1;
 }
@@ -526,7 +526,7 @@
 	Symbol *sym;
 
 	if (!iden(&s))
-		error("#undef must have an identifier as parameter");
+		error("no macro name given in #undef directive");
 	sym = lookup(NS_CPP);
 	sym->flags &= ~ISDEFINED;
 	cleanup(s);