Skip to content

CtrlPPcheck does not report missing return statement(s) #109

@hfrmobile

Description

@hfrmobile

Describe the bug

  public bool returnsBoolButForgottenReturnStatments()
  {
    string dirname = getPath(DATA_REL_PATH, "", "", 1);
    mkdir(dirname + "sample");
    string filename = dirname + m_name;
    string jsString = jsonEncode(m_list, false);
    file fPtr = fopen(filename, "w");

    if (fPtr != 0)
    {
      errClass err = makeError("sample", PRIO_INFO, ERR_PARAM, 2);
      securityEvent(err, true);

      fputs(jsString, fPtr);
      fclose(fPtr);

      ReloadJson();
    }
    else
    {
      throwError(makeError("", PRIO_SEVERE, ERR_PARAM, 61, filename));
    }
  }

To Reproduce
See code example above.

Expected behavior
There should be a warning that the function has no return statement since the function claims that it returns a bool but never returns a value.

Software version and environment (please complete the following information):

  • OS: Windows 10
  • WinCC OA 3.19

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions