Thread safety: use std::atomic for global flags
This commit is contained in:
parent
7043071daf
commit
2a2fa49098
|
@ -53,8 +53,8 @@ Directive::Directive(const std::string &_file, const int _linenr, const std::str
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Preprocessor::missingIncludeFlag;
|
std::atomic<bool> Preprocessor::missingIncludeFlag;
|
||||||
bool Preprocessor::missingSystemIncludeFlag;
|
std::atomic<bool> Preprocessor::missingSystemIncludeFlag;
|
||||||
|
|
||||||
char Preprocessor::macroChar = char(1);
|
char Preprocessor::macroChar = char(1);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
#include <simplecpp.h>
|
#include <simplecpp.h>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -84,8 +85,8 @@ public:
|
||||||
explicit Preprocessor(Settings& settings, ErrorLogger *errorLogger = nullptr);
|
explicit Preprocessor(Settings& settings, ErrorLogger *errorLogger = nullptr);
|
||||||
virtual ~Preprocessor();
|
virtual ~Preprocessor();
|
||||||
|
|
||||||
static bool missingIncludeFlag;
|
static std::atomic<bool> missingIncludeFlag;
|
||||||
static bool missingSystemIncludeFlag;
|
static std::atomic<bool> missingSystemIncludeFlag;
|
||||||
|
|
||||||
void inlineSuppressions(const simplecpp::TokenList &tokens);
|
void inlineSuppressions(const simplecpp::TokenList &tokens);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "valueflow.h"
|
#include "valueflow.h"
|
||||||
|
|
||||||
bool Settings::mTerminated;
|
std::atomic<bool> Settings::mTerminated;
|
||||||
|
|
||||||
const char Settings::SafeChecks::XmlRootName[] = "safe-checks";
|
const char Settings::SafeChecks::XmlRootName[] = "safe-checks";
|
||||||
const char Settings::SafeChecks::XmlClasses[] = "class-public";
|
const char Settings::SafeChecks::XmlClasses[] = "class-public";
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "suppressions.h"
|
#include "suppressions.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -65,7 +66,7 @@ private:
|
||||||
int mEnabled;
|
int mEnabled;
|
||||||
|
|
||||||
/** @brief terminate checking */
|
/** @brief terminate checking */
|
||||||
static bool mTerminated;
|
static std::atomic<bool> mTerminated;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Settings();
|
Settings();
|
||||||
|
|
Loading…
Reference in New Issue