git: 9front

Download patch

ref: d2fcbd80e5d9653e67e2a45ff556bf420f8edc24
parent: 9ad775c1e0f25faa06a758fc4efd1a4890b84d44
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Jan 4 13:35:04 EST 2016

mpc: use new strtomp() c-style prefixes to parse integer constants

--- a/sys/src/cmd/mpc.y
+++ b/sys/src/cmd/mpc.y
@@ -579,7 +579,9 @@
 		return nil;
 
 	if(f->c == NUM){
-		m = strtomp(f->s->n, nil, 10, nil);
+		m = strtomp(f->s->n, nil, 0, nil);
+		if(m == nil)
+			diag(f, "bad constant");
 		if(mpcmp(m, mpzero) == 0){
 			f->c = NAME;
 			f->s = sym("mpzero");
@@ -643,7 +645,9 @@
 
 	switch(f->c){
 	case NUM:
-		m = strtomp(f->s->n, nil, 10, nil);
+		m = strtomp(f->s->n, nil, 0, nil);
+		if(m == nil)
+			diag(f, "bad constant");
 		if(mpsignif(m) <= 32)
 			cprint("uitomp(%udUL, %N);\n", mptoui(m), t);
 		else if(mpsignif(m) <= 64)
--