Author: truckman Date: Sat Sep 3 01:44:05 2016 New Revision: 1759047 URL: http://svn.apache.org/viewvc?rev=1759047&view=rev Log: In the SAL_UNUSED macro, __attribute((__unused__)) should be __attribute__((__unused__)), but both clang and gcc seem to understand both. Since __attribute__((__unused__)) can preceed the variable name, just like __pragma(warning(suppress:4100;suppress:4101)) for Visual Studio, so de-parameterize the SAL_UNUSED macro. Gcc whines if __attribute__((__unused__)) is used for a struct member, so create a separate define, SAL_UNUSED_MEMBER, which is empty for gcc, to handle struct members.
Modified: openoffice/trunk/main/sal/inc/sal/types.h openoffice/trunk/main/sc/inc/compiler.hxx Modified: openoffice/trunk/main/sal/inc/sal/types.h URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/inc/sal/types.h?rev=1759047&r1=1759046&r2=1759047&view=diff ============================================================================== --- openoffice/trunk/main/sal/inc/sal/types.h (original) +++ openoffice/trunk/main/sal/inc/sal/types.h Sat Sep 3 01:44:05 2016 @@ -235,12 +235,18 @@ typedef void * sal_Han # define SAL_MAX_ENUM 0x7fff #endif -#if defined(__GNUC__) || defined(__clang__) -#define SAL_UNUSED(__x__) __x__ __attribute((__unused__)) +#if defined(__clang__) +#define SAL_UNUSED __attribute__((__unused__)) +#define SAL_UNUSED_MEMBER __attribute__((__unused__)) +#elif defined(__GNUC__) +#define SAL_UNUSED __attribute__((__unused__)) +#define SAL_UNUSED_MEMBER #elif defined(_MSC_VER) -#define SAL_UNUSED(__x__) __pragma(warning(suppress:4100;suppress:4101)) __x__ +#define SAL_UNUSED __pragma(warning(suppress:4100;suppress:4101)) +#define SAL_UNUSED_MEMBER __pragma(warning(suppress:4100;suppress:4101)) #else -#define SAL_UNUSED(__x__) __x__ +#define SAL_UNUSED +#define SAL_UNUSED_MEMBER #endif #if defined(_MSC_VER) || defined(__MINGW32__) Modified: openoffice/trunk/main/sc/inc/compiler.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sc/inc/compiler.hxx?rev=1759047&r1=1759046&r2=1759047&view=diff ============================================================================== --- openoffice/trunk/main/sc/inc/compiler.hxx (original) +++ openoffice/trunk/main/sc/inc/compiler.hxx Sat Sep 3 01:44:05 2016 @@ -117,10 +117,10 @@ struct ScDoubleRawToken { private: // SC_TOKEN_FIX_MEMBERS - OpCode SAL_UNUSED(eOp); - formula::StackVar SAL_UNUSED(eType); - sal_uInt16 SAL_UNUSED(nRefCnt); - sal_Bool SAL_UNUSED(bRaw); + OpCode SAL_UNUSED_MEMBER eOp; + formula::StackVar SAL_UNUSED_MEMBER eType; + sal_uInt16 SAL_UNUSED_MEMBER nRefCnt; + sal_Bool SAL_UNUSED_MEMBER bRaw; public: union { // union only to assure alignment identical to ScRawToken