Skip to content

Commit 095e435

Browse files
committed
wxwidgets.cfg: Added support for some wxTextFile functions.
1 parent 9465dca commit 095e435

File tree

3 files changed

+194
-10
lines changed

3 files changed

+194
-10
lines changed

cfg/wxwidgets.cfg

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,189 @@
557557
<returnValue type="unsigned char"/>
558558
<use-retval/>
559559
</function>
560+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
561+
<!-- void AddLine (const wxString &str, wxTextFileType type=typeDefault) -->
562+
<function name="wxTextFile::AddLine">
563+
<noreturn>false</noreturn>
564+
<leak-ignore/>
565+
<arg nr="1">
566+
<not-uninit/>
567+
</arg>
568+
<arg nr="2" default="typeDefault">
569+
<not-uninit/>
570+
</arg>
571+
</function>
572+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
573+
<!-- void Clear () -->
574+
<function name="wxTextFile::Clear">
575+
<noreturn>false</noreturn>
576+
<leak-ignore/>
577+
</function>
578+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
579+
<!-- bool Close () -->
580+
<function name="wxTextFile::Close">
581+
<noreturn>false</noreturn>
582+
<leak-ignore/>
583+
<returnValue type="bool"/>
584+
</function>
585+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
586+
<!-- bool Create () -->
587+
<function name="wxTextFile::Create">
588+
<noreturn>false</noreturn>
589+
<leak-ignore/>
590+
<returnValue type="bool"/>
591+
</function>
592+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
593+
<!-- bool Create (const wxString &strFile) -->
594+
<function name="wxTextFile::Create">
595+
<noreturn>false</noreturn>
596+
<leak-ignore/>
597+
<returnValue type="bool"/>
598+
<arg nr="1">
599+
<not-uninit/>
600+
</arg>
601+
</function>
602+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
603+
<!-- bool Eof () const -->
604+
<function name="wxTextFile::Eof">
605+
<noreturn>false</noreturn>
606+
<leak-ignore/>
607+
<returnValue type="bool"/>
608+
<use-retval/>
609+
</function>
610+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
611+
<!-- bool Exists () const -->
612+
<function name="wxTextFile::Exists">
613+
<noreturn>false</noreturn>
614+
<leak-ignore/>
615+
<returnValue type="bool"/>
616+
<use-retval/>
617+
</function>
618+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
619+
<!-- size_t GetCurrentLine () const -->
620+
<function name="wxTextFile::GetCurrentLine">
621+
<noreturn>false</noreturn>
622+
<leak-ignore/>
623+
<returnValue type="size_t"/>
624+
<use-retval/>
625+
</function>
626+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
627+
<!-- wxString & GetFirstLine () -->
628+
<function name="wxTextFile::GetFirstLine">
629+
<noreturn>false</noreturn>
630+
<leak-ignore/>
631+
<returnValue type="wxString"/>
632+
<use-retval/>
633+
</function>
634+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
635+
<!-- wxString & GetLastLine () -->
636+
<function name="wxTextFile::GetLastLine">
637+
<noreturn>false</noreturn>
638+
<leak-ignore/>
639+
<returnValue type="wxString"/>
640+
<use-retval/>
641+
</function>
642+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
643+
<!-- size_t GetLineCount () const -->
644+
<function name="wxTextFile::GetLineCount">
645+
<noreturn>false</noreturn>
646+
<leak-ignore/>
647+
<returnValue type="size_t"/>
648+
<use-retval/>
649+
</function>
650+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
651+
<!-- wxTextFileType GetLineType (size_t n) const -->
652+
<function name="wxTextFile::GetLineType">
653+
<noreturn>false</noreturn>
654+
<leak-ignore/>
655+
<returnValue type="wxTextFileType"/>
656+
<use-retval/>
657+
</function>
658+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
659+
<!-- const wxString & GetName () const -->
660+
<function name="wxTextFile::GetName">
661+
<noreturn>false</noreturn>
662+
<leak-ignore/>
663+
<returnValue type="const wxString"/>
664+
<use-retval/>
665+
</function>
666+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
667+
<!-- wxString & GetNextLine () -->
668+
<function name="wxTextFile::GetNextLine">
669+
<noreturn>false</noreturn>
670+
<leak-ignore/>
671+
<returnValue type="wxString"/>
672+
<use-retval/>
673+
</function>
674+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
675+
<!-- wxString & GetPrevLine () -->
676+
<function name="wxTextFile::GetPrevLine">
677+
<noreturn>false</noreturn>
678+
<leak-ignore/>
679+
<returnValue type="wxString"/>
680+
<use-retval/>
681+
</function>
682+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
683+
<!-- void GoToLine (size_t n) -->
684+
<function name="wxTextFile::GoToLine">
685+
<noreturn>false</noreturn>
686+
<leak-ignore/>
687+
<arg nr="1">
688+
<not-uninit/>
689+
</arg>
690+
</function>
691+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
692+
<!-- wxTextFileType GuessType () const -->
693+
<function name="wxTextFile::GuessType">
694+
<noreturn>false</noreturn>
695+
<leak-ignore/>
696+
<returnValue type="wxTextFileType"/>
697+
<use-retval/>
698+
</function>
699+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
700+
<!-- void InsertLine (const wxString &str, size_t n, wxTextFileType type=typeDefault) -->
701+
<function name="wxTextFile::InsertLine">
702+
<noreturn>false</noreturn>
703+
<leak-ignore/>
704+
<arg nr="1">
705+
<not-uninit/>
706+
</arg>
707+
<arg nr="2">
708+
<not-uninit/>
709+
</arg>
710+
<arg nr="3" default="typeDefault">
711+
<not-uninit/>
712+
</arg>
713+
</function>
714+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
715+
<!-- bool IsOpened () const -->
716+
<function name="wxTextFile::IsOpened">
717+
<noreturn>false</noreturn>
718+
<leak-ignore/>
719+
<returnValue type="bool"/>
720+
<use-retval/>
721+
</function>
722+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
723+
<!-- void RemoveLine (size_t n) -->
724+
<function name="wxTextFile::RemoveLine">
725+
<noreturn>false</noreturn>
726+
<leak-ignore/>
727+
<arg nr="1">
728+
<not-uninit/>
729+
</arg>
730+
</function>
731+
<!-- http://docs.wxwidgets.org/trunk/classwx_text_file.html -->
732+
<!-- wxString & GetLine (size_t n) -->
733+
<!-- const wxString & GetLine (size_t n) const -->
734+
<function name="wxTextFile::GetLine">
735+
<noreturn>false</noreturn>
736+
<leak-ignore/>
737+
<returnValue type="wxString"/>
738+
<use-retval/>
739+
<arg nr="1">
740+
<not-uninit/>
741+
</arg>
742+
</function>
560743
<!-- Override macros which don't necessarily require semicolons at the end -->
561744
<define name="DECLARE_CLASS(n)" value=""/>
562745
<define name="DECLARE_DYNAMIC_CLASS(n)" value=""/>

