mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-09-22 10:43:39 -04:00
error: Style liftup
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
66
asm/error.c
66
asm/error.c
@@ -47,38 +47,40 @@
|
|||||||
* the [warning] directive.
|
* the [warning] directive.
|
||||||
*/
|
*/
|
||||||
const struct warning warnings[ERR_WARN_ALL+1] = {
|
const struct warning warnings[ERR_WARN_ALL+1] = {
|
||||||
{"other", "any warning not specifially mentioned below", true},
|
{ "other", "any warning not specifially mentioned below", true },
|
||||||
{"macro-params", "macro calls with wrong parameter count", true},
|
{ "macro-params", "macro calls with wrong parameter count", true },
|
||||||
{"macro-selfref", "cyclic macro references", false},
|
{ "macro-selfref", "cyclic macro references", false },
|
||||||
{"macro-defaults", "macros with more default than optional parameters", true},
|
{ "macro-defaults", "macros with more default than optional parameters", true },
|
||||||
{"orphan-labels", "labels alone on lines without trailing `:'", true},
|
{ "orphan-labels", "labels alone on lines without trailing `:'", true },
|
||||||
{"number-overflow", "numeric constant does not fit", true},
|
{ "number-overflow", "numeric constant does not fit", true },
|
||||||
{"gnu-elf-extensions", "using 8- or 16-bit relocation in ELF32, a GNU extension", false},
|
{ "gnu-elf-extensions", "using 8- or 16-bit relocation in ELF32, a GNU extension", false },
|
||||||
{"float-overflow", "floating point overflow", true},
|
{ "float-overflow", "floating point overflow", true },
|
||||||
{"float-denorm", "floating point denormal", false},
|
{ "float-denorm", "floating point denormal", false },
|
||||||
{"float-underflow", "floating point underflow", false},
|
{ "float-underflow", "floating point underflow", false },
|
||||||
{"float-toolong", "too many digits in floating-point number", true},
|
{ "float-toolong", "too many digits in floating-point number", true },
|
||||||
{"user", "%warning directives", true},
|
{ "user", "%warning directives", true },
|
||||||
{"lock", "lock prefix on unlockable instructions", true},
|
{ "lock", "lock prefix on unlockable instructions", true },
|
||||||
{"hle", "invalid hle prefixes", true},
|
{ "hle", "invalid hle prefixes", true },
|
||||||
{"bnd", "invalid bnd prefixes", true},
|
{ "bnd", "invalid bnd prefixes", true },
|
||||||
{"zext-reloc", "relocation zero-extended to match output format", true},
|
{ "zext-reloc", "relocation zero-extended to match output format", true },
|
||||||
{"ptr", "non-NASM keyword used in other assemblers", true},
|
{ "ptr", "non-NASM keyword used in other assemblers", true },
|
||||||
{"bad-pragma", "empty or malformed %pragma", false},
|
{ "bad-pragma", "empty or malformed %pragma", false },
|
||||||
{"unknown-pragma", "unknown %pragma facility or directive", false},
|
{ "unknown-pragma", "unknown %pragma facility or directive", false },
|
||||||
{"not-my-pragma", "%pragma not applicable to this compilation", false},
|
{ "not-my-pragma", "%pragma not applicable to this compilation", false },
|
||||||
{"unknown-warning", "unknown warning in -W/-w or warning directive", false},
|
{ "unknown-warning", "unknown warning in -W/-w or warning directive", false },
|
||||||
{"negative-rep", "regative %rep count", true},
|
{ "negative-rep", "regative %rep count", true },
|
||||||
{"phase", "phase error during stabilization", false},
|
{ "phase", "phase error during stabilization", false },
|
||||||
|
|
||||||
/* THIS ENTRY MUST COME LAST */
|
/* THIS ENTRY MUST COME LAST */
|
||||||
{"all", "all possible warnings", false}
|
{ "all", "all possible warnings", false }
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t warning_state[ERR_WARN_ALL];/* Current state */
|
/* Current state and command-line state, for reset */
|
||||||
uint8_t warning_state_init[ERR_WARN_ALL]; /* Command-line state, for reset */
|
uint8_t warning_state[ERR_WARN_ALL];
|
||||||
|
uint8_t warning_state_init[ERR_WARN_ALL];
|
||||||
|
|
||||||
vefunc nasm_verror; /* Global error handling function */
|
/* Global error handling function */
|
||||||
|
vefunc nasm_verror;
|
||||||
|
|
||||||
void nasm_error(int severity, const char *fmt, ...)
|
void nasm_error(int severity, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
@@ -95,7 +97,7 @@ fatal_func nasm_fatal(const char *fmt, ...)
|
|||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
nasm_verror(ERR_FATAL, fmt, ap);
|
nasm_verror(ERR_FATAL, fmt, ap);
|
||||||
abort(); /* We should never get here */
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_func nasm_fatal_fl(int flags, const char *fmt, ...)
|
fatal_func nasm_fatal_fl(int flags, const char *fmt, ...)
|
||||||
@@ -104,7 +106,7 @@ fatal_func nasm_fatal_fl(int flags, const char *fmt, ...)
|
|||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
nasm_verror(flags | ERR_FATAL, fmt, ap);
|
nasm_verror(flags | ERR_FATAL, fmt, ap);
|
||||||
abort(); /* We should never get here */
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_func nasm_panic(const char *fmt, ...)
|
fatal_func nasm_panic(const char *fmt, ...)
|
||||||
@@ -113,7 +115,7 @@ fatal_func nasm_panic(const char *fmt, ...)
|
|||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
nasm_verror(ERR_PANIC, fmt, ap);
|
nasm_verror(ERR_PANIC, fmt, ap);
|
||||||
abort(); /* We should never get here */
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_func nasm_panic_fl(int flags, const char *fmt, ...)
|
fatal_func nasm_panic_fl(int flags, const char *fmt, ...)
|
||||||
@@ -122,7 +124,7 @@ fatal_func nasm_panic_fl(int flags, const char *fmt, ...)
|
|||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
nasm_verror(flags | ERR_PANIC, fmt, ap);
|
nasm_verror(flags | ERR_PANIC, fmt, ap);
|
||||||
abort(); /* We should never get here */
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_func nasm_panic_from_macro(const char *file, int line)
|
fatal_func nasm_panic_from_macro(const char *file, int line)
|
||||||
@@ -143,9 +145,9 @@ bool set_warning_status(const char *value)
|
|||||||
{
|
{
|
||||||
enum warn_action { WID_OFF, WID_ON, WID_RESET };
|
enum warn_action { WID_OFF, WID_ON, WID_RESET };
|
||||||
enum warn_action action;
|
enum warn_action action;
|
||||||
|
bool ok = false;
|
||||||
uint8_t mask;
|
uint8_t mask;
|
||||||
int i;
|
int i;
|
||||||
bool ok = false;
|
|
||||||
|
|
||||||
value = nasm_skip_spaces(value);
|
value = nasm_skip_spaces(value);
|
||||||
switch (*value) {
|
switch (*value) {
|
||||||
|
@@ -53,6 +53,7 @@ fatal_func nasm_panic_from_macro(const char *file, int line);
|
|||||||
|
|
||||||
typedef void (*vefunc) (int severity, const char *fmt, va_list ap);
|
typedef void (*vefunc) (int severity, const char *fmt, va_list ap);
|
||||||
extern vefunc nasm_verror;
|
extern vefunc nasm_verror;
|
||||||
|
|
||||||
static inline vefunc nasm_set_verror(vefunc ve)
|
static inline vefunc nasm_set_verror(vefunc ve)
|
||||||
{
|
{
|
||||||
vefunc old_verror = nasm_verror;
|
vefunc old_verror = nasm_verror;
|
||||||
@@ -135,6 +136,6 @@ extern uint8_t warning_state[ERR_WARN_ALL];
|
|||||||
extern uint8_t warning_state_init[ERR_WARN_ALL];
|
extern uint8_t warning_state_init[ERR_WARN_ALL];
|
||||||
|
|
||||||
/* Process a warning option or directive */
|
/* Process a warning option or directive */
|
||||||
bool set_warning_status(const char *);
|
bool set_warning_status(const char *value);
|
||||||
|
|
||||||
#endif /* NASM_ERROR_H */
|
#endif /* NASM_ERROR_H */
|
||||||
|
Reference in New Issue
Block a user