[Libreoffice-commits] core.git: 6 commits - compilerplugins/clang cui/source dbaccess/source include/vcl svx/source sw/source vcl/source

Stephan Bergmann sbergman at redhat.com
Sun Jan 26 03:28:41 PST 2014


 compilerplugins/clang/implicitboolconversion.cxx |   30 +++++++++++++++++++++++
 cui/source/inc/SpellDialog.hxx                   |    2 -
 cui/source/tabpages/border.cxx                   |    4 +--
 dbaccess/source/ui/inc/FieldControls.hxx         |    6 ++--
 include/vcl/edit.hxx                             |    2 -
 include/vcl/vclmedit.hxx                         |    2 -
 svx/source/items/galleryitem.cxx                 |    3 --
 sw/source/ui/dialog/macassgn.cxx                 |    6 ++--
 sw/source/ui/fldui/flddb.cxx                     |    2 -
 sw/source/ui/inc/macassgn.hxx                    |    2 -
 vcl/source/edit/vclmedit.cxx                     |    2 -
 11 files changed, 45 insertions(+), 16 deletions(-)

New commits:
commit cd20baf40aba2153091eb5e7c680fd7e458c3286
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jan 25 22:08:14 2014 +0100

    implicitboolconversion: warn about mixing bool with integer
    
    ...in &=, |=, ^=, as does MSVC, too.
    
    Change-Id: I57ecc9d784dd483e04ae561c62595b1d0380517f

diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx
index 65db496..a804b0d 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -405,6 +405,16 @@ bool ImplicitBoolConversion::TraverseBinAndAssign(CompoundAssignOperator * expr)
         }
     }
     nested.pop();
+    if (!ignoreLocation(expr) && isBool(expr->getLHS(), false)
+        && !isBool(expr->getRHS()->IgnoreParenImpCasts(), false))
+    {
+        report(
+            DiagnosticsEngine::Warning, "mix of %0 and %1 in operator &=",
+            expr->getRHS()->getLocStart())
+            << expr->getLHS()->getType()
+            << expr->getRHS()->IgnoreParenImpCasts()->getType()
+            << expr->getSourceRange();
+    }
     return ret;
 }
 
@@ -421,6 +431,16 @@ bool ImplicitBoolConversion::TraverseBinOrAssign(CompoundAssignOperator * expr)
         }
     }
     nested.pop();
+    if (!ignoreLocation(expr) && isBool(expr->getLHS(), false)
+        && !isBool(expr->getRHS()->IgnoreParenImpCasts(), false))
+    {
+        report(
+            DiagnosticsEngine::Warning, "mix of %0 and %1 in operator |=",
+            expr->getRHS()->getLocStart())
+            << expr->getLHS()->getType()
+            << expr->getRHS()->IgnoreParenImpCasts()->getType()
+            << expr->getSourceRange();
+    }
     return ret;
 }
 
@@ -437,6 +457,16 @@ bool ImplicitBoolConversion::TraverseBinXorAssign(CompoundAssignOperator * expr)
         }
     }
     nested.pop();
+    if (!ignoreLocation(expr) && isBool(expr->getLHS(), false)
+        && !isBool(expr->getRHS()->IgnoreParenImpCasts(), false))
+    {
+        report(
+            DiagnosticsEngine::Warning, "mix of %0 and %1 in operator ^=",
+            expr->getRHS()->getLocStart())
+            << expr->getLHS()->getType()
+            << expr->getRHS()->IgnoreParenImpCasts()->getType()
+            << expr->getSourceRange();
+    }
     return ret;
 }
 
commit 3b4b4ed3b3fa73265b2f2506985dec6a4e1068f2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jan 25 22:07:21 2014 +0100

    Edit::IsModified should return bool
    
    Change-Id: I0aafdd37c73cd47b9dc68b60a32db35c8c11f455

diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 550f9c4..a159734 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -96,7 +96,7 @@ public:
 
 
     void            ResetModified()   { GetTextEngine()->SetModified(sal_False); m_bIsUndoEditMode = false;}
-    sal_Bool            IsModified() const              { return GetTextEngine()->IsModified(); }
+    virtual bool    IsModified() const SAL_OVERRIDE { return GetTextEngine()->IsModified(); }
 
     bool            IsUndoEditMode() const { return m_bIsUndoEditMode;}
     void            SetUndoEditMode(bool bSet);
