2007-09-28 (Fri) [長年日記]

_ [obsd]PCC _Bool のインクリメント

いちばん簡単な、--x と ++x は、これでいい:

Index: cc/ccom/cgram.y
===================================================================
RCS file: /cvs/src/usr.bin/pcc/cc/ccom/cgram.y,v
retrieving revision 1.2
diff -u -p -r1.2 cgram.y
--- cc/ccom/cgram.y	15 Sep 2007 22:04:38 -0000	1.2
+++ cc/ccom/cgram.y	28 Sep 2007 02:54:50 -0000
@@ -937,8 +937,12 @@ term:		   term C_INCOP {  $$ = buildtree
 		|  '+' term { $$ = $2; }
 		|  C_UNOP term { $$ = buildtree( $1, $2, NIL ); }
 		|  C_INCOP term {
-			$$ = buildtree($1 == INCR ? PLUSEQ : MINUSEQ,
-			    $2, bcon(1));
+			if( BTYPE($2->n_type) == BOOL )
+				$$ = buildtree(ASSIGN, $2,
+					bcon($1 == INCR ? 1 : 0));
+			else
+				$$ = buildtree($1 == INCR ? PLUSEQ : MINUSEQ,
+					$2, bcon(1));
 		}
 		|  C_SIZEOF term { $$ = doszof($2); }
 		|  '(' cast_type ')' term  %prec C_INCOP {

でも、x-- と x++ は難しい。やっぱり、ちゃんと内部構造を見なきゃいかん。

少なくとも、cgram だけでハックするわけにはいかないと思うなあ。

あーあ、trees.c 難しそう。

_ [obsd]SFLC Completes Review of Linux Wireless Code (undeadly)

おお、解決したみたいで何より。

_ [sec]Slashdot : When Not to Use chroot

chroot is not and never has been a security tool

ええーっ、そうなの?

[]