Skip to content

Fix Cert C++ warnings reported by Cppcheck Premium#5528

Merged
danmar merged 1 commit intocppcheck-opensource:mainfrom
cppchecksolutions:ci-selfcheck-premium
Oct 9, 2023
Merged

Fix Cert C++ warnings reported by Cppcheck Premium#5528
danmar merged 1 commit intocppcheck-opensource:mainfrom
cppchecksolutions:ci-selfcheck-premium

Conversation

@danmar
Copy link
Copy Markdown
Collaborator

@danmar danmar commented Oct 8, 2023

Warnings:


lib/symboldatabase.h:549:27: error: Guarantee that container indices and iterators are within the valid range [premium-cert-ctr50-cpp]
        return mDimensions[index_].num;
                          ^
lib/symboldatabase.h:557:27: error: Guarantee that container indices and iterators are within the valid range [premium-cert-ctr50-cpp]
        return mDimensions[index_].known;
                          ^
lib/symboldatabase.cpp:2193:20: error: Guarantee exception safety. An exception during allocation would violate the exception safety rules. [premium-cert-err56-cpp]
        mValueType = new ValueType(*var.mValueType);
                   ^
lib/symboldatabase.cpp:2191:5: note: Deallocated mValueType
    delete mValueType;
    ^
lib/symboldatabase.cpp:2193:20: note: Reallocated mValueType
        mValueType = new ValueType(*var.mValueType);
                   ^
lib/symboldatabase.cpp:2350:16: error: Guarantee exception safety. An exception during allocation would violate the exception safety rules. [premium-cert-err56-cpp]
    mValueType = new ValueType(valueType);
               ^
lib/symboldatabase.cpp:2349:5: note: Deallocated mValueType
    delete mValueType;
    ^
lib/symboldatabase.cpp:2350:16: note: Reallocated mValueType
    mValueType = new ValueType(valueType);
               ^
lib/templatesimplifier.cpp:242:17: error: Noexcept function TokenAndName may exit with an exception. [premium-cert-err55-cpp]
        mToken->templateSimplifierPointer(this);
                ^

mNameToken(other.mNameToken), mParamEnd(other.mParamEnd), mFlags(other.mFlags)
{
if (mToken)
mToken->templateSimplifierPointer(this);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

problem: calling method that is not marked with NOEXCEPT

@danmar danmar merged commit 47d2c0f into cppcheck-opensource:main Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant