@@ -80,13 +80,16 @@ class SuppressStdout
8080{
8181#ifndef _WIN32
8282 public:
83- SuppressStdout ()
83+ SuppressStdout (utl::Logger* logger )
8484 {
8585 // This is a hack to suppress excessive logs from ABC
8686 // Redirects stdout to /dev/null, preserves original stdout
8787 fflush (stdout);
8888 saved_stdout_fd = dup (1 );
89- int dev_null_fd = open (" /dev/null" , O_WRONLY);
89+ const int dev_null_fd = open (" /dev/null" , O_WRONLY);
90+ if (dev_null_fd < 0 ) {
91+ logger->error (utl::RMP, 58 , " Can't open /dev/null" );
92+ }
9093 dup2 (dev_null_fd, 1 );
9194 close (dev_null_fd);
9295 }
@@ -221,7 +224,7 @@ void AnnealingStrategy::OptimizeDesign(sta::dbSta* sta,
221224 // &false
222225 debugPrint (
223226 logger, RMP, " annealing" , 1 , " Starting false path elimination" );
224- SuppressStdout nostdout;
227+ SuppressStdout nostdout (logger) ;
225228 replaceGia (gia, Gia_ManCheckFalse (gia, 0 , 0 , false , false ));
226229 },
227230
@@ -480,7 +483,7 @@ void AnnealingStrategy::OptimizeDesign(sta::dbSta* sta,
480483 worst_slack_new);
481484 }
482485
483- ops = new_ops;
486+ ops = std::move ( new_ops) ;
484487 worst_slack = worst_slack_new;
485488
486489 if (worst_slack > best_worst_slack) {
@@ -634,7 +637,7 @@ void AnnealingStrategy::RunGia(
634637 }
635638
636639 {
637- SuppressStdout nostdout;
640+ SuppressStdout nostdout (logger) ;
638641 current_network = WrapUnique (abc::Abc_NtkMap (current_network.get (),
639642 nullptr ,
640643 /* DelayTarget=*/ 1.0 ,
@@ -658,7 +661,7 @@ void AnnealingStrategy::RunGia(
658661
659662 if (resize_iters > 0 ) {
660663 // All the magic numbers are defaults from abc/src/base/abci/abc.c
661- SuppressStdout nostdout;
664+ SuppressStdout nostdout (logger) ;
662665 abc::SC_SizePars pars = {};
663666 pars.nIters = resize_iters;
664667 pars.nIterNoChange = 50 ;
0 commit comments