Skip to content

Conversation

@Noremos
Copy link
Contributor

@Noremos Noremos commented Dec 18, 2024

A static analyzer (such as Clang, for example) prints many warnings in GPRE-generated code:

for (int retries = 0; retries < 2; ++retries)
{
  if (!req_handle1 && DB)
		  req_handle1 = DB->compileRequest(fbStatus, sizeof(fb_618), fb_618);
  if (req_handle1)
		  req_handle1->start(fbStatus, fbTrans, 0);
  if (fbStatus->getErrors()[1] == isc_bad_req_handle) { req_handle1->release(); req_handle1 = NULL; }  <- Called C++ object pointer is null
  else break;
}
if (!(fbStatus->getState() & Firebird::IStatus::STATE_ERRORS)) {
  while (1)
  {
  req_handle1->receive (fbStatus, 0, 0, 1034, CAST_MSG(&fb_619)); <- Called C++ object pointer is null
  ....

There are a lot of these warnings, so I suggest 2 changes in the code generation to fix them

for (int retries = 0; retries < 2; ++retries)
{
   if (!req_handle1 && DB)
	  req_handle1 = DB->compileRequest(fbStatus, sizeof(fb_25), fb_25);
  if (req_handle1)
  {
	  req_handle1->start(fbStatus, fbTrans, 0);
	  if (fbStatus->getErrors()[1] == isc_bad_req_handle) { req_handle1->release(); req_handle1 = NULL; }
	  else break;
  }
}
if (req_handle1 && !(fbStatus->getState() & Firebird::IStatus::STATE_ERRORS)) {
  while (1)
  {
  req_handle1->receive (fbStatus, 0, 0, 1034, CAST_MSG(&fb_619)); <- Called C++ object pointer is null
  ....

@asfernandes asfernandes merged commit 2528942 into FirebirdSQL:master Dec 19, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants