ref: cb4fbdfcd534e43a5f8504b405acd7b8b29f5001
parent: c6eacde55e909170a8623e5ac9f8ff327db2df37
parent: daf780c7e6519314b28efae67013017b90835cd7
author: Eldred Habert <[email protected]>
date: Wed Aug 5 06:53:21 EDT 2020
Merge pull request #550 from rednex/an/array 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];