/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2023 Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "cppcheckexecutor.h"
#include "analyzerinfo.h"
#include "cmdlineparser.h"
#include "color.h"
#include "config.h"
#include "cppcheck.h"
#include "errortypes.h"
#include "filelister.h"
#include "importproject.h"
#include "library.h"
#include "path.h"
#include "pathmatch.h"
#include "settings.h"
#include "singleexecutor.h"
#include "suppressions.h"
#include "utils.h"
#include "checkunusedfunctions.h"
#if defined(THREADING_MODEL_THREAD)
#include "threadexecutor.h"
#elif defined(THREADING_MODEL_FORK)
#include "processexecutor.h"
#endif
#include
#include
#include // EXIT_SUCCESS and EXIT_FAILURE
#include
#include
#include
#include
#include
#include // IWYU pragma: keep
#include
#include
#ifdef USE_UNIX_SIGNAL_HANDLING
#include "cppcheckexecutorsig.h"
#endif
#ifdef USE_WINDOWS_SEH
#include "cppcheckexecutorseh.h"
#endif
#ifdef _WIN32
#include
#endif
/*static*/ FILE* CppCheckExecutor::mExceptionOutput = stdout;
CppCheckExecutor::CppCheckExecutor()
: mSettings(nullptr), mLatestProgressOutputTime(0), mErrorOutput(nullptr), mShowAllErrors(false)
{}
CppCheckExecutor::~CppCheckExecutor()
{
delete mErrorOutput;
}
bool CppCheckExecutor::parseFromArgs(Settings &settings, int argc, const char* const argv[])
{
CmdLineParser parser(settings, settings.nomsg, settings.nofail);
const bool success = parser.parseFromArgs(argc, argv);
if (success) {
if (parser.getShowVersion() && !parser.getShowErrorMessages()) {
if (!settings.cppcheckCfgProductName.empty()) {
std::cout