> compile NEMU
221220000 张三 Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux 20:01:51 up 18:52, 1 user, load average: 0.40, 0.18, 0.12
This commit is contained in:
@ -56,10 +56,12 @@ static void _gen_rand_expr(int deepth) {
|
||||
return;
|
||||
}
|
||||
deepth -= 1;
|
||||
switch (choose(3)) {
|
||||
switch (choose(4)) {
|
||||
case 0: GEN_RAND(); break;
|
||||
case 1: GEN("("); _gen_rand_expr(deepth); GEN(")"); break;
|
||||
default: _gen_rand_expr(deepth); GEN_OP(); _gen_rand_expr(deepth); break;
|
||||
case 2: _gen_rand_expr(deepth); GEN_OP(); _gen_rand_expr(deepth); break;
|
||||
case 3: GEN(" ");
|
||||
default: assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +90,11 @@ int main(int argc, char *argv[]) {
|
||||
fclose(fp);
|
||||
|
||||
int ret = system("gcc /tmp/.code.c -o /tmp/.expr");
|
||||
if (ret != 0) continue;
|
||||
if (ret != 0) {
|
||||
printf("failed to execute gcc\n");
|
||||
i ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
fp = popen("/tmp/.expr", "r");
|
||||
assert(fp != NULL);
|
||||
|
Reference in New Issue
Block a user