blob: f2825d606faf4c211a7208b61c8a5942766aa3d5 (
plain)
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
29
30
31
32
33
34
|
extern int do_stuff (void);
/* Various misleading "while" loops that look like do-whiles due
to proximity to another clause, but are actually empty. */
void not_a_do_while_1 (int flag)
{
if (flag) {
do_stuff ();
flag = 0;
} while (flag); // TODO: should we complain here?
}
void not_a_do_while_2 (int flag)
{
if (!flag) {
do_stuff ();
flag = 1;
} while (flag); // TODO: should we complain here?
}
void not_a_do_while_3 (int flag)
{
while (!flag) {
flag = do_stuff ();
} while (flag); // TODO: should we complain here?
}
void not_a_do_while_4 (int flag)
{
while (flag) {
flag = do_stuff ();
} while (flag); // TODO: should we complain here?
}
|