mirror of
https://github.com/g4klx/DAPNETGateway.git
synced 2026-08-26 12:32:45 -04:00
Merge pull request #20 from hacknix/master
Add #if block to exclude REGEX loading for old versions of GCC
This commit is contained in:
commit
ab2fde5a54
1 changed files with 15 additions and 0 deletions
15
REGEX.cpp
15
REGEX.cpp
|
|
@ -24,6 +24,7 @@
|
|||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
CREGEX::CREGEX(const std::string& regexFile) :
|
||||
m_regexFile(regexFile),
|
||||
m_regex()
|
||||
|
|
@ -31,7 +32,19 @@ m_regex()
|
|||
}
|
||||
|
||||
bool CREGEX::load()
|
||||
/* Older versions of GCC appear to support REGEX but silently fail to match. Even
|
||||
* though the headers exist and the code compiles and runs cleanly. The below #if block
|
||||
* stops the REGEXs being loaded in these cases, effectively disabling REGEX functionality.
|
||||
* The loading code is replaced with a log entry to show the user this has happened.
|
||||
*/
|
||||
{
|
||||
#if defined(__GNUC__) && (__GNUC__ <= 4) || (__GNUC__ == 4 && __GNUC_MINOR__ <= 9)
|
||||
LogError("REGEX is not properly supported in GCC vesions below 4.9. Not loading REGEX");
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
|
||||
|
||||
FILE* fp = ::fopen(m_regexFile.c_str(), "rt");
|
||||
if (fp != NULL) {
|
||||
char buffer[100U];
|
||||
|
|
@ -68,6 +81,8 @@ bool CREGEX::load()
|
|||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
std::vector<std::regex> CREGEX::get()
|
||||
{
|
||||
return(m_regex);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue