Skip to content

Commit

Permalink
This method would have to be out-of-line to work after I made Flags<>…
Browse files Browse the repository at this point in the history
… actually safe
  • Loading branch information
Andersbakken committed Oct 7, 2015
1 parent 06aa568 commit 47cfe40
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/IndexerJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ String IndexerJob::encode() const
std::shared_ptr<Project> proj = Server::instance()->project(project);
const Server::Options &options = Server::instance()->options();
Source copy = source;
if ((options.flag(Server::Weverything) || options.flag(Server::Wall)) && source.arguments.contains("-Werror")) {
if (options.options & (Server::Weverything|Server::Wall) && source.arguments.contains("-Werror")) {
for (const auto &arg : options.defaultArguments) {
if (arg != "-Wall" && arg != "-Weverything")
copy.arguments << arg;
Expand All @@ -74,14 +74,14 @@ String IndexerJob::encode() const
copy.arguments << options.defaultArguments;
}

if (!options.flag(Server::AllowPedantic)) {
if (!(options.options & Server::AllowPedantic)) {
const int idx = copy.arguments.indexOf("-Wpedantic");
if (idx != -1) {
copy.arguments.removeAt(idx);
}
}

if (options.flag(Server::EnableCompilerManager))
if (options.options & Server::EnableCompilerManager)
CompilerManager::applyToSource(copy, false, true);

for (const String &blocked : options.blockedArguments) {
Expand All @@ -108,7 +108,7 @@ String IndexerJob::encode() const
copy.includePaths << inc;
}
copy.defines << options.defines;
if (!(options.flag(Server::EnableNDEBUG))) {
if (!(options.options & Server::EnableNDEBUG)) {
copy.defines.remove(Source::Define("NDEBUG"));
}
assert(!sourceFile.isEmpty());
Expand Down
12 changes: 6 additions & 6 deletions src/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ bool Server::init(const Options &options)
RTags::initMessages();

mOptions = options;
mSuspended = (options.flag(StartSuspended));
if (!(options.flag(NoUnlimitedErrors)))
mSuspended = (options.options & StartSuspended);
if (!(options.options & NoUnlimitedErrors))
mOptions.defaultArguments << "-ferror-limit=0";
if (options.flag(Wall))
if (options.options & Wall)
mOptions.defaultArguments << "-Wall";
if (options.flag(Weverything))
if (options.options & Weverything)
mOptions.defaultArguments << "-Weverything";
if (options.flag(SpellChecking))
if (options.options & SpellChecking)
mOptions.defaultArguments << "-fspell-checking";
if (!(options.flag(NoNoUnknownWarningsOption)))
if (!(options.options & NoNoUnknownWarningsOption))
mOptions.defaultArguments.append("-Wno-unknown-warning-option");

if (mOptions.options & EnableCompilerManager) {
Expand Down
2 changes: 0 additions & 2 deletions src/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ class Server
List<Path> tests;
Set<Path> ignoredCompilers;
List<std::regex> extraCompilers;

inline bool flag(enum Option o) const { return 0 != (options & o); }
};
bool init(const Options &options);
bool runTests();
Expand Down

0 comments on commit 47cfe40

Please sign in to comment.