Skip to content

Commit

Permalink
Fixed code style
Browse files Browse the repository at this point in the history
  • Loading branch information
dmatousek committed Oct 6, 2023
1 parent 116b54d commit a98a24e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions frontends/common/parser_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ ParserOptions::ParserOptions() : Util::Options(defaultMessage) {
"--Winfo", "diagnostic",
[](const char *diagnostic) {
if (diagnostic) {
P4CContext::get().setDiagnosticAction(diagnostic,
DiagnosticAction::Info);
P4CContext::get().setDiagnosticAction(diagnostic, DiagnosticAction::Info);
}
return true;
},
Expand Down
14 changes: 7 additions & 7 deletions lib/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,26 +150,26 @@ void warning(const int kind, const char *format, Args... args) {
}

/// Report info messages of type kind. Requires that the node argument have source info.
template<class T,
typename = typename std::enable_if<std::is_base_of<Util::IHasSourceInfo, T>::value>::type,
class... Args>
template <class T,
typename = typename std::enable_if<std::is_base_of<Util::IHasSourceInfo, T>::value>::type,
class... Args>
void info(const int kind, const char *format, const T *node, Args... args) {
auto &context = BaseCompileContext::get();
auto action = context.getDefaultInfoDiagnosticAction();
context.errorReporter().diagnose(action, kind, format, "", node, args...);
}

/// The const ref variant of the above
template<class T,
typename = typename std::enable_if<std::is_base_of<Util::IHasSourceInfo, T>::value>::type,
class... Args>
template <class T,
typename = typename std::enable_if<std::is_base_of<Util::IHasSourceInfo, T>::value>::type,
class... Args>
void info(const int kind, const char *format, const T &node, Args... args) {
::info(kind, format, &node, std::forward<Args>(args)...);
}

/// Report info messages of type kind, for messages that do not have a node.
/// These will not be filtered
template<typename... Args>
template <typename... Args>
void info(const int kind, const char *format, Args... args) {
auto &context = BaseCompileContext::get();
auto action = context.getDefaultInfoDiagnosticAction();
Expand Down
2 changes: 1 addition & 1 deletion lib/error_catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ std::map<int, cstring> ErrorCatalog::errorCatalog = {
{ErrorType::WARN_ENTRIES_OUT_OF_ORDER, "entries_out_of_priority_order"},

// Info messages
{ ErrorType::INFO_INFERRED, "inferred" }};
{ErrorType::INFO_INFERRED, "inferred"}};
2 changes: 1 addition & 1 deletion lib/error_catalog.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class ErrorType {

// -------- Info messages -------------
// info messages as initially defined with a format string
static const int INFO_INFERRED; // information inferred by compiler
static const int INFO_INFERRED; // information inferred by compiler

static const int INFO_MAX_INFOS;
};
Expand Down
2 changes: 1 addition & 1 deletion lib/error_reporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ enum class DiagnosticAction {
class ErrorReporter {
protected:
unsigned int infoCount;
unsigned int errorCount;
unsigned int warningCount;
unsigned int errorCount;
unsigned int maxErrorCount; /// the maximum number of errors that we print before fail

std::ostream *outputstream;
Expand Down

0 comments on commit a98a24e

Please sign in to comment.