1 typedef unsigned int u32; 2 seq(int a)3int seq(int a) { return a == a; } sne(int a)4int sne(int a) { return a != a; } slt(int a)5int slt(int a) { return a < a; } sgt(int a)6int sgt(int a) { return a > a; } sle(int a)7int sle(int a) { return a <= a; } sge(int a)8int sge(int a) { return a >= a; } 9 ueq(u32 a)10u32 ueq(u32 a) { return a == a; } une(u32 a)11u32 une(u32 a) { return a != a; } ult(u32 a)12u32 ult(u32 a) { return a < a; } ugt(u32 a)13u32 ugt(u32 a) { return a > a; } ule(u32 a)14u32 ule(u32 a) { return a <= a; } uge(u32 a)15u32 uge(u32 a) { return a >= a; } 16 17 /* 18 * check-name: tautological-compare 19 * check-command: sparse -Wno-decl -Wtautological-compare $file 20 * 21 * check-error-start 22 tautological-compare.c:3:30: warning: self-comparison always evaluates to true 23 tautological-compare.c:4:30: warning: self-comparison always evaluates to false 24 tautological-compare.c:5:29: warning: self-comparison always evaluates to false 25 tautological-compare.c:6:29: warning: self-comparison always evaluates to false 26 tautological-compare.c:7:30: warning: self-comparison always evaluates to true 27 tautological-compare.c:8:30: warning: self-comparison always evaluates to true 28 tautological-compare.c:10:30: warning: self-comparison always evaluates to true 29 tautological-compare.c:11:30: warning: self-comparison always evaluates to false 30 tautological-compare.c:12:29: warning: self-comparison always evaluates to false 31 tautological-compare.c:13:29: warning: self-comparison always evaluates to false 32 tautological-compare.c:14:30: warning: self-comparison always evaluates to true 33 tautological-compare.c:15:30: warning: self-comparison always evaluates to true 34 * check-error-end 35 */ 36