shithub: riscv

Download patch

ref: 5eb0d57733fe7db870841fe1b81a2f3c106d4e57
parent: 325c81416b18817a4e45384077aead2d0266536a
author: Anthony Martin <ality@pbrane.org>
date: Sat Oct 1 19:19:08 EDT 2022

cc: take our pickle out of the peephole

The -P flag is used to debug the peephole optimizer. The -Z flag is
used to output pickling code for various types. Don't confuse the two.

The pickling code was added in the third edition. It mistakenly reused
the -P flag which was later partially corrected to use the -Z flag in
2004. That change updated lex.c but missed the code in pickle.c.

--- a/sys/src/cmd/cc/pickle.c
+++ b/sys/src/cmd/cc/pickle.c
@@ -172,9 +172,9 @@
 	int n;
 	char *an;
 
-	if(!debug['P'])
+	if(!debug['Z'])
 		return;
-	if(debug['P'] > 1) {
+	if(debug['Z'] > 1) {
 		n = 0;
 		for(i=iostack; i; i=i->link)
 			n++;
@@ -221,9 +221,9 @@
 	Type *t;
 	Sym *s1, *s2;
 
-	if(!debug['P'] || debug['s'])
+	if(!debug['Z'] || debug['s'])
 		return;
-	if(debug['P'] > 1) {
+	if(debug['Z'] > 1) {
 		n = 0;
 		for(i=iostack; i; i=i->link)
 			n++;