lib/checkcondition.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ namespace {
5151
CheckCondition instance;
5252
}
5353

54-
bool CheckCondition::isAliased(const std::set<unsigned int> &vars) const {
54+
bool CheckCondition::isAliased(const std::set<unsigned int> &vars) const
55+
{
5556
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
56-
if (Token::Match(tok, "= & %var% ;") && vars.find(tok->tokAt(2)->varId()) != vars.end())
57-
return true;
58-
}
59-
return false;
57+
if (Token::Match(tok, "= & %var% ;") && vars.find(tok->tokAt(2)->varId()) != vars.end())
58+
return true;
59+
}
60+
return false;
6061
}
6162

6263
void CheckCondition::assignIf()
@@ -524,14 +525,14 @@ void CheckCondition::multiCondition2()
524525

525526
if (type == MULTICONDITIONTYPE::INNER) {
526527
if (isOppositeCond(false, _tokenizer->isCPP(), cond1, cond2, _settings->library, true)) {
527-
if (!isAliased(vars))
528-
oppositeInnerConditionError(cond1, cond2);
528+
if (!isAliased(vars))
529+
oppositeInnerConditionError(cond1, cond2);
529530
}
530531
} else {
531532
if (isSameExpression(_tokenizer->isCPP(), true, cond1, cond2, _settings->library, true)) {
532533
if (!isAliased(vars))
533-
sameConditionAfterEarlyExitError(cond1, cond2);
534-
}
534+
sameConditionAfterEarlyExitError(cond1, cond2);
535+
}
535536
}
536537

537538
}

lib/checkcondition.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class CPPCHECKLIB CheckCondition : public Check {
114114
void checkInvalidTestForOverflow();
115115

116116
private:
117-
bool isAliased(const std::set<unsigned int> &vars) const;
117+
bool isAliased(const std::set<unsigned int> &vars) const;
118118
bool isOverlappingCond(const Token * const cond1, const Token * const cond2, bool pure) const;
119119
void assignIfError(const Token *tok1, const Token *tok2, const std::string &condition, bool result);
120120
void mismatchingBitAndError(const Token *tok1, const MathLib::bigint num1, const Token *tok2, const MathLib::bigint num2);

0 commit comments

Comments
 (0)