diff --git a/dbaccess/source/ui/inc/FieldControls.hxx b/dbaccess/source/ui/inc/FieldControls.hxx
index 5ea415b..e65afba 100644
--- a/dbaccess/source/ui/inc/FieldControls.hxx
+++ b/dbaccess/source/ui/inc/FieldControls.hxx
@@ -46,7 +46,7 @@ namespace dbaui
     public:
         inline OPropColumnEditCtrl(Window* pParent, OUString& _rAllowedChars, sal_uInt16 nHelpId, short nPosition = -1, WinBits nWinStyle = 0);
 
-        inline sal_Bool IsModified() const { return GetText() != GetSavedValue(); }
+        virtual inline bool IsModified() const SAL_OVERRIDE { return GetText() != GetSavedValue(); }
 
         short GetPos() const { return m_nPos; }
         OUString GetHelp() const { return m_strHelpText; }
@@ -77,7 +77,7 @@ namespace dbaui
         inline OPropEditCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition = -1, WinBits nWinStyle = 0);
         inline OPropEditCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition = -1);
 
-        inline sal_Bool IsModified() const { return GetText() != GetSavedValue(); }
+        virtual inline bool IsModified() const SAL_OVERRIDE { return GetText() != GetSavedValue(); }
 
         short GetPos() const { return m_nPos; }
         OUString GetHelp() const { return m_strHelpText; }
@@ -111,7 +111,7 @@ namespace dbaui
         inline OPropNumericEditCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition = -1, WinBits nWinStyle = 0);
         inline OPropNumericEditCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition = -1);
 
-        inline sal_Bool IsModified() const { return GetText() != GetSavedValue(); }
+        virtual inline bool IsModified() const SAL_OVERRIDE { return GetText() != GetSavedValue(); }
 
         short GetPos() const { return m_nPos; }
         OUString GetHelp() const { return m_strHelpText; }
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index cbab39c..2ee94da 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -173,7 +173,7 @@ public:
 
     virtual void        SetModifyFlag();
     virtual void        ClearModifyFlag();
-    virtual sal_Bool        IsModified() const { return mpSubEdit ? mpSubEdit->mbModified : mbModified; }
+    virtual bool        IsModified() const { return mpSubEdit ? mpSubEdit->mbModified : mbModified; }
 
     virtual void        EnableUpdateData( sal_uLong nTimeout = EDIT_UPDATEDATA_TIMEOUT );
     virtual void        DisableUpdateData() { delete mpUpdateDataTimer; mpUpdateDataTimer = NULL; }
diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index 29f6a35..6e47f13 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -68,7 +68,7 @@ public:
 
     virtual void    SetModifyFlag();
     virtual void    ClearModifyFlag();
-    virtual sal_Bool    IsModified() const;
+    virtual bool    IsModified() const SAL_OVERRIDE;
 
     virtual void    EnableUpdateData( sal_uLong nTimeout = EDIT_UPDATEDATA_TIMEOUT );
     virtual void    DisableUpdateData() { delete pUpdateDataTimer; pUpdateDataTimer = NULL; }
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index c429160..9e6cc04 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -1074,7 +1074,7 @@ void VclMultiLineEdit::ClearModifyFlag()
     pImpVclMEdit->SetModified( sal_False );
 }
 
-sal_Bool VclMultiLineEdit::IsModified() const
+bool VclMultiLineEdit::IsModified() const
 {
     return pImpVclMEdit->IsModified();
 }
commit f03aebbd5fd4571d0663a8287dcc6a030b56305a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jan 25 21:13:08 2014 +0100

    bool improvements
    
    Change-Id: I00eb9eb8fa356f17fa219c4a669f8301064bfc83

diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index 4dc390a..f478d42 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -410,7 +410,7 @@ void SwFldDBPage::CheckInsert()
 
     if (nTypeId == TYP_DBNUMSETFLD)
     {
-        sal_Bool bHasValue = !m_pValueED->GetText().isEmpty();
+        bool bHasValue = !m_pValueED->GetText().isEmpty();
 
         bInsert &= bHasValue;
     }
