Skip to content

Commit dd9627e

Browse files
authored
Merge pull request #5336 from rocallahan/remove-log-cstr
Remove `.c_str()` calls from `log()`/`log_error()`
2 parents 6d8dfb0 + e0ae7b7 commit dd9627e

File tree

140 files changed

+623
-623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+623
-623
lines changed

backends/aiger/aiger.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ struct AigerBackend : public Backend {
10401040
std::ofstream mapf;
10411041
mapf.open(map_filename.c_str(), std::ofstream::trunc);
10421042
if (mapf.fail())
1043-
log_error("Can't open file `%s' for writing: %s\n", map_filename.c_str(), strerror(errno));
1043+
log_error("Can't open file `%s' for writing: %s\n", map_filename, strerror(errno));
10441044
writer.write_map(mapf, verbose_map, no_startoffset);
10451045
}
10461046

@@ -1051,7 +1051,7 @@ struct AigerBackend : public Backend {
10511051
PrettyJson json;
10521052

10531053
if (!json.write_to_file(yw_map_filename))
1054-
log_error("Can't open file `%s' for writing: %s\n", yw_map_filename.c_str(), strerror(errno));
1054+
log_error("Can't open file `%s' for writing: %s\n", yw_map_filename, strerror(errno));
10551055
writer.write_ywmap(json);
10561056
}
10571057
}

backends/aiger/xaiger.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ struct XAigerBackend : public Backend {
788788
std::ofstream mapf;
789789
mapf.open(map_filename.c_str(), std::ofstream::trunc);
790790
if (mapf.fail())
791-
log_error("Can't open file `%s' for writing: %s\n", map_filename.c_str(), strerror(errno));
791+
log_error("Can't open file `%s' for writing: %s\n", map_filename, strerror(errno));
792792
writer.write_map(mapf);
793793
}
794794
}

backends/blif/blif.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ struct BlifBackend : public Backend {
674674
}
675675

676676
if (!top_module_name.empty())
677-
log_error("Can't find top module `%s'!\n", top_module_name.c_str());
677+
log_error("Can't find top module `%s'!\n", top_module_name);
678678

679679
for (auto module : mod_list)
680680
BlifDumper::dump(*f, module, design, config);

backends/btor/btor.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ struct BtorWorker
246246
string cell_list;
247247
for (auto c : cell_recursion_guard)
248248
cell_list += stringf("\n %s", log_id(c));
249-
log_error("Found topological loop while processing cell %s. Active cells:%s\n", log_id(cell), cell_list.c_str());
249+
log_error("Found topological loop while processing cell %s. Active cells:%s\n", log_id(cell), cell_list);
250250
}
251251

252252
cell_recursion_guard.insert(cell);
@@ -1489,7 +1489,7 @@ struct BtorWorker
14891489
std::ofstream f;
14901490
f.open(info_filename.c_str(), std::ofstream::trunc);
14911491
if (f.fail())
1492-
log_error("Can't open file `%s' for writing: %s\n", info_filename.c_str(), strerror(errno));
1492+
log_error("Can't open file `%s' for writing: %s\n", info_filename, strerror(errno));
14931493
for (auto &it : info_lines)
14941494
f << it;
14951495
f.close();

backends/edif/edif.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ struct EdifBackend : public Backend {
519519
continue;
520520
} else {
521521
for (auto &ref : it.second)
522-
log_error("Don't know how to handle %s on %s.\n", log_signal(sig), ref.first.c_str());
522+
log_error("Don't know how to handle %s on %s.\n", log_signal(sig), ref.first);
523523
log_abort();
524524
}
525525
}

backends/firrtl/firrtl.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ void emit_elaborated_extmodules(RTLIL::Design *design, std::ostream &f)
347347
auto modInstance = design->module(cell->type);
348348
// Ensure that we actually have a module instance
349349
if (modInstance == nullptr) {
350-
log_error("Unknown cell type %s\n", cell->type.c_str());
350+
log_error("Unknown cell type %s\n", cell->type);
351351
return;
352352
}
353353

@@ -505,14 +505,14 @@ struct FirrtlWorker
505505
sinkExpr = firstName;
506506
break;
507507
default:
508-
log_error("Instance port %s.%s unrecognized connection direction 0x%x !\n", cell_type.c_str(), log_signal(it->second), dir);
508+
log_error("Instance port %s.%s unrecognized connection direction 0x%x !\n", cell_type, log_signal(it->second), dir);
509509
break;
510510
}
511511
// Check for subfield assignment.
512512
std::string bitsString = "bits(";
513513
if (sinkExpr.compare(0, bitsString.length(), bitsString) == 0) {
514514
if (sinkSig == nullptr)
515-
log_error("Unknown subfield %s.%s\n", cell_type.c_str(), sinkExpr.c_str());
515+
log_error("Unknown subfield %s.%s\n", cell_type, sinkExpr);
516516
// Don't generate the assignment here.
517517
// Add the source and sink to the "reverse_wire_map" and we'll output the assignment
518518
// as part of the coalesced subfield assignments for this wire.

backends/functional/cxx.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ struct FunctionalCxxBackend : public Backend
268268
extra_args(f, filename, args, argidx, design);
269269

270270
for (auto module : design->selected_modules()) {
271-
log("Dumping module `%s'.\n", module->name.c_str());
271+
log("Dumping module `%s'.\n", module->name);
272272
printCxx(*f, filename, module);
273273
}
274274
}

backends/functional/smtlib.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ struct FunctionalSmtBackend : public Backend {
285285
extra_args(f, filename, args, argidx, design);
286286

287287
for (auto module : design->selected_modules()) {
288-
log("Processing module `%s`.\n", module->name.c_str());
288+
log("Processing module `%s`.\n", module->name);
289289
SmtModule smt(module);
290290
smt.write(*f);
291291
}

backends/functional/smtlib_rosette.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ struct FunctionalSmtrBackend : public Backend {
307307
}
308308

309309
for (auto module : design->selected_modules()) {
310-
log("Processing module `%s`.\n", module->name.c_str());
310+
log("Processing module `%s`.\n", module->name);
311311
SmtrModule smtr(module);
312312
smtr.write(*f);
313313
}

backends/functional/test_generic.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ struct FunctionalTestGeneric : public Pass
143143
*/
144144

145145
for (auto module : design->selected_modules()) {
146-
log("Dumping module `%s'.\n", module->name.c_str());
146+
log("Dumping module `%s'.\n", module->name);
147147
auto fir = Functional::IR::from_module(module);
148148
for(auto node : fir)
149149
std::cout << RTLIL::unescape_id(node.name()) << " = " << node.to_string([](auto n) { return RTLIL::unescape_id(n.name()); }) << "\n";

0 commit comments

Comments
 (0)