To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=48392 Issue #:|48392 Summary:|warning: control reaches end of non-void function Component:|api Version:|680m92 Platform:|PC URL:| OS/Version:|Linux Status:|NEW Status whiteboard:| Keywords:| Resolution:| Issue type:|PATCH Priority:|P3 Subcomponent:|code Assigned to:|sw Reported by:|pmladek
------- Additional comments from [EMAIL PROTECTED] Thu Apr 28 11:03:36 -0700 2005 ------- The warning: control reaches end of non-void function, could point out a real bug. So, we want to fix all packages to be built without this warnig. I have found the following warnings when compiling the module bean with gcc-4.0-pre: Making: ../../unxlngi6.pro/slo/com_sun_star_comp_beans_LocalOfficeWindow.obj com_sun_star_comp_beans_LocalOfficeWindow.c: In function 'Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindow': com_sun_star_comp_beans_LocalOfficeWindow.c:126: warning: 'return' with no value, in function returning non-void com_sun_star_comp_beans_LocalOfficeWindow.c:134: warning: 'return' with no value, in function returning non-void com_sun_star_comp_beans_LocalOfficeWindow.c:153: warning: control reaches end of non-void function There is the return at the end of the function Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindow. The problem are the lines 126, 134. There is an assert which is redefined the following way at the beginning of the source file: #define assert(X) if (!X) { (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/RuntimeException"), "assertion failed"); return;} assert usually ends with abort but this version of assert ends with plain return and is used in a function that requires a value to be returned. Well, I am not sure what the following command does: (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/RuntimeException"), "assertion failed"); Maybe, the command: return; is never accessed because the application is aborted by the RuntimeException. Would it be possible to return a fake value (for example, 0L) to make the compiler happy then? If the RuntimeException does not abort the application, is the plain return really wanted? Should not be exit() or abort() used insted of return? Last thing. I think that it would be more save to add one more parentheses to the assert definition: (!(X)) should be used instead of (!X) to make sure that the result of the entire expression is negated. I'll attach a patch that improves the the test in the assert definition and retunrns the value 0L instead of void. --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]