commit 31d649000a87edbec3eee2d5d1e176aa5cc8473a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jan 25 21:08:11 2014 +0100

    bool improvements
    
    Change-Id: Iaa2986e9ab3e12350d2121f2ad3d3ea23e9a3b50

diff --git a/sw/source/ui/dialog/macassgn.cxx b/sw/source/ui/dialog/macassgn.cxx
index 8b21ede..af55cd6 100644
--- a/sw/source/ui/dialog/macassgn.cxx
+++ b/sw/source/ui/dialog/macassgn.cxx
@@ -107,10 +107,10 @@ SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType )
 }
 
 
-sal_Bool SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh,
+bool SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh,
                                     SvxMacroItem*& rpINetItem )
 {
-    sal_Bool bRet = sal_False;
+    bool bRet = false;
     SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 );
     SvxMacroItem aItem( RES_FRMMACRO );
     if( !rpINetItem )
@@ -132,7 +132,7 @@ sal_Bool SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh,
         if( SFX_ITEM_SET == pOutSet->GetItemState( RES_FRMMACRO, sal_False, &pItem ))
         {
             rpINetItem->SetMacroTable( ((SvxMacroItem*)pItem)->GetMacroTable() );
-            bRet = sal_True;
+            bRet = true;
         }
     }
     return bRet;
diff --git a/sw/source/ui/inc/macassgn.hxx b/sw/source/ui/inc/macassgn.hxx
index 13e71a3..cb4cda8 100644
--- a/sw/source/ui/inc/macassgn.hxx
+++ b/sw/source/ui/inc/macassgn.hxx
@@ -38,7 +38,7 @@ class SwMacroAssignDlg
 {
 public:
     static SfxEventNamesItem AddEvents( DlgEventType eType );
-    static sal_Bool INetFmtDlg( Window* pParent, SwWrtShell& rSh,
+    static bool INetFmtDlg( Window* pParent, SwWrtShell& rSh,
                             SvxMacroItem*& rpINetItem );
 };
 
commit ad5dcd60a9f9fef63d74259b11faabb285abc761
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jan 25 17:00:40 2014 +0100

    bool improvements
    
    Change-Id: I5649e051b59143e1d490a7a920465422a25d814c

diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index e54f266..0247ca8 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -716,14 +716,14 @@ sal_Bool SvxBorderTabPage::FillItemSet( SfxItemSet& rCoreAttrs )
         if ( !pOldBoxItem || !( *pOldBoxItem == aBoxItem ) )
         {
             rCoreAttrs.Put( aBoxItem );
-            bAttrsChanged |= sal_True;
+            bAttrsChanged |= true;
         }
         const SfxPoolItem* pOld = GetOldItem( rCoreAttrs, SID_ATTR_BORDER_INNER, sal_False );
 
         if ( !pOld || !( *(const SvxBoxInfoItem*)pOld == aBoxInfoItem ) )
         {
             rCoreAttrs.Put( aBoxInfoItem );
-            bAttrsChanged |= sal_True;
+            bAttrsChanged |= true;
         }
     }
     else
commit 23382371ad97d26b44256aaae89242f2e39cd639
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jan 25 14:58:03 2014 +0100

    bIsSetType is never read
    
    Change-Id: Ic65f51fa1d10027a0299ee67e162ce51c57b2530

diff --git a/svx/source/items/galleryitem.cxx b/svx/source/items/galleryitem.cxx
index 83bec06..0ecd7a0 100644
--- a/svx/source/items/galleryitem.cxx
+++ b/svx/source/items/galleryitem.cxx
@@ -76,7 +76,6 @@ bool SvxGalleryItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /* nMemberId
 
     int nConverted(0);
     bool bAllConverted( true );
-    sal_Bool bIsSetType( sal_False );
 
     sal_Int8 nType(0);
     rtl::OUString aURL, aFilterName;
@@ -89,7 +88,7 @@ bool SvxGalleryItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /* nMemberId
     {
         if ( pProp->Name == SVXGALLERYITEM_TYPE )
         {
-            bAllConverted &= bIsSetType = ( pProp->Value >>= nType );
+            bAllConverted &= ( pProp->Value >>= nType );
             ++nConverted;
         }
         else if ( pProp->Name == SVXGALLERYITEM_URL )


More information about the Libreoffice-commits mailing list