Debian Codegraph @

clang/test/Analysis/copypaste/generic.c

raw
1 // RUN: %clang_analyze_cc1 -std=c11 -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s
2
3 // expected-no-diagnostics
4
5 int global;
6
7 int foo1(void) {
8 if (global > 0)
9 return 0;
10 else if (global < 0)
11 return _Generic(global, double: 1, float: 2, default: 3);
12 return 1;
13 }
14
15 // Different associated type (int instead of float)
16 int foo2(void) {
17 if (global > 0)
18 return 0;
19 else if (global < 0)
20 return _Generic(global, double: 1, int: 2, default: 4);
21 return 1;
22 }
23
24 // Different number of associated types.
25 int foo3(void) {
26 if (global > 0)
27 return 0;
28 else if (global < 0)
29 return _Generic(global, double: 1, default: 4);
30 return 1;
31 }