xpcom/tests/static-checker/flow_through_pass.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/tests/static-checker/flow_through_pass.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +static void MUST_FLOW_THROUGH(const char *label) {
     1.5 +}
     1.6 +
     1.7 +int test(int x, int y) {
     1.8 +  if (x == 3)
     1.9 +    return 0;
    1.10 +
    1.11 +  if(x)
    1.12 +    MUST_FLOW_THROUGH("out");
    1.13 +  
    1.14 +  if (x) {
    1.15 +    x = y;
    1.16 +    goto out;
    1.17 +  }
    1.18 +
    1.19 +  return y;
    1.20 + out:
    1.21 +  x--;
    1.22 +  return x;
    1.23 +}

mercurial