[Libreoffice-commits] .: 2 commits - autodoc/source bridges/source codemaker/source cosv/inc cppuhelper/inc cppu/qa l10ntools/source rsc/inc rsc/source sal/inc sal/rtl sdext/source svl/source testtools/source unotest/inc

Stephan Bergmann sbergmann at kemper.freedesktop.org
Tue Oct 18 14:11:24 PDT 2011


 autodoc/source/inc/estack.hxx                        |    6 -
 bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx |    5 -
 codemaker/source/javamaker/javatype.cxx              |    8 --
 cosv/inc/cosv/tpl/vvector.hxx                        |    2 
 cppu/qa/cppumaker/test_cppumaker.cxx                 |   44 +++++++------
 cppu/qa/test_unotype.cxx                             |    2 
 cppuhelper/inc/cppuhelper/propertysetmixin.hxx       |    2 
 l10ntools/source/export2.cxx                         |   14 ----
 rsc/inc/rscerror.h                                   |    2 
 rsc/source/rscpp/cpp1.c                              |    2 
 sal/inc/rtl/allocator.hxx                            |    3 
 sal/rtl/source/alloc_impl.h                          |    2 
 sdext/source/presenter/PresenterProtocolHandler.cxx  |    1 
 sdext/source/presenter/PresenterTimer.cxx            |    4 -
 svl/source/misc/urihelper.cxx                        |   60 ++++---------------
 testtools/source/bridgetest/bridgetest.cxx           |    5 -
 testtools/source/bridgetest/cppobj.cxx               |   19 ++++--
 unotest/inc/unotest/oustringostreaminserter.hxx      |    4 +
 18 files changed, 77 insertions(+), 108 deletions(-)

New commits:
commit bbb5da15782f074feeaef6bd268e66495187876b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 18 23:07:08 2011 +0200

    Clang does not understand #pragma GCC diagnostic warning "-Wunused-but-set-variable".
    
    See <https://bugs.kde.org/show_bug.cgi?id=284384> "clang 3.1 -Wunused-value
    warnings in valgrind.h, memcheck.h" for a way to silence these warnings when
    building with clang.

diff --git a/sal/rtl/source/alloc_impl.h b/sal/rtl/source/alloc_impl.h
index 39bbbf6..55f6ed3 100644
--- a/sal/rtl/source/alloc_impl.h
+++ b/sal/rtl/source/alloc_impl.h
@@ -264,7 +264,7 @@ typedef CRITICAL_SECTION rtl_memory_lock_type;
 #define GCC_VERSION (__GNUC__ * 10000 \
                      + __GNUC_MINOR__ * 100 \
                      + __GNUC_PATCHLEVEL__)
-#if GCC_VERSION >= 40201
+#if GCC_VERSION >= 40201 && !defined __clang__
 #pragma GCC diagnostic warning "-Wunused-but-set-variable"
 #endif
 #endif /* NVALGRIND || HAVE_MEMCHECK_H */
commit bf1f0183d5c6b4c94acdbee27276d5a386a657f4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 18 23:05:58 2011 +0200

    Some fixes for "clang version 3.1 (trunk 142234)" (with --enable-werror, on Linux x86_64).

