]> andersk Git - splint.git/blobdiff - test/condifomit.c
Added support for omitted if clauses in conditionals, patch provided by peteran.
[splint.git] / test / condifomit.c
diff --git a/test/condifomit.c b/test/condifomit.c
new file mode 100644 (file)
index 0000000..c2fb142
--- /dev/null
@@ -0,0 +1,28 @@
+/* Contributed by Peteran, 12 Jan 2004 */
+/* GCC extension: Conditionals with Omitted Operands
+   "x ? : y" is same as x ? x : y
+   http://gcc.gnu.org/onlinedocs/gcc-3.3.2/gcc/Conditionals.html#Conditionals
+*/
+
+/*@+boolint -exportlocal@*/
+void cond1(void *testme)
+{
+       int i,j;
+       i = (testme!=0)? : 0;
+       j = (testme!=0)? (testme!=0): 0;
+}
+
+int cond2(void *testme)
+{
+       return (testme!=0)? : 0;
+}
+
+int cond3(int testme)
+{
+       return testme? testme: 0;
+}
+
+void test_use_before_definition() {
+       int i;
+       printf("%d\n", i?:0);
+}
This page took 0.034753 seconds and 4 git commands to generate.