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;
|
||||
bool Preprocessor::missingSystemIncludeFlag;
|
||||
std::atomic<bool> Preprocessor::missingIncludeFlag;
|
||||
std::atomic<bool> Preprocessor::missingSystemIncludeFlag;
|
||||
|
||||
char Preprocessor::macroChar = char(1);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <simplecpp.h>
|
||||
#include <istream>
|
||||
#include <list>
|
||||
|
@ -84,8 +85,8 @@ public:
|
|||
explicit Preprocessor(Settings& settings, ErrorLogger *errorLogger = nullptr);
|
||||
virtual ~Preprocessor();
|
||||
|
||||
static bool missingIncludeFlag;
|
||||
static bool missingSystemIncludeFlag;
|
||||
static std::atomic<bool> missingIncludeFlag;
|
||||
static std::atomic<bool> missingSystemIncludeFlag;
|
||||
|
||||
void inlineSuppressions(const simplecpp::TokenList &tokens);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "valueflow.h"
|
||||
|
||||
bool Settings::mTerminated;
|
||||
std::atomic<bool> Settings::mTerminated;
|
||||
|
||||
const char Settings::SafeChecks::XmlRootName[] = "safe-checks";
|
||||
const char Settings::SafeChecks::XmlClasses[] = "class-public";
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "suppressions.h"
|
||||
#include "timer.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
@ -65,7 +66,7 @@ private:
|
|||
int mEnabled;
|
||||
|
||||
/** @brief terminate checking */
|
||||
static bool mTerminated;
|
||||
static std::atomic<bool> mTerminated;
|
||||
|
||||
public:
|
||||
Settings();
|
||||
|
|
Loading…
Reference in New Issue