nasm_warnf() -> nasm_warn()

We want to strongly encourage writers of warnings to create warning
categories, so remove the flagless nasm_warn() and change nasm_warnf()
to nasm_warn().

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2018-12-14 13:33:24 -08:00
parent 727c85263f
commit 80c4f23c52
17 changed files with 106 additions and 98 deletions

View File

@ -293,7 +293,7 @@ static const char *size_name(int size)
static void warn_overflow(int size)
{
nasm_warnf(ERR_PASS2 | WARN_NUMBER_OVERFLOW, "%s data exceeds bounds",
nasm_warn(ERR_PASS2 | WARN_NUMBER_OVERFLOW, "%s data exceeds bounds",
size_name(size));
}
@ -410,7 +410,7 @@ static void out(struct out_data *data)
*! warns that a relocation has been zero-extended due
*! to limitations in the output format.
*/
nasm_warnf(WARN_ZEXT_RELOC,
nasm_warn(WARN_ZEXT_RELOC,
"%u-bit %s relocation zero-extended from %u bits",
(unsigned int)(asize << 3),
data->type == OUT_SEGMENT ? "segment" : "unsigned",
@ -569,7 +569,7 @@ static bool jmp_match(int32_t segment, int64_t offset, int bits,
*! it is legitimate, it may be necessary to use
*! \c{BND JMP DWORD}...
*/
nasm_warnf(WARN_BND | ERR_PASS2 ,
nasm_warn(WARN_BND | ERR_PASS2 ,
"jmp short does not init bnd regs - bnd prefix dropped.");
}
@ -929,14 +929,14 @@ static void bad_hle_warn(const insn * ins, uint8_t hleok)
case w_lock:
if (ins->prefixes[PPS_LOCK] != P_LOCK) {
nasm_warnf(WARN_HLE | ERR_PASS2,
nasm_warn(WARN_HLE | ERR_PASS2,
"%s with this instruction requires lock",
prefix_name(rep_pfx));
}
break;
case w_inval:
nasm_warnf(WARN_HLE | ERR_PASS2,
nasm_warn(WARN_HLE | ERR_PASS2,
"%s invalid with this instruction",
prefix_name(rep_pfx));
break;
@ -1135,7 +1135,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
if (pfx == P_O16)
break;
if (pfx != P_none)
nasm_warnf(ERR_PASS2, "invalid operand size prefix");
nasm_warn(ERR_PASS2, "invalid operand size prefix");
else
ins->prefixes[PPS_OSIZE] = P_O16;
break;
@ -1147,7 +1147,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
if (pfx == P_O32)
break;
if (pfx != P_none)
nasm_warnf(ERR_PASS2, "invalid operand size prefix");
nasm_warn(ERR_PASS2, "invalid operand size prefix");
else
ins->prefixes[PPS_OSIZE] = P_O32;
break;
@ -1205,7 +1205,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
nasm_nonfatal("attempt to reserve non-constant"
" quantity of BSS space");
else if (ins->oprs[0].opflags & OPFLAG_FORWARD)
nasm_warnf(ERR_PASS1, "forward reference in RESx "
nasm_warn(ERR_PASS1, "forward reference in RESx "
"can have unpredictable results");
else
length += ins->oprs[0].offset;
@ -1421,7 +1421,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
*!lock [on] LOCK prefix on unlockable instructions
*! warns about \c{LOCK} prefixes on unlockable instructions.
*/
nasm_warnf(WARN_LOCK | ERR_PASS2 , "instruction is not lockable");
nasm_warn(WARN_LOCK | ERR_PASS2 , "instruction is not lockable");
}
bad_hle_warn(ins, hleok);
@ -1484,19 +1484,19 @@ static int emit_prefix(struct out_data *data, const int bits, insn *ins)
break;
case R_CS:
if (bits == 64)
nasm_warnf(ERR_PASS2, "cs segment base generated, "
nasm_warn(ERR_PASS2, "cs segment base generated, "
"but will be ignored in 64-bit mode");
c = 0x2E;
break;
case R_DS:
if (bits == 64)
nasm_warnf(ERR_PASS2, "ds segment base generated, "
nasm_warn(ERR_PASS2, "ds segment base generated, "
"but will be ignored in 64-bit mode");
c = 0x3E;
break;
case R_ES:
if (bits == 64)
nasm_warnf(ERR_PASS2, "es segment base generated, "
nasm_warn(ERR_PASS2, "es segment base generated, "
"but will be ignored in 64-bit mode");
c = 0x26;
break;
@ -1508,7 +1508,7 @@ static int emit_prefix(struct out_data *data, const int bits, insn *ins)
break;
case R_SS:
if (bits == 64) {
nasm_warnf(ERR_PASS2, "ss segment base generated, "
nasm_warn(ERR_PASS2, "ss segment base generated, "
"but will be ignored in 64-bit mode");
}
c = 0x36;
@ -1697,7 +1697,7 @@ static void gencode(struct out_data *data, insn *ins)
nasm_nonfatal("non-absolute expression not permitted "
"as argument %d", c & 7);
else if (opy->offset & ~mask)
nasm_warnf(ERR_PASS2 | WARN_NUMBER_OVERFLOW,
nasm_warn(ERR_PASS2 | WARN_NUMBER_OVERFLOW,
"is4 argument exceeds bounds");
c = opy->offset & mask;
goto emit_is4;
@ -1719,7 +1719,7 @@ static void gencode(struct out_data *data, insn *ins)
case4(0254):
if (absolute_op(opx) &&
(int32_t)opx->offset != (int64_t)opx->offset) {
nasm_warnf(ERR_PASS2 | WARN_NUMBER_OVERFLOW,
nasm_warn(ERR_PASS2 | WARN_NUMBER_OVERFLOW,
"signed dword immediate exceeds bounds");
}
out_imm(data, opx, 4, OUT_SIGNED);
@ -1789,7 +1789,7 @@ static void gencode(struct out_data *data, insn *ins)
/* If this wasn't explicitly byte-sized, warn as though we
* had fallen through to the imm16/32/64 case.
*/
nasm_warnf(ERR_PASS2 | WARN_NUMBER_OVERFLOW,
nasm_warn(ERR_PASS2 | WARN_NUMBER_OVERFLOW,
"%s value exceeds bounds",
(opx->type & BITS8) ? "signed byte" :
s == 16 ? "word" :
@ -2513,7 +2513,7 @@ static enum ea_type process_ea(operand *input, ea *output, int bits,
if (bits == 64 && ((input->type & IP_REL) == IP_REL)) {
if (input->segment == NO_SEG ||
(input->opflags & OPFLAG_RELATIVE)) {
nasm_warnf(ERR_PASS2, "absolute address can not be RIP-relative");
nasm_warn(ERR_PASS2, "absolute address can not be RIP-relative");
input->type &= ~IP_REL;
input->type |= MEMORY;
}
@ -2528,7 +2528,7 @@ static enum ea_type process_ea(operand *input, ea *output, int bits,
if (eaflags & EAF_BYTEOFFS ||
(eaflags & EAF_WORDOFFS &&
input->disp_size != (addrbits != 16 ? 32 : 16)))
nasm_warnf(ERR_PASS1, "displacement size ignored on absolute address");
nasm_warn(ERR_PASS1, "displacement size ignored on absolute address");
if (bits == 64 && (~input->type & IP_REL)) {
output->sib_present = true;

View File

@ -73,11 +73,20 @@ _type nasm_ ## _name (const char *fmt, ...) \
nasm_err_helpers(void, debug, ERR_DEBUG)
nasm_err_helpers(void, note, ERR_NOTE)
nasm_err_helpers(void, warn, ERR_WARNING)
nasm_err_helpers(void, nonfatal, ERR_NONFATAL)
nasm_err_helpers(fatal_func, fatal, ERR_FATAL)
nasm_err_helpers(fatal_func, panic, ERR_PANIC)
/*
* Strongly discourage warnings without level by require flags on warnings.
* This means nasm_warn() is the equivalent of the -f variants of the
* other ones.
*/
void nasm_warn(errflags severity, const char *fmt, ...)
{
nasm_do_error(ERR_WARNING|severity);
}
fatal_func nasm_panic_from_macro(const char *file, int line)
{
nasm_panic("internal error at %s:%d\n", file, line);
@ -189,7 +198,7 @@ bool set_warning_status(const char *value)
*! warns about a \c{-w} or \c{-W} option or a \c{[WARNING]} directive
*! that contains an unknown warning name or is otherwise not possible to process.
*/
nasm_warnf(WARN_UNKNOWN_WARNING, "unknown warning name: %s", name);
nasm_warn(WARN_UNKNOWN_WARNING, "unknown warning name: %s", name);
}
return ok;

View File

@ -784,7 +784,7 @@ static expr *eval_strfunc(enum strfunc type)
}
if (rn_warn)
nasm_warnf(ERR_PASS1, "character constant too long");
nasm_warn(ERR_PASS1, "character constant too long");
begintemp();
addtotemp(EXPR_SIMPLE, val);
@ -942,7 +942,7 @@ static expr *expr6(void)
case TOKEN_STR:
tmpval = readstrnum(tokval->t_charptr, tokval->t_inttwo, &rn_warn);
if (rn_warn)
nasm_warnf(ERR_PASS1, "character constant too long");
nasm_warn(ERR_PASS1, "character constant too long");
addtotemp(EXPR_SIMPLE, tmpval);
break;
case TOKEN_REG:

View File

@ -236,7 +236,7 @@ static bool ieee_flconvert(const char *string, fp_limb *mant,
*!float-toolong [on] too many digits in floating-point number
*! warns about too many digits in floating-point numbers.
*/
nasm_warnf(WARN_FLOAT_TOOLONG|ERR_PASS2,
nasm_warn(WARN_FLOAT_TOOLONG|ERR_PASS2,
"floating-point constant significand contains "
"more than %i digits", MANT_DIGITS);
warned = true;
@ -685,7 +685,7 @@ static int to_packed_bcd(const char *str, const char *p,
if (c >= '0' && c <= '9') {
if (tv < 0) {
if (n == 9)
nasm_warnf(ERR_PASS2, "packed BCD truncated to 18 digits");
nasm_warn(ERR_PASS2, "packed BCD truncated to 18 digits");
tv = c-'0';
} else {
if (n < 9)
@ -802,7 +802,7 @@ static int to_float(const char *str, int s, uint8_t *result,
if (exponent >= 2 - expmax && exponent <= expmax) {
type = FL_NORMAL;
} else if (exponent > 0) {
nasm_warnf(WARN_FLOAT_OVERFLOW|ERR_PASS2,
nasm_warn(WARN_FLOAT_OVERFLOW|ERR_PASS2,
"overflow in floating-point constant");
type = FL_INFINITY;
} else {
@ -841,7 +841,7 @@ static int to_float(const char *str, int s, uint8_t *result,
*! warns about floating point underflow (a nonzero
*! constant rounded to zero.)
*/
nasm_warnf(WARN_FLOAT_UNDERFLOW|ERR_PASS2,
nasm_warn(WARN_FLOAT_UNDERFLOW|ERR_PASS2,
"underflow in floating-point constant");
goto zero;
} else {
@ -849,7 +849,7 @@ static int to_float(const char *str, int s, uint8_t *result,
*!float-denorm [off] floating point denormal
*! warns about denormal floating point constants.
*/
nasm_warnf(WARN_FLOAT_DENORM|ERR_PASS2,
nasm_warn(WARN_FLOAT_DENORM|ERR_PASS2,
"denormal floating-point constant");
}
}
@ -869,7 +869,7 @@ static int to_float(const char *str, int s, uint8_t *result,
*!float-overflow [on] floating point overflow
*! warns about floating point underflow.
*/
nasm_warnf(WARN_FLOAT_OVERFLOW|ERR_PASS2,
nasm_warn(WARN_FLOAT_OVERFLOW|ERR_PASS2,
"overflow in floating-point constant");
type = FL_INFINITY;
goto overflow;

View File

@ -511,7 +511,7 @@ void define_label(const char *label, int32_t segment,
*! value is identical. It is an unconditional error to
*! define the same label more than once to \e{different} values.
*/
nasm_warnf(WARN_LABEL_REDEF,
nasm_warn(WARN_LABEL_REDEF,
"label `%s' redefined to an identical value", lptr->defn.label);
noteflags = ERR_NOTE|ERR_HERE|WARN_LABEL_REDEF;
}
@ -538,7 +538,7 @@ void define_label(const char *label, int32_t segment,
* Note: As a special case, LBL_SPECIAL symbols are allowed
* to be changed even during the last pass.
*/
nasm_warnf(WARN_LABEL_REDEF_LATE,
nasm_warn(WARN_LABEL_REDEF_LATE,
"label `%s' %s during code generation",
lptr->defn.label, created ? "defined" : "changed");
}

View File

@ -531,7 +531,7 @@ int main(int argc, char **argv)
outname = filename_set_extension(inname, ofmt->extension);
if (!strcmp(outname, inname)) {
outname = "nasm.out";
nasm_warn("default output file same as input, using `%s' for output\n", outname);
nasm_warn(WARN_OTHER, "default output file same as input, using `%s' for output\n", outname);
}
}
@ -1662,7 +1662,7 @@ static void assemble_file(const char *fname, struct strlist *depend_list)
*! the second-to-last assembly pass. This is not
*! inherently fatal, but may be a source of bugs.
*/
nasm_warnf(WARN_PHASE, "phase error during stabilization "
nasm_warn(WARN_PHASE, "phase error during stabilization "
"pass, hoping for the best");
break;

View File

@ -469,7 +469,7 @@ restart_parse:
*! a label without a trailing colon. This is most likely indicative
*! of a typo, but is technically correct NASM syntax (see \k{syntax}.)
*/
nasm_warnf(WARN_ORPHAN_LABELS | ERR_PASS1,
nasm_warn(WARN_ORPHAN_LABELS | ERR_PASS1,
"label alone on a line without a colon might be in error");
}
if (i != TOKEN_INSN || tokval.t_integer != I_EQU) {
@ -519,7 +519,7 @@ restart_parse:
int slot = prefix_slot(tokval.t_integer);
if (result->prefixes[slot]) {
if (result->prefixes[slot] == tokval.t_integer)
nasm_warnf(ERR_PASS1, "instruction has redundant prefixes");
nasm_warn(ERR_PASS1, "instruction has redundant prefixes");
else
nasm_nonfatal("instruction has conflicting prefixes");
}
@ -736,7 +736,7 @@ is_expression:
*/
goto fail;
} else /* DB ... */ if (oper_num == 0)
nasm_warnf(ERR_PASS1, "no operand for data declaration");
nasm_warn(ERR_PASS1, "no operand for data declaration");
else
result->operands = oper_num;
@ -1130,7 +1130,7 @@ is_expression:
op->basereg = value->type;
if (rs && (op->type & SIZE_MASK) != rs)
nasm_warnf(ERR_PASS1, "register size specification ignored");
nasm_warn(ERR_PASS1, "register size specification ignored");
}
}

View File

@ -909,7 +909,7 @@ static Token *tokenize(char *line)
p++;
}
if (*p != '}')
nasm_warnf(ERR_PASS1, "unterminated %%{ construct");
nasm_warn(ERR_PASS1, "unterminated %%{ construct");
p[-1] = '\0';
if (*p)
p++;
@ -997,7 +997,7 @@ static Token *tokenize(char *line)
if (*p) {
p++;
} else {
nasm_warnf(ERR_PASS1, "unterminated string");
nasm_warn(ERR_PASS1, "unterminated string");
/* Handling unterminated strings by UNV */
/* type = -1; */
}
@ -1911,7 +1911,7 @@ static bool if_condition(Token * tline, enum preproc_token ct)
mmac = mmac->next;
}
if (tline && tline->next)
nasm_warnf(ERR_PASS1, "trailing garbage after %%ifmacro ignored");
nasm_warn(ERR_PASS1, "trailing garbage after %%ifmacro ignored");
nasm_free(searching.name);
j = found;
break;
@ -1971,7 +1971,7 @@ iftype:
if (!evalresult)
return -1;
if (tokval.t_type)
nasm_warnf(ERR_PASS1, "trailing garbage after expression ignored");
nasm_warn(ERR_PASS1, "trailing garbage after expression ignored");
if (!is_simple(evalresult)) {
nasm_nonfatal("non-constant value given to `%s'",
pp_directives[ct]);
@ -2005,7 +2005,7 @@ static bool define_smacro(Context *ctx, const char *mname, bool casesense,
if (smacro_defined(ctx, mname, nparam, &smac, casesense)) {
if (!smac) {
nasm_warnf(ERR_PASS1, "single-line macro `%s' defined both with and"
nasm_warn(ERR_PASS1, "single-line macro `%s' defined both with and"
" without parameters", mname);
/*
* Some instances of the old code considered this a failure,
@ -2138,7 +2138,7 @@ static bool parse_mmacro_spec(Token *tline, MMacro *def, const char *directive)
*! warns when a macro has more default parameters than optional parameters.
*! See \k{mlmacdef} for why might want to disable this warning.
*/
nasm_warnf(ERR_PASS1|WARN_MACRO_DEFAULTS,
nasm_warn(ERR_PASS1|WARN_MACRO_DEFAULTS,
"too many default macro parameters in macro `%s'", def->name);
}
@ -2515,7 +2515,7 @@ static int do_directive(Token *tline, char **output)
case PP_CLEAR:
if (tline->next)
nasm_warnf(ERR_PASS1, "trailing garbage after `%%clear' ignored");
nasm_warn(ERR_PASS1, "trailing garbage after `%%clear' ignored");
free_macros();
init_macros();
free_tlist(origline);
@ -2531,7 +2531,7 @@ static int do_directive(Token *tline, char **output)
return DIRECTIVE_FOUND; /* but we did _something_ */
}
if (t->next)
nasm_warnf(ERR_PASS1, "trailing garbage after `%%depend' ignored");
nasm_warn(ERR_PASS1, "trailing garbage after `%%depend' ignored");
p = t->text;
if (t->type != TOK_INTERNAL_STRING)
nasm_unquote_cstr(p, i);
@ -2550,7 +2550,7 @@ static int do_directive(Token *tline, char **output)
return DIRECTIVE_FOUND; /* but we did _something_ */
}
if (t->next)
nasm_warnf(ERR_PASS1, "trailing garbage after `%%include' ignored");
nasm_warn(ERR_PASS1, "trailing garbage after `%%include' ignored");
p = t->text;
if (t->type != TOK_INTERNAL_STRING)
nasm_unquote_cstr(p, i);
@ -2592,7 +2592,7 @@ static int do_directive(Token *tline, char **output)
return DIRECTIVE_FOUND; /* but we did _something_ */
}
if (tline->next)
nasm_warnf(ERR_PASS1, "trailing garbage after `%%use' ignored");
nasm_warn(ERR_PASS1, "trailing garbage after `%%use' ignored");
if (tline->type == TOK_STRING)
nasm_unquote_cstr(tline->text, i);
use_pkg = nasm_stdmac_find_package(tline->text);
@ -2621,7 +2621,7 @@ static int do_directive(Token *tline, char **output)
return DIRECTIVE_FOUND; /* but we did _something_ */
}
if (tline->next)
nasm_warnf(ERR_PASS1, "trailing garbage after `%s' ignored",
nasm_warn(ERR_PASS1, "trailing garbage after `%s' ignored",
pp_directives[i]);
p = nasm_strdup(tline->text);
} else {
@ -2726,7 +2726,7 @@ issue_error:
case COND_ELSE_TRUE:
case COND_ELSE_FALSE:
nasm_warnf(ERR_PASS1|ERR_PP_PRECOND,
nasm_warn(ERR_PASS1|ERR_PP_PRECOND,
"`%%elif' after `%%else' ignored");
istk->conds->state = COND_NEVER;
break;
@ -2751,7 +2751,7 @@ issue_error:
case PP_ELSE:
if (tline->next)
nasm_warnf(ERR_PASS1|ERR_PP_PRECOND,
nasm_warn(ERR_PASS1|ERR_PP_PRECOND,
"trailing garbage after `%%else' ignored");
if (!istk->conds)
nasm_fatal("`%%else: no matching `%%if'");
@ -2770,7 +2770,7 @@ issue_error:
case COND_ELSE_TRUE:
case COND_ELSE_FALSE:
nasm_warnf(ERR_PASS1|ERR_PP_PRECOND,
nasm_warn(ERR_PASS1|ERR_PP_PRECOND,
"`%%else' after `%%else' ignored.");
istk->conds->state = COND_NEVER;
break;
@ -2780,7 +2780,7 @@ issue_error:
case PP_ENDIF:
if (tline->next)
nasm_warnf(ERR_PASS1|ERR_PP_PRECOND,
nasm_warn(ERR_PASS1|ERR_PP_PRECOND,
"trailing garbage after `%%endif' ignored");
if (!istk->conds)
nasm_fatal("`%%endif': no matching `%%if'");
@ -2820,7 +2820,7 @@ issue_error:
|| defining->plus)
&& (defining->nparam_min <= mmac->nparam_max
|| mmac->plus)) {
nasm_warnf(ERR_PASS1, "redefining multi-line macro `%s'",
nasm_warn(ERR_PASS1, "redefining multi-line macro `%s'",
defining->name);
return DIRECTIVE_FOUND;
}
@ -2918,7 +2918,7 @@ issue_error:
if (!evalresult)
return DIRECTIVE_FOUND;
if (tokval.t_type)
nasm_warnf(ERR_PASS1, "trailing garbage after expression ignored");
nasm_warn(ERR_PASS1, "trailing garbage after expression ignored");
if (!is_simple(evalresult)) {
nasm_nonfatal("non-constant value given to `%%rotate'");
return DIRECTIVE_FOUND;
@ -2966,7 +2966,7 @@ issue_error:
return DIRECTIVE_FOUND;
}
if (tokval.t_type)
nasm_warnf(ERR_PASS1, "trailing garbage after expression ignored");
nasm_warn(ERR_PASS1, "trailing garbage after expression ignored");
if (!is_simple(evalresult)) {
nasm_nonfatal("non-constant value given to `%%rep'");
return DIRECTIVE_FOUND;
@ -2982,7 +2982,7 @@ issue_error:
*! warns about negative counts given to the \c{%rep}
*! preprocessor directive.
*/
nasm_warnf(ERR_PASS2|WARN_NEGATIVE_REP,
nasm_warn(ERR_PASS2|WARN_NEGATIVE_REP,
"negative `%%rep' count: %"PRId64, count);
count = 0;
} else {
@ -3163,7 +3163,7 @@ issue_error:
return DIRECTIVE_FOUND;
}
if (tline->next)
nasm_warnf(ERR_PASS1, "trailing garbage after macro name ignored");
nasm_warn(ERR_PASS1, "trailing garbage after macro name ignored");
/* Find the context that symbol belongs to */
ctx = get_ctx(tline->text, &mname);
@ -3295,7 +3295,7 @@ issue_error:
return DIRECTIVE_FOUND; /* but we did _something_ */
}
if (t->next)
nasm_warnf(ERR_PASS1, "trailing garbage after `%%pathsearch' ignored");
nasm_warn(ERR_PASS1, "trailing garbage after `%%pathsearch' ignored");
p = t->text;
if (t->type != TOK_INTERNAL_STRING)
nasm_unquote(p, NULL);
@ -3554,7 +3554,7 @@ issue_error:
}
if (tokval.t_type)
nasm_warnf(ERR_PASS1, "trailing garbage after expression ignored");
nasm_warn(ERR_PASS1, "trailing garbage after expression ignored");
if (!is_simple(evalresult)) {
nasm_nonfatal("non-constant value given to `%%%sassign'",
@ -4311,7 +4311,7 @@ again:
*! with the wrong number of parameters. See \k{mlmacover} for an
*! example of why you might want to disable this warning.
*/
nasm_warnf(ERR_PASS1|WARN_MACRO_PARAMS,
nasm_warn(ERR_PASS1|WARN_MACRO_PARAMS,
"macro `%s' exists, "
"but not taking %d parameters",
mstart->text, nparam);
@ -4561,7 +4561,7 @@ static MMacro *is_mmacro(Token * tline, Token *** params_array)
*/
if (m->in_progress > m->max_depth) {
if (m->max_depth > 0) {
nasm_warn("reached maximum recursion depth of %i",
nasm_warn(WARN_OTHER, "reached maximum recursion depth of %i",
m->max_depth);
}
nasm_free(params);
@ -4612,7 +4612,7 @@ static MMacro *is_mmacro(Token * tline, Token *** params_array)
* After all that, we didn't find one with the right number of
* parameters. Issue a warning, and fail to expand the macro.
*/
nasm_warnf(ERR_PASS1|WARN_MACRO_PARAMS,
nasm_warn(ERR_PASS1|WARN_MACRO_PARAMS,
"macro `%s' exists, but not taking %d parameters",
tline->text, nparam);
nasm_free(params);
@ -5266,7 +5266,7 @@ static void pp_pre_define(char *definition)
if (space->next->type != TOK_PREPROC_ID &&
space->next->type != TOK_ID)
nasm_warn("pre-defining non ID `%s\'\n", definition);
nasm_warn(WARN_OTHER, "pre-defining non ID `%s\'\n", definition);
l = nasm_malloc(sizeof(Line));
l->next = predef;

View File

@ -173,7 +173,7 @@ int stdscan(void *private_data, struct tokenval *tv)
*! indicate a mistake in the source code. Currently only the MASM
*! \c{PTR} keyword is recognized.
*/
nasm_warnf(ERR_PASS1|WARN_PTR, "`%s' is not a NASM keyword",
nasm_warn(ERR_PASS1|WARN_PTR, "`%s' is not a NASM keyword",
tv->t_charptr);
}

View File

@ -58,8 +58,7 @@ void printf_func(1, 2) nasm_debug(const char *fmt, ...);
void printf_func(2, 3) nasm_debugf(errflags flags, const char *fmt, ...);
void printf_func(1, 2) nasm_note(const char *fmt, ...);
void printf_func(2, 3) nasm_notef(errflags flags, const char *fmt, ...);
void printf_func(1, 2) nasm_warn(const char *fmt, ...);
void printf_func(2, 3) nasm_warnf(errflags flags, const char *fmt, ...);
void printf_func(2, 3) nasm_warn(errflags flags, const char *fmt, ...);
void printf_func(1, 2) nasm_nonfatal(const char *fmt, ...);
void printf_func(2, 3) nasm_nonfatalf(errflags flags, const char *fmt, ...);
fatal_func printf_func(1, 2) nasm_fatal(const char *fmt, ...);

View File

@ -593,13 +593,13 @@ static void aout_out(int32_t segto, const void *data,
else if (segto == sbss.index)
s = NULL;
else {
nasm_warn("attempt to assemble code in"
nasm_warn(WARN_OTHER, "attempt to assemble code in"
" segment %d: defaulting to `.text'", segto);
s = &stext;
}
if (!s && type != OUT_RESERVE) {
nasm_warn("attempt to initialize memory in the"
nasm_warn(WARN_OTHER, "attempt to initialize memory in the"
" BSS section: ignored");
sbss.len += realsize(type, size);
return;
@ -609,7 +609,7 @@ static void aout_out(int32_t segto, const void *data,
if (type == OUT_RESERVE) {
if (s) {
nasm_warn("uninitialized space declared in"
nasm_warn(WARN_OTHER, "uninitialized space declared in"
" %s section: zeroing",
(segto == stext.index ? "code" : "data"));
aout_sect_write(s, NULL, size);

View File

@ -304,13 +304,13 @@ static void as86_out(int32_t segto, const void *data,
else if (segto == bssindex)
s = NULL;
else {
nasm_warn("attempt to assemble code in"
nasm_warn(WARN_OTHER, "attempt to assemble code in"
" segment %d: defaulting to `.text'", segto);
s = &stext;
}
if (!s && type != OUT_RESERVE) {
nasm_warn("attempt to initialize memory in the"
nasm_warn(WARN_OTHER, "attempt to initialize memory in the"
" BSS section: ignored");
bsslen += realsize(type, size);
return;
@ -320,7 +320,7 @@ static void as86_out(int32_t segto, const void *data,
if (type == OUT_RESERVE) {
if (s) {
nasm_warn("uninitialized space declared in"
nasm_warn(WARN_OTHER, "uninitialized space declared in"
" %s section: zeroing",
(segto == stext.index ? "code" : "data"));
as86_sect_write(s, NULL, size);

View File

@ -746,7 +746,7 @@ static void bin_out(int32_t segto, const void *data,
}
if ((s->flags & TYPE_NOBITS) && (type != OUT_RESERVE))
nasm_warn("attempt to initialize memory in a"
nasm_warn(WARN_OTHER, "attempt to initialize memory in a"
" nobits section: ignored");
switch (type) {
@ -786,7 +786,7 @@ static void bin_out(int32_t segto, const void *data,
case OUT_RESERVE:
if (s->flags & TYPE_PROGBITS) {
nasm_warn("uninitialized space declared in"
nasm_warn(WARN_OTHER, "uninitialized space declared in"
" %s section: zeroing", s->name);
saa_wbytes(s->contents, NULL, size);
}
@ -967,7 +967,7 @@ static int bin_read_attribute(char **line, int *attribute,
/* Check for no value given. */
if (!*exp) {
nasm_warn("No value given to attribute in"
nasm_warn(WARN_OTHER, "No value given to attribute in"
" `section' directive");
return -1;
}
@ -1029,7 +1029,7 @@ static void bin_assign_attributes(struct Section *sec, char *astring)
*astring = '\0';
astring++;
}
nasm_warn("ignoring unknown section attribute: \"%s\"", p);
nasm_warn(WARN_OTHER, "ignoring unknown section attribute: \"%s\"", p);
}
continue;
}
@ -1327,13 +1327,13 @@ bin_directive(enum directive directive, char *args, int pass)
else { /* Must be a filename. */
rf = nasm_open_write(p, NF_TEXT);
if (!rf) {
nasm_warn("unable to open map file `%s'", p);
nasm_warn(WARN_OTHER, "unable to open map file `%s'", p);
map_control = 0;
return DIRR_OK;
}
}
} else
nasm_warn("map file already specified");
nasm_warn(WARN_OTHER, "map file already specified");
}
if (map_control == 0)
map_control |= MAP_ORIGIN | MAP_SUMMARY;

View File

@ -316,7 +316,7 @@ static int32_t coff_section_names(char *name, int pass, int *bits)
*p++ = '\0';
if (strlen(name) > 8) {
if (!win32 && !win64) {
nasm_warn("COFF section names limited to 8 characters: truncating");
nasm_warn(WARN_OTHER, "COFF section names limited to 8 characters: truncating");
name[8] = '\0';
}
}
@ -409,7 +409,7 @@ static int32_t coff_section_names(char *name, int pass, int *bits)
/* Warn if non-alignment flags differ */
if ((flags ^ coff_sects[i]->flags) & ~IMAGE_SCN_ALIGN_MASK) {
nasm_warn("section attributes ignored on"
nasm_warn(WARN_OTHER, "section attributes ignored on"
" redeclaration of section `%s'", name);
}
/* Check if alignment might be needed */
@ -579,7 +579,7 @@ static void coff_out(int32_t segto, const void *data,
}
if (!s->data && type != OUT_RESERVE) {
nasm_warn("attempt to initialize memory in"
nasm_warn(WARN_OTHER, "attempt to initialize memory in"
" BSS section `%s': ignored", s->name);
s->len += realsize(type, size);
return;
@ -603,7 +603,7 @@ static void coff_out(int32_t segto, const void *data,
if (type == OUT_RESERVE) {
if (s->data) {
nasm_warn("uninitialised space declared in"
nasm_warn(WARN_OTHER, "uninitialised space declared in"
" non-BSS section `%s': zeroing", s->name);
coff_sect_write(s, NULL, size);
} else

View File

@ -259,7 +259,7 @@ static void elf_section_attrib(char *name, char *attr, int pass,
} else if (!nasm_stricmp(opt, "nobits")) {
*type = SHT_NOBITS;
} else if (pass == 1) {
nasm_warn("Unknown section attribute '%s' ignored on"
nasm_warn(WARN_OTHER, "Unknown section attribute '%s' ignored on"
" declaration of section `%s'", opt, name);
}
opt = next;
@ -462,7 +462,7 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
if ((type && sects[i]->type != type)
|| (align && sects[i]->align != align)
|| (flags_and && ((sects[i]->flags & flags_and) != flags_or)))
nasm_warn("incompatible section attributes ignored on"
nasm_warn(WARN_OTHER, "incompatible section attributes ignored on"
" redeclaration of section `%s'", name);
}
@ -820,7 +820,7 @@ static void elf32_out(int32_t segto, const void *data,
/* end of debugging stuff */
if (s->type == SHT_NOBITS && type != OUT_RESERVE) {
nasm_warn("attempt to initialize memory in"
nasm_warn(WARN_OTHER, "attempt to initialize memory in"
" BSS section `%s': ignored", s->name);
s->len += realsize(type, size);
return;
@ -829,7 +829,7 @@ static void elf32_out(int32_t segto, const void *data,
switch (type) {
case OUT_RESERVE:
if (s->type == SHT_PROGBITS) {
nasm_warn("uninitialized space declared in"
nasm_warn(WARN_OTHER, "uninitialized space declared in"
" non-BSS section `%s': zeroing", s->name);
elf_sect_write(s, NULL, size);
} else
@ -924,7 +924,7 @@ static void elf32_out(int32_t segto, const void *data,
*! warns if 8-bit or 16-bit relocations are used in the \c{elf32} output format.
*! The GNU extensions allow this.
*/
nasm_warnf(WARN_GNU_ELF_EXTENSIONS, "8- or 16-bit relocations "
nasm_warn(WARN_GNU_ELF_EXTENSIONS, "8- or 16-bit relocations "
"in ELF32 is a GNU extension");
} else if (asize != 4 && segment != NO_SEG) {
nasm_nonfatal("Unsupported non-32-bit ELF relocation");
@ -950,7 +950,7 @@ rel12adr:
" segment base references");
} else {
if (wrt == NO_SEG) {
nasm_warnf(WARN_GNU_ELF_EXTENSIONS, "8- or 16-bit relocations "
nasm_warn(WARN_GNU_ELF_EXTENSIONS, "8- or 16-bit relocations "
"in ELF is a GNU extension");
elf_add_reloc(s, segment, 0, reltype);
} else {
@ -1031,7 +1031,7 @@ static void elf64_out(int32_t segto, const void *data,
/* end of debugging stuff */
if (s->type == SHT_NOBITS && type != OUT_RESERVE) {
nasm_warn("attempt to initialize memory in"
nasm_warn(WARN_OTHER, "attempt to initialize memory in"
" BSS section `%s': ignored", s->name);
s->len += realsize(type, size);
return;
@ -1040,7 +1040,7 @@ static void elf64_out(int32_t segto, const void *data,
switch (type) {
case OUT_RESERVE:
if (s->type == SHT_PROGBITS) {
nasm_warn("uninitialized space declared in"
nasm_warn(WARN_OTHER, "uninitialized space declared in"
" non-BSS section `%s': zeroing", s->name);
elf_sect_write(s, NULL, size);
} else
@ -1309,7 +1309,7 @@ static void elfx32_out(int32_t segto, const void *data,
/* end of debugging stuff */
if (s->type == SHT_NOBITS && type != OUT_RESERVE) {
nasm_warn("attempt to initialize memory in"
nasm_warn(WARN_OTHER, "attempt to initialize memory in"
" BSS section `%s': ignored", s->name);
s->len += realsize(type, size);
return;
@ -1318,7 +1318,7 @@ static void elfx32_out(int32_t segto, const void *data,
switch (type) {
case OUT_RESERVE:
if (s->type == SHT_PROGBITS) {
nasm_warn("uninitialized space declared in"
nasm_warn(WARN_OTHER, "uninitialized space declared in"
" non-BSS section `%s': zeroing", s->name);
elf_sect_write(s, NULL, size);
} else

View File

@ -706,7 +706,7 @@ static int32_t ieee_segment(char *name, int pass, int *bits)
ieee_idx++;
if (!strcmp(seg->name, name)) {
if (attrs > 0 && pass == 1)
nasm_warn("segment attributes specified on"
nasm_warn(WARN_OTHER, "segment attributes specified on"
" redeclaration of segment: ignoring");
if (seg->use32)
*bits = 32;

View File

@ -1380,7 +1380,7 @@ static int32_t obj_segment(char *name, int pass, int *bits)
if (!strcmp(seg->name, name)) {
if (attrs > 0 && pass == 1)
nasm_warn("segment attributes specified on"
nasm_warn(WARN_OTHER, "segment attributes specified on"
" redeclaration of segment: ignoring");
if (seg->use32)
*bits = 32;
@ -1482,21 +1482,21 @@ static int32_t obj_segment(char *name, int pass, int *bits)
case 4096: /* PharLap extension */
break;
case 8:
nasm_warn("OBJ format does not support alignment"
nasm_warn(WARN_OTHER, "OBJ format does not support alignment"
" of 8: rounding up to 16");
seg->align = 16;
break;
case 32:
case 64:
case 128:
nasm_warn("OBJ format does not support alignment"
nasm_warn(WARN_OTHER, "OBJ format does not support alignment"
" of %d: rounding up to 256", seg->align);
seg->align = 256;
break;
case 512:
case 1024:
case 2048:
nasm_warn("OBJ format does not support alignment"
nasm_warn(WARN_OTHER, "OBJ format does not support alignment"
" of %d: rounding up to 4096", seg->align);
seg->align = 4096;
break;
@ -1534,7 +1534,7 @@ static int32_t obj_segment(char *name, int pass, int *bits)
grp->segs[i] = grp->segs[grp->nindices];
grp->segs[grp->nindices++].index = seg->obj_index;
if (seg->grp)
nasm_warn("segment `%s' is already part of"
nasm_warn(WARN_OTHER, "segment `%s' is already part of"
" a group: first one takes precedence",
seg->name);
else
@ -1649,7 +1649,7 @@ obj_directive(enum directive directive, char *value, int pass)
grp->segs[grp->nentries++] = grp->segs[grp->nindices];
grp->segs[grp->nindices++].index = seg->obj_index;
if (seg->grp)
nasm_warn("segment `%s' is already part of"
nasm_warn(WARN_OTHER, "segment `%s' is already part of"
" a group: first one takes precedence",
seg->name);
else