File: condifomit.c

package info (click to toggle)
splint 1%3A3.1.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 21,012 kB
  • ctags: 23,302
  • sloc: ansic: 150,869; yacc: 3,465; sh: 3,034; makefile: 2,160; lex: 412
file content (28 lines) | stat: -rw-r--r-- 514 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);
}