shithub: scc

Download patch

ref: 4521cc8f0aade2082ec19d310fbc4facc1158f32
parent: b953ac1cdd26aad71a91905475ce2ff1a0a9cbc8
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Jun 14 16:13:16 EDT 2022

cc1: Fix expression evaluation order

The operator & has higher precedence than the operator && so
it is very unlikely that you want to do a bitweise and with the
result of a shortcut and.

--- a/src/cmd/cc/cc1/decl.c
+++ b/src/cmd/cc/cc1/decl.c
@@ -48,7 +48,7 @@
 static void
 endfundcl(Type *tp, Symbol **pars)
 {
-	if (tp->prop&TK_R && *pars)
+	if ((tp->prop&TK_R) != 0 && *pars)
 		warn("parameter names (without types) in function declaration");
 	/*
 	 * avoid non used warnings in prototypes