Skip to content

gcc warning: control reaches end of non-void function

Summary

The GCC compiler generates a warning: warning: control reaches end of non-void function [-Wreturn-type]

Steps and/or TTCN-3 code to reproduce

module proba{

type enumerated t_e {I,O} 
  
function f1(in t_e a) return integer {
  select(a){
    case (I) {
      return 1
    }
    case else {
      return 2
    }
  }
  
  
}
  
  
}

What is the current bug behavior?

g++  -c -DLINUX -I/home/ethgasz/TTCNv3/include  -Wall   -o proba.o proba.cc
proba.cc: In function ‘INTEGER proba::f1(const proba::t__e&)’:
proba.cc:665:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

What is the expected correct behavior?

No warning

Possible fixes

Do not generate the unnecessary goto and label statements

/cc @aknappqwt