diff --git a/autodoc/source/inc/estack.hxx b/autodoc/source/inc/estack.hxx
index 1cb5855..3eb5b83 100644
--- a/autodoc/source/inc/estack.hxx
+++ b/autodoc/source/inc/estack.hxx
@@ -63,12 +63,10 @@ class EStack : private std::list<ELEM>
                                                 { base::operator=( i_rStack.Base() );
                                                   return *this; }
     bool                operator==(
-                            const EStack<ELEM> &
-                                                i_r2 ) const
+                            const EStack<ELEM> & ) const
                                                 { return std::operator==( Base(), this->i_rStack.Base() ); }
     bool                operator<(
-                            const EStack<ELEM> &
-                                                i_r2 ) const
+                            const EStack<ELEM> & ) const
                                                 { return std::operator<( Base(), this->i_rStack.Base() ); }
     // OPERATIONS
     void                push(
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
index c830f87..a34d77f 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
@@ -151,9 +151,8 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
         "movq   %%rdx, %5\n\t"
         "movsd %%xmm0, %6\n\t"
         "movsd %%xmm1, %7\n\t"
-        :
-        : "m" ( pMethod ), "m" ( pGPR ), "m" ( pFPR ), "m" ( nFPR ),
-          "m" ( rax ), "m" ( rdx ), "m" ( xmm0 ), "m" ( xmm1 )
+        : "=m" ( rax ), "=m" ( rdx ), "=m" ( xmm0 ), "=m" ( xmm1 )
+        : "m" ( pMethod ), "m" ( pGPR ), "m" ( pFPR ), "m" ( nFPR )
         : "rax", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r11"
     );
 
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx
index 0d53452..805ad4c 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -67,14 +67,6 @@ using codemaker::javamaker::ClassFile;
 
 namespace {
 
-void checkNoTypeArguments(std::vector< rtl::OString > const & arguments) {
-    if (!arguments.empty()) {
-        throw CannotDumpException(
-            rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")));
-            //TODO
-    }
-}
-
 // helper function for createUnoName
 void appendUnoName(
     TypeManager const & manager, rtl::OString const & nucleus, sal_Int32 rank,
diff --git a/cosv/inc/cosv/tpl/vvector.hxx b/cosv/inc/cosv/tpl/vvector.hxx
index 9832615..d9f43a2 100644
--- a/cosv/inc/cosv/tpl/vvector.hxx
+++ b/cosv/inc/cosv/tpl/vvector.hxx
@@ -79,7 +79,7 @@ struct delete_ptrs
 template <class TYPE>
 struct keep_ptrs
 {
-    static void         Destruct(std::vector< TYPE* > & v)
+    static void         Destruct(std::vector< TYPE* > &)
                         {}
 
     static void         Erase(
diff --git a/cppu/qa/cppumaker/test_cppumaker.cxx b/cppu/qa/cppumaker/test_cppumaker.cxx
index 141c3e2..11435e5 100644
--- a/cppu/qa/cppumaker/test_cppumaker.cxx
+++ b/cppu/qa/cppumaker/test_cppumaker.cxx
@@ -380,6 +380,7 @@
 
 //TODO, copied here from test/oustringostreaminserter.hxx, make DRY again:
 #include "osl/thread.h"
+namespace rtl {
 template< typename charT, typename traits > std::basic_ostream<charT, traits> &
 operator <<(
     std::basic_ostream<charT, traits> & stream, rtl::OUString const & string)
@@ -389,6 +390,30 @@ operator <<(
         // best effort; potentially loses data due to conversion failures and
         // embedded null characters
 }
+}
+
+namespace com { namespace sun { namespace star { namespace uno {
+
+std::ostream & operator <<(
+    std::ostream & out, com::sun::star::uno::Exception const &)
+{
+    return out << "<UNO exception>";
+}
+
+} } } }
+
+namespace test { namespace codemaker { namespace cppumaker {
+
+bool operator ==(
+    test::codemaker::cppumaker::TestException1 const & e1,
+    test::codemaker::cppumaker::TestException1 const & e2)
+{
+    return e1.Message == e2.Message && e1.Context == e2.Context
+        && e1.m1 == e2.m1 && e1.m2 == e2.m2 && e1.m3 == e2.m3
+        && e1.m4.member1 == e2.m4.member1 && e1.m4.member2 == e2.m4.member2;
+}
+
+} } }
 
 namespace {
 
@@ -503,25 +528,6 @@ void Test::testPolyStruct() {
         static_cast< sal_uInt32 >(5));
 }
 
-namespace {
-
-bool operator ==(
-    test::codemaker::cppumaker::TestException1 const & e1,
-    test::codemaker::cppumaker::TestException1 const & e2)
-{
-    return e1.Message == e2.Message && e1.Context == e2.Context
-        && e1.m1 == e2.m1 && e1.m2 == e2.m2 && e1.m3 == e2.m3
-        && e1.m4.member1 == e2.m4.member1 && e1.m4.member2 == e2.m4.member2;
-}
-
-std::ostream & operator <<(
-    std::ostream & out, com::sun::star::uno::Exception const &)
-{
-    return out << "<UNO exception>";
-}
-
-}
-
 void Test::testExceptions() {
     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >
         aEmptySequence;
diff --git a/cppu/qa/test_unotype.cxx b/cppu/qa/test_unotype.cxx
index 110ae20..dbb13d6 100644
--- a/cppu/qa/test_unotype.cxx
+++ b/cppu/qa/test_unotype.cxx
@@ -61,6 +61,7 @@
 
 //TODO, copied here from test/oustringostreaminserter.hxx, make DRY again:
 #include "osl/thread.h"
+namespace rtl {
 template< typename charT, typename traits > std::basic_ostream<charT, traits> &
 operator <<(
     std::basic_ostream<charT, traits> & stream, rtl::OUString const & string)
@@ -70,6 +71,7 @@ operator <<(
         // best effort; potentially loses data due to conversion failures and
         // embedded null characters
 }
+}
 
 namespace com { namespace sun { namespace star { namespace uno {
     class Any;
diff --git a/cppuhelper/inc/cppuhelper/propertysetmixin.hxx b/cppuhelper/inc/cppuhelper/propertysetmixin.hxx
index 6ab242f..f23aec1 100644
--- a/cppuhelper/inc/cppuhelper/propertysetmixin.hxx
+++ b/cppuhelper/inc/cppuhelper/propertysetmixin.hxx
@@ -477,7 +477,7 @@ protected:
 
 private:
     PropertySetMixin(PropertySetMixin &); // not defined
-    void operator =(PropertySetMixin); // not defined
+    void operator =(PropertySetMixin &); // not defined
 };
 
 #if defined _MSC_VER
diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx
index 60ca704..26f99b5 100644
--- a/l10ntools/source/export2.cxx
+++ b/l10ntools/source/export2.cxx
@@ -198,18 +198,10 @@ void Export::RemoveUTF8ByteOrderMarker( ByteString &rString ){
 }
 
 bool Export::hasUTF8ByteOrderMarker( const ByteString &rString ){
-    // Byte order marker signature
-
-    const unsigned char c1 =  0xEF;
-    const unsigned char c2 =  0xBB;
-    const unsigned char c3 =  0xBF;
-
-    const char bom[ 3 ] = { c1 , c2 , c3 };
-
     return      rString.Len() >= 3 &&
-                rString.GetChar( 0 ) == bom[ 0 ] &&
-                rString.GetChar( 1 ) == bom[ 1 ] &&
-                rString.GetChar( 2 ) == bom[ 2 ] ;
+                rString.GetChar( 0 ) == '\xEF' &&
+                rString.GetChar( 1 ) == '\xBB' &&
+                rString.GetChar( 2 ) == '\xBF' ;
 }
 bool Export::fileHasUTF8ByteOrderMarker( const ByteString &rString ){
     SvFileStream aFileIn( String( rString , RTL_TEXTENCODING_ASCII_US ) , STREAM_READ );
diff --git a/rsc/inc/rscerror.h b/rsc/inc/rscerror.h
index bc1516a..fc494c0 100644
--- a/rsc/inc/rscerror.h
+++ b/rsc/inc/rscerror.h
@@ -136,6 +136,8 @@ class RscError
     void ErrorFormat( const ERRTYPE& rError, RscTop * pClass,
                       const RscId & aId );
 public:
+    virtual ~RscError() {}
+
     sal_uInt32  nErrors;// Anzahl der Fehler
                     RscError( RscVerbosity _verbosity ) {
                         fListing = NULL;
diff --git a/rsc/source/rscpp/cpp1.c b/rsc/source/rscpp/cpp1.c
index 014a14b..fbac898 100644
--- a/rsc/source/rscpp/cpp1.c
+++ b/rsc/source/rscpp/cpp1.c
@@ -466,7 +466,7 @@ void cppmain()
             unget();                            /* Reread the char.     */
             for (;;) {                          /* For the whole line,  */
                 do {                            /* Token concat. loop   */
-                    for (counter = 0; (type[(c = get())] == SPA);) {
+                    for (counter = 0; type[(c = get())] == SPA;) {
 #if COMMENT_INVISIBLE
                         if (c != COM_SEP)
                             counter++;
diff --git a/sal/inc/rtl/allocator.hxx b/sal/inc/rtl/allocator.hxx
index 5b27bee..c19d8d2 100644
--- a/sal/inc/rtl/allocator.hxx
+++ b/sal/inc/rtl/allocator.hxx
@@ -125,9 +125,8 @@ public:
        are not enabled, e.g. GCC under Linux and it is
        in general not desired to compile sal with exceptions
        enabled. */
-    pointer allocate (size_type n, const void* hint = 0)
+    pointer allocate (size_type n, const void* = 0)
     {
-        hint = hint; /* avoid warnings */
         return reinterpret_cast<pointer>(
             rtl_allocateMemory(sal_uInt32(n * sizeof(T))));
     }
diff --git a/sdext/source/presenter/PresenterProtocolHandler.cxx b/sdext/source/presenter/PresenterProtocolHandler.cxx
index 7c4829a..a7d5081 100644
--- a/sdext/source/presenter/PresenterProtocolHandler.cxx
+++ b/sdext/source/presenter/PresenterProtocolHandler.cxx
@@ -66,6 +66,7 @@ namespace {
     class Command
     {
     public:
+        virtual ~Command() {}
         virtual void Execute (void) = 0;
         virtual bool IsEnabled (void) const = 0;
         virtual Any GetState (void) const = 0;
diff --git a/sdext/source/presenter/PresenterTimer.cxx b/sdext/source/presenter/PresenterTimer.cxx
index 7451794..4668cdd 100644
--- a/sdext/source/presenter/PresenterTimer.cxx
+++ b/sdext/source/presenter/PresenterTimer.cxx
@@ -128,10 +128,6 @@ private:
     virtual void SAL_CALL onTerminated (void);
 };
 
-
-
-
-bool GetDateTime (oslDateTime& rDateTime);
 } // end of anonymous namespace
 
 
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index 1bef290..937019f 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -74,35 +74,21 @@ using namespace com::sun::star;
 //
 //============================================================================
 
-namespace {
-
-inline UniString toUniString(ByteString const & rString)
-{
-    return UniString(rString, RTL_TEXTENCODING_ISO_8859_1);
-}
-
-inline UniString toUniString(UniString const & rString)
-{
-    return rString;
-}
-
-template< typename Str >
-inline UniString SmartRel2Abs_Impl(INetURLObject const & rTheBaseURIRef,
-                                   Str const & rTheRelURIRef,
-                                   Link const & rMaybeFileHdl,
-                                   bool bCheckFileExists,
-                                   bool bIgnoreFragment,
-                                   INetURLObject::EncodeMechanism
-                                       eEncodeMechanism,
-                                   INetURLObject::DecodeMechanism
-                                       eDecodeMechanism,
-                                   rtl_TextEncoding eCharset,
-                                   bool bRelativeNonURIs,
-                                   INetURLObject::FSysStyle eStyle)
+UniString
+URIHelper::SmartRel2Abs(INetURLObject const & rTheBaseURIRef,
+                        UniString const & rTheRelURIRef,
+                        Link const & rMaybeFileHdl,
+                        bool bCheckFileExists,
+                        bool bIgnoreFragment,
+                        INetURLObject::EncodeMechanism eEncodeMechanism,
+                        INetURLObject::DecodeMechanism eDecodeMechanism,
+                        rtl_TextEncoding eCharset,
+                        bool bRelativeNonURIs,
+                        INetURLObject::FSysStyle eStyle)
 {
     // Backwards compatibility:
     if (rTheRelURIRef.Len() != 0 && rTheRelURIRef.GetChar(0) == '#')
-        return toUniString(rTheRelURIRef);
+        return rTheRelURIRef;
 
     INetURLObject aAbsURIRef;
     if (rTheBaseURIRef.HasError())
@@ -133,7 +119,7 @@ inline UniString SmartRel2Abs_Impl(INetURLObject const & rTheBaseURIRef,
                 bool bMaybeFile = false;
                 if (rMaybeFileHdl.IsSet())
                 {
-                    UniString aFilePath(toUniString(rTheRelURIRef));
+                    UniString aFilePath(rTheRelURIRef);
                     bMaybeFile = rMaybeFileHdl.Call(&aFilePath) != 0;
                 }
                 if (!bMaybeFile)
@@ -144,26 +130,6 @@ inline UniString SmartRel2Abs_Impl(INetURLObject const & rTheBaseURIRef,
     return aAbsURIRef.GetMainURL(eDecodeMechanism, eCharset);
 }
 
-}
-
-UniString
-URIHelper::SmartRel2Abs(INetURLObject const & rTheBaseURIRef,
-                        UniString const & rTheRelURIRef,
-                        Link const & rMaybeFileHdl,
-                        bool bCheckFileExists,
-                        bool bIgnoreFragment,
-                        INetURLObject::EncodeMechanism eEncodeMechanism,
-                        INetURLObject::DecodeMechanism eDecodeMechanism,
-                        rtl_TextEncoding eCharset,
-                        bool bRelativeNonURIs,
-                        INetURLObject::FSysStyle eStyle)
-{
-    return SmartRel2Abs_Impl(rTheBaseURIRef, rTheRelURIRef, rMaybeFileHdl,
-                             bCheckFileExists, bIgnoreFragment,
-                             eEncodeMechanism, eDecodeMechanism, eCharset,
-                             bRelativeNonURIs, eStyle);
-}
-
 //============================================================================
 //
 //  SetMaybeFileHdl
diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx
index a1bde57..e777037 100644
--- a/testtools/source/bridgetest/bridgetest.cxx
+++ b/testtools/source/bridgetest/bridgetest.cxx
@@ -657,10 +657,11 @@ static sal_Bool performTest(
         sal_Int8 _arByte[] = { 1, 2, -1 };
         sal_Int16 _arShort[] = { -0x8000, 1, 0x7FFF };
         sal_uInt16 _arUShort[] = { 0 , 1, 0xFFFF };
-        sal_Int32 _arLong[] = { 0x80000000, 1, 0x7FFFFFFF };
+        sal_Int32 _arLong[] = {
+            static_cast< sal_Int32 >(0x80000000), 1, 0x7FFFFFFF };
         sal_uInt32 _arULong[] = { 0, 1, 0xFFFFFFFF };
         sal_Int64 _arHyper[] = {
-            SAL_CONST_INT64(0x8000000000000000), 1,
+            static_cast< sal_Int64 >(SAL_CONST_INT64(0x8000000000000000)), 1,
             SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF) };
         sal_uInt64 _arUHyper[] = { 0, 1, SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF) };
         float _arFloat[] = { 1.1f, 2.2f, 3.3f };
diff --git a/testtools/source/bridgetest/cppobj.cxx b/testtools/source/bridgetest/cppobj.cxx
index da91ec8..5107e23 100644
--- a/testtools/source/bridgetest/cppobj.cxx
+++ b/testtools/source/bridgetest/cppobj.cxx
@@ -497,10 +497,22 @@ Any Test_Impl::transportAny( const Any & value ) throw ( ::com::sun::star::uno::
 }
 
 //__________________________________________________________________________________________________
+
+namespace {
+
+void wait(sal_Int32 microSeconds) {
+    OSL_ASSERT(microSeconds >= 0 && microSeconds <= SAL_MAX_INT32 / 1000);
+    TimeValue t = {
+        static_cast< sal_uInt32 >(microSeconds / 1000000),
+        static_cast< sal_uInt32 >(microSeconds * 1000) };
+    osl_waitThread(&t);
+}
+
+}
+
 void Test_Impl::call( sal_Int32 nCallId , sal_Int32 nWaitMUSEC ) throw(::com::sun::star::uno::RuntimeException)
 {
-    TimeValue value = { nWaitMUSEC / 1000000 , nWaitMUSEC * 1000 };
-    osl_waitThread( &value );
+    wait(nWaitMUSEC);
     if( m_bFirstCall )
     {
         m_bFirstCall = sal_False;
@@ -515,8 +527,7 @@ void Test_Impl::call( sal_Int32 nCallId , sal_Int32 nWaitMUSEC ) throw(::com::su
 //__________________________________________________________________________________________________
 void Test_Impl::callOneway( sal_Int32 nCallId , sal_Int32 nWaitMUSEC ) throw (::com::sun::star::uno::RuntimeException)
 {
-    TimeValue value = { nWaitMUSEC / 1000000 , nWaitMUSEC * 1000 };
-    osl_waitThread( &value );
+    wait(nWaitMUSEC);
     m_bSequenceOfCallTestPassed = m_bSequenceOfCallTestPassed && (nCallId > m_nLastCallId);
     m_nLastCallId = nCallId;
 }
diff --git a/unotest/inc/unotest/oustringostreaminserter.hxx b/unotest/inc/unotest/oustringostreaminserter.hxx
index 2658cad..143c3a5 100644
--- a/unotest/inc/unotest/oustringostreaminserter.hxx
+++ b/unotest/inc/unotest/oustringostreaminserter.hxx
@@ -36,6 +36,8 @@
 
 // Include this header to support rtl::OUString in CPPUNIT_ASSERT macros.
 
+namespace rtl {
+
 template< typename charT, typename traits > std::basic_ostream<charT, traits> &
 operator <<(
     std::basic_ostream<charT, traits> & stream, rtl::OUString const & string)
@@ -46,6 +48,8 @@ operator <<(
         // embedded null characters
 }
 
+}
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list