Bug 149460 - missing return statement
Summary: missing return statement
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Fedora
Classification: Fedora
Component: cgoban
Version: 3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Chris Ricker
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-02-23 11:37 UTC by David Binderman
Modified: 2008-02-06 23:51 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-02-06 23:51:58 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description David Binderman 2005-02-23 11:37:21 UTC
Description of problem:

I just tried to compile package cgoban-1.9.14-3 from 
Redhat Fedora Extras development tree.

The compiler said

sgfIn.c(419): warning #1011: missing return statement at end of
non-void function "arg_getLoc"

The source code is

static const char *arg_getLoc(const char *arg, char *posp) {
  *posp = '\0';
  if (*arg == ']')
    return arg;
  if ((arg[0] == 't') && (arg[1] == 't') && (arg[2] == ']'))
    return arg+2;

  if (!islower(arg[0]) || !islower(arg[1]))
    return NULL;

  if ((arg[2] == ']') || (arg[2] == ':'))  {
    posp[0] = posp[2] = 'a';
    posp[1] = arg[0];
    posp[3] = arg[1];
    posp[4] = '\0';
    return arg+2;
  }
}

What happens if none of the if conditions are true ?

Suggest add trailing else statement.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Michael Schwendt 2005-07-24 22:29:23 UTC
CGoban 1 has not seen a release since January 5, 2003. There's a CGoban 2
project. Instead of patching this with doubtful benefit, an upgrade to CGoban 2
might add more value.

Semantically, inserting "return NULL;" (the function's error return code) at the
end of the function would make sense:

     posp[4] = '\0';
     return arg+2;
   }
   return NULL;     /* <-- this line */
 }

But without knowing the function's exact argument domain, the function may never
reach that line of code at run-time.


Comment 2 Christian Iseli 2007-01-17 23:21:04 UTC
FC3 and FC4 have now been EOL'd.

Please check the ticket against a current Fedora release, and either adjust the
release number, or close it if appropriate.

Thanks.

Your friendly BZ janitor :-)

Comment 3 petrosyan 2008-02-06 23:51:58 UTC
Fedora Core 3 is not maintained anymore.

Setting status to "INSUFFICIENT_DATA". If you can reproduce this bug in the
current Fedora release please reopen this bug and assign it to the corresponding
Fedora version.


Note You need to log in before you can comment on or make changes to this bug.