Bug 149460 - missing return statement
missing return statement
Product: Fedora
Classification: Fedora
Component: cgoban (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Chris Ricker
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2005-02-23 06:37 EST by David Binderman
Modified: 2008-02-06 18:51 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-02-06 18:51:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description David Binderman 2005-02-23 06:37:21 EST
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:
Actual results:

Expected results:

Additional info:
Comment 1 Michael Schwendt 2005-07-24 18:29:23 EDT
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 18:21:04 EST
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.


Your friendly BZ janitor :-)
Comment 3 petrosyan 2008-02-06 18:51:58 EST
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.