polserver/pol-core/bscript/compiler/Report.cpp
turleypol fb3faddeae
use c++20 (#799)
* use c++20
* increased used clang version
* compiler report and logfacility use now compile time formatting, which
means that the formatstring gets checked at compile time. (which found 2 errors)
adapted a few places since report only accepts formatting arguments
adapted a few places with logging since char[] is compile time
formatting and string or chr* is runtime formatting
* use std::ranges instead of boost
* disabled pragma_assume vs specific macro (I guess noone cares)
* needed to fix ancient ms exception code
* modernized SpinLock
* removed unused code in ECompile
* replaced std::filesystem::path::u8string with string. It now returns an actual u8string type
* cleanup layers.h added the defines for other layers which where before
  only defined in the pkt
* osmod::OpenConnection and HTTPRequest cleanup: early outs, dont check for pChild which is
  only needed for startscript and placed suspend at the very last
  position

* fix warning

* rebuild cache with new compiler version

* define c++ standard for external libs where possible

* added fixme
2025-08-01 21:40:10 +02:00

66 lines
1.2 KiB
C++

#include "Report.h"
#include "bscript/compiler/file/SourceLocation.h"
#include "clib/logfacility.h"
namespace Pol::Bscript::Compiler
{
Report::Report( bool display_warnings, bool display_errors, bool display_debugs )
: display_warnings( display_warnings ),
display_errors( display_errors ),
display_debugs( display_debugs ),
errors( 0 ),
warnings( 0 )
{
}
void Report::report_error( const SourceLocation& source_location, const std::string& msg ) const
{
try
{
ERROR_PRINTLN( "{}: error: {}", source_location, msg );
}
catch ( ... )
{
}
}
void Report::report_warning( const SourceLocation& source_location, const std::string& msg ) const
{
try
{
ERROR_PRINTLN( "{}: warning: {}", source_location, msg );
}
catch ( ... )
{
}
}
void Report::report_debug( const SourceLocation& source_location, const std::string& msg ) const
{
try
{
ERROR_PRINTLN( "{}: debug: {}", source_location, msg );
}
catch ( ... )
{
}
}
unsigned Report::error_count() const
{
return errors;
}
unsigned Report::warning_count() const
{
return warnings;
}
void Report::reset()
{
errors = warnings = 0;
}
} // namespace Pol::Bscript::Compiler