shithub: scc

Download patch

ref: 9e72a9ad124dfe246dba4d7c0695d5580aa187f8
parent: 9c95b77e8f083c0d62348f292890e8c261a2580a
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Dec 12 04:31:46 EST 2016

[cc1] Add the name of the field in error messages

--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -619,7 +619,6 @@
 	TINT n = structp->n.elem;
 	int err = 0;
 
-	/* TODO: print name of the field in the errors */
 	if (accept(':')) {
 		Node *np;
 		TINT n;
@@ -644,11 +643,11 @@
 	}
 
 	if (tp->op == FTN) {
-		errorp("invalid type in struct/union");
+		errorp("invalid type '%s' in struct/union", name);
 		err = 1;
 	}
 	if (dcl->sclass) {
-		errorp("storage class in struct/union field");
+		errorp("storage class in struct/union field '%s'", name);
 		err = 1;
 	}
 	if (!(tp->prop & TDEFINED)) {