Implement a single nbErrors counter inside generic diagnostic code

This commit is contained in:
Rangi42
2025-07-26 12:48:25 -04:00
parent ac632d9223
commit 92acb6e547
10 changed files with 61 additions and 81 deletions

View File

@@ -25,7 +25,7 @@ struct Options {
bool generatePhonyDeps = false; // -MP
std::string objectFileName; // -o
uint8_t padByte = 0; // -p
unsigned int maxErrors = 0; // -X
uint64_t maxErrors = 0; // -X
~Options() {
if (dependFile) {

View File

@@ -80,7 +80,6 @@ void error(char const *fmt, ...);
// once.
void error(std::function<void()> callback);
void forceError();
void requireZeroErrors();
#endif // RGBDS_ASM_WARNING_HPP

View File

@@ -59,6 +59,13 @@ struct Diagnostics {
std::vector<WarningFlag<L>> warningFlags;
std::vector<ParamWarning<W>> paramWarnings;
DiagnosticsState<W> state;
uint64_t nbErrors;
void incrementErrors() {
if (nbErrors != UINT64_MAX) {
++nbErrors;
}
}
WarningBehavior getWarningBehavior(W id) const;
std::string processWarningFlag(char const *flag);

View File

@@ -36,8 +36,6 @@ void error(char const *fmt, ...);
[[gnu::format(printf, 1, 2)]]
void fatal(char const *fmt, ...);
void resetErrors();
bool anyErrors();
uint32_t checkErrors(char const *filename);
#endif // RGBDS_FIX_WARNING_HPP