On 9/4/2016 3:45 PM, Patricia Shanahan wrote:
On 9/1/2016 4:00 PM, Don Lewis wrote:
On  1 Sep, Patricia Shanahan wrote:
I need a problem to work on. Would you like me to take a particular
compiler warning and try to sort it out?

Here is one:

warning: 'osl_detail_ObjectRegistry_getMutex' has C-linkage specified,
but returns user-defined type '::osl::Mutex &' which is incompatible
with C [-Wreturn-type-c-linkage]

In sal/inc/osl/diagnose.hxx,
  ::osl::Mutex & SAL_CALL osl_detail_ObjectRegistry_getMutex()
is declared inside an extern "C" block, so it should have C linkage, but
it is returning a reference, which is a C++ thing.

The obvious fix would seem to be to move it out of the extern "C" block,
but I don't know what to do about the SAL_THROW_EXTERN_C() part of the

I have compiled and done some basic tests with the declaration simply
moved out of the extern "C" block, and it did not appear to cause any
problems. I'll look into SAL_THROW_EXTERN_C next.

SAL_THROW_EXTERN_C and SAL_THROW are concerned with generating, or not generating, a dynamic exception specification in a function declaration. According to Wikipedia, https://en.wikipedia.org/wiki/C%2B%2B11#Features_removed_or_deprecated, dynamic exception specifications have been deprecated since C++11.

SAL_THROW_EXTERN_C with __cplusplus defined generates "throw ()", regardless of the linkage.

My recommendation is to leave it unchanged, but at some point we should examine and reconsider both SAL_THROW macros.

They are declared in main/sal/inc/sal/types.h

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

Reply via email to