[Libreoffice-commits] .: 2 commits - sal/inc sal/qa

Caolán McNamara caolan at kemper.freedesktop.org
Fri Jul 22 02:19:58 PDT 2011


 sal/inc/osl/file.h           |    2 +-
 sal/inc/osl/file.hxx         |    2 +-
 sal/inc/sal/types.h          |   12 ++++++++++++
 sal/qa/osl/file/osl_File.cxx |    4 ++--
 4 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 1bc4f349b83b0415f1f9057d36ac4effbd6aa577
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jul 21 13:12:55 2011 +0100

    use SAL_WARN_UNUSED_RESULT

diff --git a/sal/inc/osl/file.h b/sal/inc/osl/file.h
index bdb7693..b90ea35 100644
--- a/sal/inc/osl/file.h
+++ b/sal/inc/osl/file.h
@@ -732,7 +732,7 @@ oslFileError SAL_CALL osl_openFile( rtl_uString *pustrFileURL, oslFileHandle *pH
     @see	osl_getFilePos()
 */
 
-oslFileError SAL_CALL osl_setFilePos( oslFileHandle Handle, sal_uInt32 uHow, sal_Int64 uPos );
+oslFileError SAL_CALL osl_setFilePos( oslFileHandle Handle, sal_uInt32 uHow, sal_Int64 uPos ) SAL_WARN_UNUSED_RESULT;
 
 
 /**	Retrieve the current position of the internal pointer of an open file.
diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx
index e75b591..df57e24 100644
--- a/sal/inc/osl/file.hxx
+++ b/sal/inc/osl/file.hxx
@@ -988,7 +988,7 @@ public:
         @see getPos()
     */
 
-    inline RC setPos( sal_uInt32 uHow, sal_Int64 uPos )
+    inline RC setPos( sal_uInt32 uHow, sal_Int64 uPos ) SAL_WARN_UNUSED_RESULT
     {
         return (RC) osl_setFilePos( _pData, uHow, uPos );
     }
diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h
index c1922ea..33ff2d9 100644
--- a/sal/inc/sal/types.h
+++ b/sal/inc/sal/types.h
@@ -302,7 +302,7 @@ typedef void *                   sal_Handle;
     Compilers that support a construct of this nature will emit a compile
     time warning on unchecked return value.
 */
-#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
 #   define SAL_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
 #else
 #   define SAL_WARN_UNUSED_RESULT
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index e38da90..ffa19b5 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -4246,8 +4246,8 @@ namespace osl_File
         //check if is the new file
         File newFile( aTmpName4 );
         newFile.open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Read );
-        newFile.setPos( osl_Pos_End, 0 );
-        //		CPPUNIT_ASSERT( ::osl::FileBase::E_None == nError1 );
+        nError1 = newFile.setPos( osl_Pos_End, 0 );
+        CPPUNIT_ASSERT( ::osl::FileBase::E_None == nError1 );
         sal_uInt64     nFilePointer;
         nError1 = newFile.getPos( nFilePointer );
         CPPUNIT_ASSERT( ::osl::FileBase::E_None == nError1 );
commit 4f6b6da8e99c7ad0d37952e93b76d208ac513891
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jul 21 10:56:37 2011 +0100

    add a _attribute__((warn_unused_result)) based macro

diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h
index 1266c9b..c1922ea 100644
--- a/sal/inc/sal/types.h
+++ b/sal/inc/sal/types.h
@@ -296,6 +296,18 @@ typedef void *                   sal_Handle;
 #define SAL_EXCEPTION_DLLPRIVATE
 #endif
 
+/** Use this as markup for functions and methods whose return value must be
+    checked.
+
+    Compilers that support a construct of this nature will emit a compile
+    time warning on unchecked return value.
+*/
+#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#   define SAL_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+#   define SAL_WARN_UNUSED_RESULT
+#endif
+
 /** Use this for pure virtual classes, e.g. class SAL_NO_VTABLE Foo { ...
     This hinders the compiler from setting a generic vtable stating that
     a pure virtual function was called and thus slightly reduces code size.


More information about the Libreoffice-commits mailing list