ref: daf780c7e6519314b28efae67013017b90835cd7
parent: 613305d2349e8249f843176232d172b874180000
author: Antonio Niño Díaz <[email protected]>
date: Tue Aug 4 18:28:56 EDT 2020
Refactor warning array for clarity
--- a/include/asm/warning.h
+++ b/include/asm/warning.h
@@ -14,18 +14,19 @@
extern unsigned int nbErrors;
enum WarningID {
- WARNING_ASSERT,
- WARNING_BUILTIN_ARG,
- WARNING_DIV,
+ WARNING_ASSERT, /* Assertions */
+ WARNING_BUILTIN_ARG, /* Invalid args to builtins */
+ WARNING_DIV, /* Division undefined behavior */
WARNING_EMPTY_DATA_DIRECTIVE,
- WARNING_EMPTY_ENTRY,
- WARNING_LARGE_CONSTANT,
- WARNING_LONG_STR,
- WARNING_OBSOLETE,
- WARNING_SHIFT,
- WARNING_SHIFT_AMOUNT,
- WARNING_TRUNCATION,
- WARNING_USER,
+ /* `db`, `dw` or `dl` with no directive in ROM */
+ WARNING_EMPTY_ENTRY, /* Empty entry in `db`, `dw` or `dl` */
+ WARNING_LARGE_CONSTANT, /* Constants too large */
+ WARNING_LONG_STR, /* String too long for internal buffers */
+ WARNING_OBSOLETE, /* Obsolete things */
+ WARNING_SHIFT, /* Shifting undefined behavior */
+ WARNING_SHIFT_AMOUNT, /* Strange shift amount */
+ WARNING_TRUNCATION, /* Implicit truncation loses some bits */
+ WARNING_USER, /* User warnings */
NB_WARNINGS,
--- a/src/asm/warning.c
+++ b/src/asm/warning.c
@@ -28,18 +28,18 @@
};
static enum WarningState const defaultWarnings[NB_WARNINGS] = {
- WARNING_ENABLED, /* Assertions */
- WARNING_DISABLED, /* Invalid args to builtins */
- WARNING_DISABLED, /* Division undefined behavior */
- WARNING_DISABLED, /* `db`, `dw`, or `dl` with no directive in ROM */
- WARNING_DISABLED, /* Empty entry in `db`, `dw` or `dl` */
- WARNING_DISABLED, /* Constants too large */
- WARNING_DISABLED, /* String too long for internal buffers */
- WARNING_ENABLED, /* Obsolete things */
- WARNING_DISABLED, /* Shifting undefined behavior */
- WARNING_DISABLED, /* Strange shift amount */
- WARNING_ENABLED, /* Implicit truncation loses some bits */
- WARNING_ENABLED, /* User warnings */
+ [WARNING_ASSERT] = WARNING_ENABLED,
+ [WARNING_BUILTIN_ARG] = WARNING_DISABLED,
+ [WARNING_DIV] = WARNING_DISABLED,
+ [WARNING_EMPTY_DATA_DIRECTIVE] = WARNING_DISABLED,
+ [WARNING_EMPTY_ENTRY] = WARNING_DISABLED,
+ [WARNING_LARGE_CONSTANT] = WARNING_DISABLED,
+ [WARNING_LONG_STR] = WARNING_DISABLED,
+ [WARNING_OBSOLETE] = WARNING_ENABLED,
+ [WARNING_SHIFT] = WARNING_DISABLED,
+ [WARNING_SHIFT_AMOUNT] = WARNING_DISABLED,
+ [WARNING_TRUNCATION] = WARNING_ENABLED,
+ [WARNING_USER] = WARNING_ENABLED,
};
static enum WarningState warningStates[NB_WARNINGS];