115ea8039SSean Kellydnl A regression test for m4 C operators (ksb,petef) 215ea8039SSean Kellydnl If you think you have a short-circuiting m4, run us m4 -DSHORCIRCUIT=yes 315ea8039SSean Kellydnl 415ea8039SSean Kellydnl first level of precedence 515ea8039SSean Kellyifelse(expr(-7),-7,,`failed - 615ea8039SSean Kelly')dnl 715ea8039SSean Kellyifelse(expr(- -2),2,,`failed - 815ea8039SSean Kelly')dnl 915ea8039SSean Kellyifelse(expr(!0),1,,`failed ! 1015ea8039SSean Kelly')dnl 1115ea8039SSean Kellyifelse(expr(!7),0,,`failed ! 1215ea8039SSean Kelly')dnl 1315ea8039SSean Kellyifelse(expr(~-1),0,,`failed ~ 1415ea8039SSean Kelly')dnl 1515ea8039SSean Kellydnl next level of precedence 1615ea8039SSean Kellyifelse(expr(3*5),15,,`failed * 1715ea8039SSean Kelly')dnl 1815ea8039SSean Kellyifelse(expr(3*0),0,,`failed * 1915ea8039SSean Kelly')dnl 2015ea8039SSean Kellyifelse(expr(11/2),5,,`failed / 2115ea8039SSean Kelly')dnl 2215ea8039SSean Kellyifelse(expr(1/700),0,,`failed / 2315ea8039SSean Kelly')dnl 2415ea8039SSean Kellyifelse(expr(10%5),0,,`failed % 2515ea8039SSean Kelly')dnl 2615ea8039SSean Kellyifelse(expr(2%5),2,,`failed % 2715ea8039SSean Kelly')dnl 2815ea8039SSean Kellyifelse(expr(2%-1),0,,`failed % 2915ea8039SSean Kelly')dnl 3015ea8039SSean Kellydnl next level of precedence 3115ea8039SSean Kellyifelse(expr(2+2),4,,`failed + 3215ea8039SSean Kelly')dnl 3315ea8039SSean Kellyifelse(expr(2+-2),0,,`failed + 3415ea8039SSean Kelly')dnl 3515ea8039SSean Kellyifelse(expr(2- -2),4,,`failed - 3615ea8039SSean Kelly')dnl 3715ea8039SSean Kellyifelse(expr(2-2),0,,`failed - 3815ea8039SSean Kelly')dnl 3915ea8039SSean Kellydnl next level of precedence 4015ea8039SSean Kellyifelse(expr(1<<4),16,,`failed << 4115ea8039SSean Kelly')dnl 4215ea8039SSean Kellyifelse(expr(16>>4),1,,`failed >> 4315ea8039SSean Kelly')dnl 4415ea8039SSean Kellydnl next level of precedence 4515ea8039SSean Kellyifelse(expr(4<4),0,,`failed < 4615ea8039SSean Kelly')dnl 4715ea8039SSean Kellyifelse(expr(4<5),1,,`failed < 4815ea8039SSean Kelly')dnl 4915ea8039SSean Kellyifelse(expr(4<3),0,,`failed < 5015ea8039SSean Kelly')dnl 5115ea8039SSean Kellyifelse(expr(4>4),0,,`failed > 5215ea8039SSean Kelly')dnl 5315ea8039SSean Kellyifelse(expr(4>5),0,,`failed > 5415ea8039SSean Kelly')dnl 5515ea8039SSean Kellyifelse(expr(4>3),1,,`failed > 5615ea8039SSean Kelly')dnl 5715ea8039SSean Kellyifelse(expr(4<=4),1,,`failed <= 5815ea8039SSean Kelly')dnl 5915ea8039SSean Kellyifelse(expr(4<=5),1,,`failed <= 6015ea8039SSean Kelly')dnl 6115ea8039SSean Kellyifelse(expr(4<=3),0,,`failed <= 6215ea8039SSean Kelly')dnl 6315ea8039SSean Kellyifelse(expr(4>=4),1,,`failed >= 6415ea8039SSean Kelly')dnl 6515ea8039SSean Kellyifelse(expr(4>=5),0,,`failed >= 6615ea8039SSean Kelly')dnl 6715ea8039SSean Kellyifelse(expr(4>=3),1,,`failed >= 6815ea8039SSean Kelly')dnl 6915ea8039SSean Kellydnl next level of precedence 7015ea8039SSean Kellyifelse(expr(1==1),1,,`failed == 7115ea8039SSean Kelly')dnl 7215ea8039SSean Kellyifelse(expr(1==-1),0,,`failed == 7315ea8039SSean Kelly')dnl 7415ea8039SSean Kellyifelse(expr(1!=1),0,,`failed != 7515ea8039SSean Kelly')dnl 7615ea8039SSean Kellyifelse(expr(1!=2),1,,`failed != 7715ea8039SSean Kelly')dnl 7815ea8039SSean Kellydnl next level of precedence 7915ea8039SSean Kellyifelse(expr(3&5),1,,`failed & 8015ea8039SSean Kelly')dnl 8115ea8039SSean Kellyifelse(expr(8&7),0,,`failed & 8215ea8039SSean Kelly')dnl 8315ea8039SSean Kellydnl next level of precedence 8415ea8039SSean Kellyifelse(expr(1^1),0,,`failed ^ 8515ea8039SSean Kelly')dnl 8615ea8039SSean Kellyifelse(expr(21^5),16,,`failed ^ 8715ea8039SSean Kelly')dnl 8815ea8039SSean Kellydnl next level of precedence 8915ea8039SSean Kellyifelse(expr(1|1),1,,`failed | 9015ea8039SSean Kelly')dnl 9115ea8039SSean Kellyifelse(expr(21|5),21,,`failed | 9215ea8039SSean Kelly')dnl 9315ea8039SSean Kellyifelse(expr(100|1),101,,`failed | 9415ea8039SSean Kelly')dnl 9515ea8039SSean Kellydnl next level of precedence 9615ea8039SSean Kellyifelse(expr(1&&1),1,,`failed && 9715ea8039SSean Kelly')dnl 9815ea8039SSean Kellyifelse(expr(0&&1),0,,`failed && 9915ea8039SSean Kelly')dnl 10015ea8039SSean Kellyifelse(expr(1&&0),0,,`failed && 10115ea8039SSean Kelly')dnl 10215ea8039SSean Kellyifelse(SHORTCIRCUIT,`yes',`ifelse(expr(0&&10/0),0,,`failed && shortcircuit 10315ea8039SSean Kelly')')dnl 10415ea8039SSean Kellydnl next level of precedence 10515ea8039SSean Kellyifelse(expr(1||1),1,,`failed || 10615ea8039SSean Kelly')dnl 10715ea8039SSean Kellyifelse(expr(1||0),1,,`failed || 10815ea8039SSean Kelly')dnl 10915ea8039SSean Kellyifelse(expr(0||0),0,,`failed || 11015ea8039SSean Kelly')dnl 11115ea8039SSean Kellyifelse(SHORTCIRCUIT,`yes',`ifelse(expr(1||10/0),1,,`failed || shortcircuit 11215ea8039SSean Kelly')')dnl 11315ea8039SSean Kellydnl next level of precedence 11415ea8039SSean Kellyifelse(expr(0 ? 2 : 5),5,,`failed ?: 11515ea8039SSean Kelly')dnl 11615ea8039SSean Kellyifelse(expr(1 ? 2 : 5),2,,`failed ?: 11715ea8039SSean Kelly')dnl 11815ea8039SSean Kellyifelse(SHORTCIRCUIT,`yes',`ifelse(expr(0 ? 10/0 : 7),7,,`failed ?: shortcircuit 11915ea8039SSean Kelly')')dnl 12015ea8039SSean Kellyifelse(SHORTCIRCUIT,`yes',`ifelse(expr(1 ? 7 : 10/0),7,,`failed ?: shortcircuit 12115ea8039SSean Kelly')')dnl 12215ea8039SSean Kellydnl operator precedence 12315ea8039SSean Kellyifelse(expr(!0*-2),-2,,`precedence wrong, ! * 12415ea8039SSean Kelly')dnl 12515ea8039SSean Kellyifelse(expr(~8/~2),3,,`precedence wrong ~ / 12615ea8039SSean Kelly')dnl 12715ea8039SSean Kellyifelse(expr(~-20%7),5,,`precedence wrong ~ % 12815ea8039SSean Kelly')dnl 12915ea8039SSean Kellyifelse(expr(3*2+100),106,,`precedence wrong * + 13015ea8039SSean Kelly')dnl 13115ea8039SSean Kellyifelse(expr(3+2*100),203,,`precedence wrong + * 13215ea8039SSean Kelly')dnl 13315ea8039SSean Kellyifelse(expr(2%5-6/3),0,,`precedence wrong % - 13415ea8039SSean Kelly')dnl 13515ea8039SSean Kellyifelse(expr(2/5-5%3),-2,,`precedence wrong / - 13615ea8039SSean Kelly')dnl 13715ea8039SSean Kellyifelse(expr(2+5%5+1),3,,`precedence wrong % + 13815ea8039SSean Kelly')dnl 13915ea8039SSean Kellyifelse(expr(7+9<<1),32,,`precedence wrong + << 14015ea8039SSean Kelly')dnl 14115ea8039SSean Kellyifelse(expr(35-3>>2),8,,`precedence wrong - >> 14215ea8039SSean Kelly')dnl 14315ea8039SSean Kellyifelse(expr(9<10<<5),1,,`precedence wrong << < 14415ea8039SSean Kelly')dnl 14515ea8039SSean Kellyifelse(expr(9>10<<5),0,,`precedence wrong << > 14615ea8039SSean Kelly')dnl 14715ea8039SSean Kellyifelse(expr(32>>2<32),1,,`precedence wrong >> < 14815ea8039SSean Kelly')dnl 14915ea8039SSean Kellyifelse(expr(9<=10<<5),1,,`precedence wrong << < 15015ea8039SSean Kelly')dnl 15115ea8039SSean Kellyifelse(expr(5<<1<=20>>1),1,,`precedence wrong << <= 15215ea8039SSean Kelly')dnl 15315ea8039SSean Kellyifelse(expr(5<<1>=20>>1),1,,`precedence wrong << >= 15415ea8039SSean Kelly')dnl 15515ea8039SSean Kellyifelse(expr(0<7==5>=5),1,,`precedence wrong < == 15615ea8039SSean Kelly')dnl 15715ea8039SSean Kellyifelse(expr(0<7!=5>=5),0,,`precedence wrong < != 15815ea8039SSean Kelly')dnl 15915ea8039SSean Kellyifelse(expr(0>7==5>=5),0,,`precedence wrong > == 16015ea8039SSean Kelly')dnl 16115ea8039SSean Kellyifelse(expr(0>7!=5>=5),1,,`precedence wrong > != 16215ea8039SSean Kelly')dnl 16315ea8039SSean Kellyifelse(expr(1&7==7),1,,`precedence wrong & == 16415ea8039SSean Kelly')dnl 16515ea8039SSean Kellyifelse(expr(0&7!=6),0,,`precedence wrong & != 16615ea8039SSean Kelly')dnl 16715ea8039SSean Kellyifelse(expr(9&1|5),5,,`precedence wrong & | 16815ea8039SSean Kelly')dnl 16915ea8039SSean Kellyifelse(expr(9&1^5),4,,`precedence wrong & ^ 17015ea8039SSean Kelly')dnl 17115ea8039SSean Kellyifelse(expr(9^1|5),13,,`precedence wrong ^ | 17215ea8039SSean Kelly')dnl 17315ea8039SSean Kellyifelse(expr(5|0&&1),1,,`precedence wrong | && 17415ea8039SSean Kelly')dnl 17515ea8039SSean Kellyifelse(expr(5&&0||0&&5||5),1,,`precedence wrong && || 17615ea8039SSean Kelly')dnl 17715ea8039SSean Kellyifelse(expr(0 || 1 ? 0 : 1),0,,`precedence wrong || ?: 17815ea8039SSean Kelly')dnl 17915ea8039SSean Kellyifelse(expr(5&&(0||0)&&(5||5)),0,,`precedence wrong || parens 18015ea8039SSean Kelly')dnl 181