1 // TODO: remove need for this option
2 /* { dg-additional-options "-fanalyzer-checker=taint" } */
4 #include "analyzer-decls.h"
6 /* Verify the handling of "switch (enum_value)". */
15 /* Verify that we consider that "switch (enum)" could follow implicit
16 "default" even when all enum values have cases if the value is
17 attacker-controlled. */
19 int __attribute__((tainted_args))
20 test_all_values_covered_implicit_default_1 (enum e x)
22 switch (x) /* { dg-message "following 'default:' branch" } */
31 __analyzer_dump_path (); /* { dg-message "path" } */
34 int __attribute__((tainted_args))
35 test_all_values_covered_implicit_default_2 (enum e x)
38 switch (x) /* { dg-message "following 'default:' branch" } */
50 return result; /* { dg-message "uninitialized" } */
53 /* Verify that explicit "default" isn't rejected. */
55 int __attribute__((tainted_args))
56 test_all_values_covered_explicit_default_1 (enum e x)
67 __analyzer_dump_path (); /* { dg-message "path" } */
72 int __attribute__((tainted_args))
73 test_missing_values_explicit_default_1 (enum e x)
83 __analyzer_dump_path (); /* { dg-bogus "path" } */
87 int __attribute__((tainted_args))
88 test_missing_values_explicit_default_2 (enum e x)
97 __analyzer_dump_path (); /* { dg-message "path" } */
100 __analyzer_dump_path (); /* { dg-bogus "path" } */