Skip to content

Commit 7b16fdb

Browse files
committed
remove assert is_open
1 parent 09fccf9 commit 7b16fdb

File tree

6 files changed

+0
-15
lines changed

6 files changed

+0
-15
lines changed

gui/checkthread.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ static bool executeCommand(std::string exe, std::vector<std::string> args, std::
7979
std::ofstream fout();
8080
fout.exceptions(std::ios_base::failbit | std::ios_base::badbit);
8181
fout.open(redirect.substr(3));
82-
assert(fout.is_open()); // If we ever disable exceptions, catch issues ASAP
8382
fout << process.readAllStandardError().toStdString();
8483
}
8584
return process.exitCode() == 0;

lib/analyzerinfo.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ void AnalyzerInformation::writeFilesTxt(const std::string &buildDir, const std::
6767
std::ofstream fout;
6868
fout.exceptions(std::ios_base::failbit | std::ios_base::badbit);
6969
fout.open(filesTxt);
70-
assert(fout.is_open()); // If we ever disable exceptions, catch issues ASAP
7170

7271
for (const std::string &f : sourcefiles) {
7372
const std::string afile = getFilename(f);
@@ -157,7 +156,6 @@ bool AnalyzerInformation::analyzeFile(const std::string &buildDir, const std::st
157156
return false;
158157

159158
mOutputStream.open(mAnalyzerInfoFile);
160-
assert(mOutputStream.is_open()); // If we ever disable exceptions on mOutputStream, catch issues ASAP
161159

162160
mOutputStream << "<?xml version=\"1.0\"?>\n";
163161
mOutputStream << "<analyzerinfo hash=\"" << hash << "\">\n";

lib/cppcheck.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ static void createDumpFile(const Settings& settings,
276276
dumpFile = getDumpFileName(settings, filename);
277277

278278
fdump.open(dumpFile);
279-
assert(fdump.is_open()); // If we ever disable exceptions, catch issues ASAP
280279

281280
// TODO: Technically, exceptions are allowed on the file so this is always false,
282281
// TODO: but the function is not aware of that as this function is not the owner of the file
@@ -287,7 +286,6 @@ static void createDumpFile(const Settings& settings,
287286
std::ofstream fout;
288287
fout.exceptions(std::ios_base::failbit | std::ios_base::badbit);
289288
fout.open(getCtuInfoFileName(dumpFile));
290-
assert(fout.is_open()); // If we ever disable exceptions, catch issues ASAP
291289
}
292290

293291
std::string language;
@@ -526,7 +524,6 @@ unsigned int CppCheck::check(const std::string &path)
526524
std::ofstream fout;
527525
fout.exceptions(std::ios_base::failbit | std::ios_base::badbit);
528526
fout.open(clangcmd);
529-
assert(fout.is_open()); // If we ever disable exceptions, catch issues ASAP
530527
fout << exe << " " << args2 << " " << redirect2 << std::endl;
531528
} else if (mSettings.verbose && !mSettings.quiet) {
532529
mErrorLogger.reportOut(exe + " " + args2);
@@ -560,7 +557,6 @@ unsigned int CppCheck::check(const std::string &path)
560557
std::ofstream fout;
561558
fout.exceptions(std::ios_base::failbit | std::ios_base::badbit);
562559
fout.open(clangAst);
563-
assert(fout.is_open()); // If we ever disable exceptions, catch issues ASAP
564560
fout << output2 << std::endl;
565561
}
566562

@@ -746,7 +742,6 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
746742
const std::size_t fileNameHash = std::hash<std::string> {}(filename);
747743
filename2 = mSettings.plistOutput + filename2.substr(0, filename2.find('.')) + "_" + std::to_string(fileNameHash) + ".plist";
748744
mPlistFile.open(filename2);
749-
assert(mPlistFile.is_open()); // If we ever disable exceptions, catch issues ASAP
750745

751746
mPlistFile << ErrorLogger::plistHeader(version(), files);
752747
}
@@ -1455,7 +1450,6 @@ void CppCheck::executeAddons(const std::vector<std::string>& files)
14551450
std::ofstream fout;
14561451
fout.exceptions(std::ios_base::failbit | std::ios_base::badbit);
14571452
fout.open(fileList);
1458-
assert(fout.is_open()); // If we ever disable exceptions, catch issues ASAP
14591453

14601454
for (const std::string& f: files)
14611455
fout << f << std::endl;
@@ -1719,7 +1713,6 @@ void CppCheck::analyseClangTidy(const ImportProject::FileSettings &fileSettings)
17191713
std::ofstream fcmd;
17201714
fcmd.exceptions(std::ios_base::failbit | std::ios_base::badbit);
17211715
fcmd.open(analyzerInfoFile + ".clang-tidy-cmd");
1722-
assert(fcmd.is_open()); // If we ever disable exceptions, catch issues ASAP
17231716

17241717
fcmd << istr.str();
17251718
}

lib/summaries.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ std::string Summaries::create(const Tokenizer *tokenizer, const std::string &cfg
8989
std::ofstream fout;
9090
fout.exceptions(std::ios_base::failbit | std::ios_base::badbit);
9191
fout.open(filename);
92-
assert(fout.is_open()); // If we ever disable exceptions, catch issues ASAP
9392

9493
fout << ostr.str();
9594
}

test/helpers.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ ScopedFile::ScopedFile(std::string name, const std::string &content, std::string
5757
std::ofstream of;
5858
of.exceptions(std::ios_base::failbit | std::ios_base::badbit);
5959
of.open(mFullPath);
60-
assert(of.is_open()); // If we ever disable exceptions, catch issues ASAP
6160

6261
of << content;
6362
}

tools/dmake.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ static int write_vcxproj(const std::string &proj_name, const std::function<void(
219219
out.exceptions(std::ios_base::failbit | std::ios_base::badbit);
220220
// treat as binary to prevent implicit line ending conversions
221221
out.open(proj_name, std::ios::binary|std::ios::trunc);
222-
assert(out.is_open()); // If we ever disable exceptions, catch issues ASAP
223222

224223
out << outstr;
225224

@@ -402,7 +401,6 @@ int main(int argc, char **argv)
402401
std::ofstream fout1;
403402
fout1.exceptions(std::ios_base::failbit | std::ios_base::badbit);
404403
fout1.open("lib/lib.pri");
405-
assert(fout1.is_open()); // If we ever disable exceptions, catch issues ASAP
406404

407405
fout1 << "# no manual edits - this file is autogenerated by dmake\n\n";
408406
fout1 << "include($$PWD/pcrerules.pri)\n";
@@ -427,7 +425,6 @@ int main(int argc, char **argv)
427425
std::ofstream fout;
428426
fout.exceptions(std::ios_base::failbit | std::ios_base::badbit);
429427
fout.open(makefile, std::ios_base::trunc);
430-
assert(fout.is_open()); // If we ever disable exceptions, catch issues ASAP
431428

432429
fout << "# This file is generated by tools/dmake, do not edit.\n\n";
433430

0 commit comments

Comments
 (0)