I was looking through the code and came across these edits, and I want to know if everything was done correctly with regards to the macro?modified: 2022-05-21 | ollydbg |
m_RE_Unix.Compile(_T("([^$]|^)(\\$[({]?(#?[A-Za-z_0-9.]+)[\\)} /\\\\]?)"), wxRE_EXTENDED | wxRE_NEWLINE); wxCHECK_MSG(m_RE_Unix.IsValid(), false, "Invalid regex (m_RE_Unix) in macros manager");
https://sourceforge.net/p/codeblocks/code/12880/tree/trunk/src/sdk/macrosmanager.cpp (https://sourceforge.net/p/codeblocks/code/12880/tree/trunk/src/sdk/macrosmanager.cpp)
macrosmanager.cpp: row 93
My test example:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define wxCHECK2_MSG(cond, op, msg) \
if ( cond ) \
{ \
printf("cond:%d",(int)cond); \
} \
else \
{ \
printf("op:%s \"%s\" %s:%d",#op,msg,__FILE__,__LINE__); \
op; \
}
//struct wxMAKE_UNIQUE_NAME(wxDummyCheckStruct) /* to force a semicolon */
// check which returns with the specified return code if the condition fails
#define wxCHECK_MSG(cond, rc, msg) wxCHECK2_MSG(cond, return rc, msg)
int test() {
return -55550; // test 1
// return 0; // test 2
}
int main(int argc, char** argv) {
// MACROS, not need ";" in end line
wxCHECK_MSG(test(), 1212121, "Error msg string.")
printf("\n%s:%d",__FILE__,__LINE__);
return 0;
}
You can bet he knows. MacrosManager::CompileRegexes() will return false if any of the IsValid() calls return false.
I'm not talking about the MacrosManager::CompileRegexes(), but about the wxCHECK_MSG(m_RE_Unix.IsValid(), false, "Invalid regex (m_RE_Unix) in macros manager");
wxCHECK_MSG(m_RE_DOS.IsValid(), false, "Invalid regex (m_RE_DOS) in macros manager");
wxCHECK_MSG(m_RE_IfSp.IsValid(), false, "Invalid regex (m_RE_IfSp) in macros manager");
processing and output of information where there is an incorrect regular expression. If there is an error in the 1st reg.expression, will the following reg.expressions, which are in the code below, be checked?
What does the second argument as "FALSE" mean?
wxCHECK_MSG(.., false,..);
The first error makes the method return false, read the documentation (https://docs.wxwidgets.org/trunk/group__group__funcmacro__debug.html#ga4822a2ea9fdd0bc98caa3ff42587743e) of wxCHECK_MSG.
bool MacrosManager::CompileRegexes() {
m_RE_Unix.Compile(_T("([^$]|^)(\\$[({]?(#?[A-Za-z_0-9.]+)[\\)} /\\\\]?)"),wxRE_EXTENDED | wxRE_NEWLINE); wxCHECK_MSG(m_RE_Unix.IsValid(), false, "Invalid regex (m_RE_Unix) in macros manager");
m_RE_DOS.Compile(_T("([^%]|^)(%(#?[A-Za-z_0-9.]+)%)"), wxRE_EXTENDED | wxRE_NEWLINE); wxCHECK_MSG(m_RE_DOS.IsValid(), false, "Invalid regex (m_RE_DOS) in macros manager");
m_RE_IfSp.Compile(_T("(([^=!<>]+)[ ]*(=|==|!=|>|<|>=|<=)[ ]*([^=!<>]+))"),wxRE_EXTENDED | wxRE_NEWLINE);
wxCHECK_MSG(m_RE_IfSp.IsValid(), false, "Invalid regex (m_RE_IfSp) in macros manager");
m_RE_Script.Compile(_T("(\\[\\[(.*)\\]\\])"), wxRE_EXTENDED | wxRE_NEWLINE); wxCHECK_MSG(m_RE_Script.IsValid(), false, "Invalid regex (m_RE_Script) in macros manager");
#ifndef __WXMAC__ const int flagsForMac = wxRE_ADVANCED; #else const int flagsForMac = wxRE_EXTENDED;#endif
m_RE_ToAbsolutePath.Compile(_T("\\$TO_ABSOLUTE_PATH{([^}]*)}"), flagsForMac); wxCHECK_MSG(m_RE_ToAbsolutePath.IsValid(), false,"Invalid regex (m_RE_ToAbsolutePath) in macros manager");
m_RE_To83Path.Compile(_T("\\$TO_83_PATH{([^}]*)}"), flagsForMac);
wxCHECK_MSG(m_RE_To83Path.IsValid(), false, "Invalid regex (m_RE_To83Path) in macros manager");
m_RE_RemoveQuotes.Compile(_T("\\$REMOVE_QUOTES{([^}]*)}"), flagsForMac); wxCHECK_MSG(m_RE_RemoveQuotes.IsValid(), false,"Invalid regex (m_RE_RemoveQuotes) in macros manager");
return true;
}
this execute?
wxCHECK_MSG(m_RE_RemoveQuotes.IsValid(), false,"Invalid regex (m_RE_RemoveQuotes) in macros manager");
if in first
wxCHECK_MSG(m_RE_Unix.IsValid(), false, "Invalid regex (m_RE_Unix) in macros manager");
retur false
You can specify which method will return false?