70
70
#include < unistd.h>
71
71
#endif
72
72
73
- #include < iostream>
74
73
#include < fstream>
75
74
76
75
#if !defined(STDERR_FILENO)
@@ -86,25 +85,18 @@ using namespace solidity::langutil;
86
85
namespace solidity ::frontend
87
86
{
88
87
89
- namespace
88
+ ostream& CommandLineInterface::sout ( bool _markAsUsed)
90
89
{
91
-
92
- static bool g_hasOutput = false ;
93
-
94
- std::ostream& sout (bool _used = true )
95
- {
96
- if (_used)
97
- g_hasOutput = true ;
98
- return cout;
90
+ if (_markAsUsed)
91
+ m_hasOutput = true ;
92
+ return m_sout;
99
93
}
100
94
101
- std:: ostream& serr (bool _used = true )
95
+ ostream& CommandLineInterface:: serr (bool _markAsUsed )
102
96
{
103
- if (_used)
104
- g_hasOutput = true ;
105
- return cerr;
106
- }
107
-
97
+ if (_markAsUsed)
98
+ m_hasOutput = true ;
99
+ return m_serr;
108
100
}
109
101
110
102
#define cout
@@ -497,11 +489,11 @@ void CommandLineInterface::createJson(string const& _fileName, string const& _js
497
489
498
490
bool CommandLineInterface::parseArguments (int _argc, char const * const * _argv)
499
491
{
500
- CommandLineParser parser (sout (false ), serr (false ));
492
+ CommandLineParser parser (sout (/* _markAsUsed */ false ), serr (/* _markAsUsed */ false ));
501
493
bool success = parser.parse (_argc, _argv, isatty (fileno (stdin)));
502
494
if (!success)
503
495
return false ;
504
- g_hasOutput = g_hasOutput || parser.hasOutput ();
496
+ m_hasOutput = m_hasOutput || parser.hasOutput ();
505
497
m_options = parser.options ();
506
498
507
499
return true ;
@@ -626,7 +618,7 @@ bool CommandLineInterface::compile()
626
618
627
619
for (auto const & error: m_compiler->errors ())
628
620
{
629
- g_hasOutput = true ;
621
+ m_hasOutput = true ;
630
622
formatter.printErrorInformation (*error);
631
623
}
632
624
@@ -635,7 +627,7 @@ bool CommandLineInterface::compile()
635
627
}
636
628
catch (CompilerError const & _exception)
637
629
{
638
- g_hasOutput = true ;
630
+ m_hasOutput = true ;
639
631
formatter.printExceptionInformation (_exception, " Compiler error" );
640
632
return false ;
641
633
}
@@ -669,7 +661,7 @@ bool CommandLineInterface::compile()
669
661
serr () << " Documentation parsing error: " << *boost::get_error_info<errinfo_comment>(_error) << endl;
670
662
else
671
663
{
672
- g_hasOutput = true ;
664
+ m_hasOutput = true ;
673
665
formatter.printExceptionInformation (_error, _error.typeName ());
674
666
}
675
667
@@ -985,7 +977,7 @@ bool CommandLineInterface::assemble(
985
977
986
978
for (auto const & error: stack.errors ())
987
979
{
988
- g_hasOutput = true ;
980
+ m_hasOutput = true ;
989
981
formatter.printErrorInformation (*error);
990
982
}
991
983
if (!Error::containsOnlyWarnings (stack.errors ()))
@@ -1134,7 +1126,7 @@ void CommandLineInterface::outputCompilationResults()
1134
1126
handleNatspec (false , contract);
1135
1127
} // end of contracts iteration
1136
1128
1137
- if (!g_hasOutput )
1129
+ if (!m_hasOutput )
1138
1130
{
1139
1131
if (!m_options.output .dir .empty ())
1140
1132
sout () << " Compiler run successful. Artifact(s) can be found in directory " << m_options.output .dir << " ." << endl;
0 commit comments