[Bug 214105] New: supertux-0.1.3-28: mising return statement
https://bugzilla.novell.com/show_bug.cgi?id=214105 Summary: supertux-0.1.3-28: mising return statement Product: openSUSE 10.2 Version: Alpha 5 plus Platform: All OS/Version: SuSE Linux 10.1 Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: dcb314@hotmail.com QAContact: qa@suse.de I just tried to compile package supertux-0.1.3-28 with the Intel C compiler. The compiler said texture.cpp(107): warning #1011: missing return statement at end of non-void function "SurfaceData::create_SurfaceOpenGL" The source code is #endif assert(0); } I have looked at the code and there is no code for the default case in the switch statement and there is no return statement at the end of the function. Suggest add return 0; to end of the function. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=214105 stbinner@suse.de changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bnc-team- |sndirsch@novell.com |screening@forge.provo.novell| |.com | -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=214105 sndirsch@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO Info Provider| |dcb314@hotmail.com ------- Comment #1 from sndirsch@novell.com 2006-10-25 02:25 MST ------- I don't think so. Isn't the "assert(0);" mentioned for this case? SurfaceSDL* SurfaceData::create_SurfaceSDL() { switch(type) { case LOAD: return new SurfaceSDL(file, use_alpha); case LOAD_PART: return new SurfaceSDL(file, x, y, w, h, use_alpha); case SURFACE: return new SurfaceSDL(surface, use_alpha); } assert(0); } -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=214105 dcb314@hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |ASSIGNED Info Provider|dcb314@hotmail.com | ------- Comment #2 from dcb314@hotmail.com 2006-10-25 04:43 MST -------
Isn't the "assert(0);" mentioned for this case?
Yes it is. However, I wanted to add some belt'n'braces code to shut up the compiler. Warning 1011 is usually an indicator of trouble. In this case it isn't. I just wanted to add extra code to make the warning go away so it didn't keep getting flagged up as a potential problem. Also, it wouldn't hurt the code to do something more sensible than crash when the type is not one of the expected values. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=214105 sndirsch@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |INVALID ------- Comment #3 from sndirsch@novell.com 2006-10-25 04:53 MST -------
Also, it wouldn't hurt the code to do something more sensible than crash when the type is not one of the expected values.
assert already does this job. Adding return afterwards is a cosmetic change. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=214105 dcb314@hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcb314@hotmail.com Status|RESOLVED |REOPENED Resolution|INVALID | ------- Comment #4 from dcb314@hotmail.com 2006-10-25 05:01 MST ------- (In reply to comment #3)
assert already does this job.
I think we all know what assert does. I tried to suggest that there are better ways of dealing with the problem than crashing.
Adding return afterwards is a cosmetic change.
As I tried to indicate above, no it isn't. Putting return statements at the end of non-void functions [ even in code that isn't supposed to be executed in normal operation] is a good thing to do. I strongly recommend re-reading what I wrote. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=214105 sndirsch@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED ------- Comment #5 from sndirsch@novell.com 2006-10-25 05:40 MST ------- Changed to terminate useless discussion. 'Fixed' for buildservice and openSUSE 10.2 Beta2. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
participants (1)
-
bugzilla_noreply@novell.com