Added pcre support and changes to compile with clib2, although it is not 100% working now

This commit is contained in:
George Sokianos 2022-07-30 17:41:17 +01:00
parent 711137d3cd
commit be65971e97
7 changed files with 31 additions and 11 deletions

View File

@ -77,7 +77,7 @@ else # !WINNT
endif # !CPPCHK_GLIBCXX_DEBUG endif # !CPPCHK_GLIBCXX_DEBUG
endif # GNU/kFreeBSD endif # GNU/kFreeBSD
LDFLAGS=-lpthread -athread=native -gstabs LDFLAGS=-lpthread
endif # WINNT endif # WINNT
@ -101,8 +101,12 @@ ifndef CXXFLAGS
CXXFLAGS=-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar $(CPPCHK_GLIBCXX_DEBUG) -g CXXFLAGS=-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar $(CPPCHK_GLIBCXX_DEBUG) -g
endif endif
override CXXFLAGS += -mcrt=newlib -athread=native -DNO_UNIX_SIGNAL_HANDLING -DUSE_THREADS -gstabs MCRT := -mcrt=newlib
# CXXFLAGS=-mcrt=newlib -athread=native -std=c++0x -O2 -DNDEBUG -DNO_UNIX_SIGNAL_HANDLING -DUSE_THREADS -Wall -Wno-sign-compare ifeq ($(USE_CLIB2), yes)
MCRT := -mcrt=clib2
endif
override CXXFLAGS +=$(MCRT) -O2 -athread=native -DNO_UNIX_SIGNAL_HANDLING -DUSE_THREADS
ifeq (g++, $(findstring g++,$(CXX))) ifeq (g++, $(findstring g++,$(CXX)))
override CXXFLAGS += -std=gnu++0x override CXXFLAGS += -std=gnu++0x
@ -115,11 +119,12 @@ else ifeq ($(CXX), c++)
endif endif
ifeq ($(HAVE_RULES),yes) ifeq ($(HAVE_RULES),yes)
override CXXFLAGS += -DHAVE_RULES -DTIXML_USE_STL $(shell pcre-config --cflags) override CXXFLAGS += -DHAVE_RULES -DTIXML_USE_STL
# $(shell pcre-config --cflags)
ifdef LIBS ifdef LIBS
LIBS += $(shell pcre-config --libs) LIBS += -lpcre
else else
LIBS=$(shell pcre-config --libs) LIBS=-lpcre
endif endif
endif endif

View File

@ -174,7 +174,7 @@ bool FileLister::fileExists(const std::string &path)
#endif #endif
#endif #endif
#if defined(__amigaos4__) #if defined(__amigaos4__) && !defined(__CLIB2__)
static int readdir_r(DIR *dir, struct dirent *buf, struct dirent **result) { static int readdir_r(DIR *dir, struct dirent *buf, struct dirent **result) {
struct dirent *de; struct dirent *de;

View File

@ -80,6 +80,10 @@ static char exename[1024] = {0};
static char exename[1024] = {0}; static char exename[1024] = {0};
#endif #endif
#if defined(__amigaos4__)
static const char *stack __attribute__((used)) = "$STACK:102400";
static const char *version __attribute__((used)) = "\0$VER: cppcheck 2.9 (28.07.2022)";
#endif
/** /**
* Main function of cppcheck * Main function of cppcheck
* *
@ -121,3 +125,4 @@ int main(int argc, char* argv[])
#endif #endif
// *INDENT-ON* // *INDENT-ON*
} }

View File

@ -196,7 +196,7 @@ namespace picojson {
if ( if (
#ifdef _MSC_VER #ifdef _MSC_VER
! _finite(n) ! _finite(n)
#elif __cplusplus>=201103L || !(defined(isnan) && defined(isinf)) #elif (__cplusplus>=201103L || !(defined(isnan) && defined(isinf))) && !defined(__CLIB2__)
std::isnan(n) || std::isinf(n) std::isnan(n) || std::isinf(n)
#else #else
isnan(n) || isinf(n) isnan(n) || isinf(n)
@ -1008,3 +1008,4 @@ inline std::ostream& operator<<(std::ostream& os, const picojson::value& x)
#endif #endif
#endif #endif

View File

@ -1757,3 +1757,4 @@ bool CppCheck::isUnusedFunctionCheckEnabled() const
{ {
return (mSettings.jobs == 1 && mSettings.checks.isEnabled(Checks::unusedFunction)); return (mSettings.jobs == 1 && mSettings.checks.isEnabled(Checks::unusedFunction));
} }

View File

@ -73,11 +73,18 @@ std::string MathLib::value::str() const
{ {
std::ostringstream ostr; std::ostringstream ostr;
if (mType == MathLib::value::Type::FLOAT) { if (mType == MathLib::value::Type::FLOAT) {
#if defined(__amigaos4__) && defined(__CLIB2__)
if (isnan(mDoubleValue))
return "nan.0";
if (isinf(mDoubleValue))
return (mDoubleValue > 0) ? "inf.0" : "-inf.0";
#else
if (std::isnan(mDoubleValue)) if (std::isnan(mDoubleValue))
return "nan.0"; return "nan.0";
if (std::isinf(mDoubleValue)) if (std::isinf(mDoubleValue))
return (mDoubleValue > 0) ? "inf.0" : "-inf.0"; return (mDoubleValue > 0) ? "inf.0" : "-inf.0";
#endif
ostr.precision(9); ostr.precision(9);
ostr << std::fixed << mDoubleValue; ostr << std::fixed << mDoubleValue;
@ -1298,3 +1305,4 @@ MathLib::value operator>>(const MathLib::value &v1, const MathLib::value &v2)
{ {
return v1.shiftRight(v2); return v1.shiftRight(v2);
} }

View File

@ -23,9 +23,9 @@
#include "config.h" #include "config.h"
#if defined(__amigaos4__) #if defined(__amigaos4__) && !defined(__CLIB2__)
#define stricmp strcasecmp #define stricmp strcasecmp
#endif #endif /* amigaos4 */
#include <climits> #include <climits>
#include <string> #include <string>