History

better constant handling for expr_cond

Joe Soroka committed 15 years ago

Commit cd3d1a41 parent 38756b52 files · +6 −1Browse files

Unified · Split

2 files
  1. tccgen.c +4 −1
  2. tests/tcctest.c +2 −0
tccgen.c+4−1
@@ -4036,6 +4036,10 @@ static void expr_cond(void) · 4035 unmodified lines
40364036
40374037 if (const_wanted) {
40384038 expr_lor_const();
4039+ } else {
4040+ expr_lor();
4041+ }
4042+ if (const_wanted || ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST)) {
40394043 if (tok == '?') {
40404044 CType boolean;
40414045 int c;
@@ -4057,7 +4061,6 @@ static void expr_cond(void) · 15 unmodified lines
40574061 vpop();
40584062 }
40594063 } else {
4060− expr_lor();
40614064 if (tok == '?') {
40624065 next();
40634066 if (vtop != vstack) {
tests/tcctest.c+2−0
@@ -2081,6 +2081,8 @@ void *bounds_checking_is_enabled() · 2080 unmodified lines
20812081 return (ca != cp + 1) ? cp : NULL;
20822082 }
20832083
2084+typedef int constant_negative_array_size_as_compile_time_assertion_idiom[(1 ? 2 : 0) - 1];
2085+
20842086 void c99_vla_test(int size1, int size2)
20852087 {
20862088 #if defined __i386__ || defined __x86_64__

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t