To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=114290
                 Issue #|114290
                 Summary|sal: OSL_THIS_FUNC doesn't work as intended
               Component|porting
                 Version|DEV300m87
                Platform|All
                     URL|
              OS/Version|All
                  Status|NEW
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P2
            Subcomponent|code
             Assigned to|sb
             Reported by|tml





------- Additional comments from t...@openoffice.org Fri Sep  3 12:17:50 +0000 
2010 -------
The definition of OSL_THIS_FUNC in sal/inc/osl/diagnose.h looks like this:

#ifdef __func__
#define OSL_THIS_FUNC __func__
#elifdef __PRETTY_FUNCTION__
#define OSL_THIS_FUNC __PRETTY_FUNCTION__
#elifdef __FUNCTION__
#define OSL_THIS_FUNC __FUNCTION__
#else
#define OSL_THIS_FUNC " "
#endif

At first this looks correct. But if you actually try to use OSL_THIS_FUNC you
notice that it always expands to a blank, even with gcc that certainly has
__PRETTY_FUNCTION__.

If you think harder you realize that none of __func__, __PRETTY_FUNCTION__ and
__FUNCTION__ are known to the preprocessor. How could they be... The
preprocessor does not understand C++ or C syntax. These identifiers are not
preprocessor magic macros. They are actual compiler magic constants. (Compare to
__FILE__ which *is* a preprocessor magic macro.)

Try running this source file through g++ -E or cl -E:

const char *foo(void) {
#ifdef __PRETTY_FUNCTION__
  return "__PRETTY_FUNCTION__ is OK";
#endif
#ifdef __func__
  return "__func__ is OK";
#endif
#ifdef __FUNCTION__
  return "__FUNCTION__ is OK";
#endif
#ifdef __FILE__
  return "__FILE__ is OK";
#endif
  return 0;
}

The OSL_THIS_FUNC definition probably should check for __GNUC__ and use
__PRETTY_FUNCTION__ in that case, then for __MSC_VER and use __FUNCTION__ in
that case, and otherwise a blank? Or is there a C++ standard way to get the
current function/method being compiled?

---------------------------------------------------------------------
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: issues-unsubscr...@porting.openoffice.org
For additional commands, e-mail: issues-h...@porting.openoffice.org


---------------------------------------------------------------------
To unsubscribe, e-mail: allbugs-unsubscr...@openoffice.org
For additional commands, e-mail: allbugs-h...@openoffice.org

Reply via email to