mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-17 17:19:35 +08:00
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:
parent
727c85263f
commit
80c4f23c52
@ -293,7 +293,7 @@ static const char *size_name(int size)
|
|||||||
|
|
||||||
static void warn_overflow(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));
|
size_name(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ static void out(struct out_data *data)
|
|||||||
*! warns that a relocation has been zero-extended due
|
*! warns that a relocation has been zero-extended due
|
||||||
*! to limitations in the output format.
|
*! 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",
|
"%u-bit %s relocation zero-extended from %u bits",
|
||||||
(unsigned int)(asize << 3),
|
(unsigned int)(asize << 3),
|
||||||
data->type == OUT_SEGMENT ? "segment" : "unsigned",
|
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
|
*! it is legitimate, it may be necessary to use
|
||||||
*! \c{BND JMP DWORD}...
|
*! \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.");
|
"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:
|
case w_lock:
|
||||||
if (ins->prefixes[PPS_LOCK] != P_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",
|
"%s with this instruction requires lock",
|
||||||
prefix_name(rep_pfx));
|
prefix_name(rep_pfx));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case w_inval:
|
case w_inval:
|
||||||
nasm_warnf(WARN_HLE | ERR_PASS2,
|
nasm_warn(WARN_HLE | ERR_PASS2,
|
||||||
"%s invalid with this instruction",
|
"%s invalid with this instruction",
|
||||||
prefix_name(rep_pfx));
|
prefix_name(rep_pfx));
|
||||||
break;
|
break;
|
||||||
@ -1135,7 +1135,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
|
|||||||
if (pfx == P_O16)
|
if (pfx == P_O16)
|
||||||
break;
|
break;
|
||||||
if (pfx != P_none)
|
if (pfx != P_none)
|
||||||
nasm_warnf(ERR_PASS2, "invalid operand size prefix");
|
nasm_warn(ERR_PASS2, "invalid operand size prefix");
|
||||||
else
|
else
|
||||||
ins->prefixes[PPS_OSIZE] = P_O16;
|
ins->prefixes[PPS_OSIZE] = P_O16;
|
||||||
break;
|
break;
|
||||||
@ -1147,7 +1147,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
|
|||||||
if (pfx == P_O32)
|
if (pfx == P_O32)
|
||||||
break;
|
break;
|
||||||
if (pfx != P_none)
|
if (pfx != P_none)
|
||||||
nasm_warnf(ERR_PASS2, "invalid operand size prefix");
|
nasm_warn(ERR_PASS2, "invalid operand size prefix");
|
||||||
else
|
else
|
||||||
ins->prefixes[PPS_OSIZE] = P_O32;
|
ins->prefixes[PPS_OSIZE] = P_O32;
|
||||||
break;
|
break;
|
||||||
@ -1205,7 +1205,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
|
|||||||
nasm_nonfatal("attempt to reserve non-constant"
|
nasm_nonfatal("attempt to reserve non-constant"
|
||||||
" quantity of BSS space");
|
" quantity of BSS space");
|
||||||
else if (ins->oprs[0].opflags & OPFLAG_FORWARD)
|
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");
|
"can have unpredictable results");
|
||||||
else
|
else
|
||||||
length += ins->oprs[0].offset;
|
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
|
*!lock [on] LOCK prefix on unlockable instructions
|
||||||
*! warns about \c{LOCK} prefixes 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);
|
bad_hle_warn(ins, hleok);
|
||||||
@ -1484,19 +1484,19 @@ static int emit_prefix(struct out_data *data, const int bits, insn *ins)
|
|||||||
break;
|
break;
|
||||||
case R_CS:
|
case R_CS:
|
||||||
if (bits == 64)
|
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");
|
"but will be ignored in 64-bit mode");
|
||||||
c = 0x2E;
|
c = 0x2E;
|
||||||
break;
|
break;
|
||||||
case R_DS:
|
case R_DS:
|
||||||
if (bits == 64)
|
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");
|
"but will be ignored in 64-bit mode");
|
||||||
c = 0x3E;
|
c = 0x3E;
|
||||||
break;
|
break;
|
||||||
case R_ES:
|
case R_ES:
|
||||||
if (bits == 64)
|
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");
|
"but will be ignored in 64-bit mode");
|
||||||
c = 0x26;
|
c = 0x26;
|
||||||
break;
|
break;
|
||||||
@ -1508,7 +1508,7 @@ static int emit_prefix(struct out_data *data, const int bits, insn *ins)
|
|||||||
break;
|
break;
|
||||||
case R_SS:
|
case R_SS:
|
||||||
if (bits == 64) {
|
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");
|
"but will be ignored in 64-bit mode");
|
||||||
}
|
}
|
||||||
c = 0x36;
|
c = 0x36;
|
||||||
@ -1697,7 +1697,7 @@ static void gencode(struct out_data *data, insn *ins)
|
|||||||
nasm_nonfatal("non-absolute expression not permitted "
|
nasm_nonfatal("non-absolute expression not permitted "
|
||||||
"as argument %d", c & 7);
|
"as argument %d", c & 7);
|
||||||
else if (opy->offset & ~mask)
|
else if (opy->offset & ~mask)
|
||||||
nasm_warnf(ERR_PASS2 | WARN_NUMBER_OVERFLOW,
|
nasm_warn(ERR_PASS2 | WARN_NUMBER_OVERFLOW,
|
||||||
"is4 argument exceeds bounds");
|
"is4 argument exceeds bounds");
|
||||||
c = opy->offset & mask;
|
c = opy->offset & mask;
|
||||||
goto emit_is4;
|
goto emit_is4;
|
||||||
@ -1719,7 +1719,7 @@ static void gencode(struct out_data *data, insn *ins)
|
|||||||
case4(0254):
|
case4(0254):
|
||||||
if (absolute_op(opx) &&
|
if (absolute_op(opx) &&
|
||||||
(int32_t)opx->offset != (int64_t)opx->offset) {
|
(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");
|
"signed dword immediate exceeds bounds");
|
||||||
}
|
}
|
||||||
out_imm(data, opx, 4, OUT_SIGNED);
|
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
|
/* If this wasn't explicitly byte-sized, warn as though we
|
||||||
* had fallen through to the imm16/32/64 case.
|
* 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",
|
"%s value exceeds bounds",
|
||||||
(opx->type & BITS8) ? "signed byte" :
|
(opx->type & BITS8) ? "signed byte" :
|
||||||
s == 16 ? "word" :
|
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 (bits == 64 && ((input->type & IP_REL) == IP_REL)) {
|
||||||
if (input->segment == NO_SEG ||
|
if (input->segment == NO_SEG ||
|
||||||
(input->opflags & OPFLAG_RELATIVE)) {
|
(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 &= ~IP_REL;
|
||||||
input->type |= MEMORY;
|
input->type |= MEMORY;
|
||||||
}
|
}
|
||||||
@ -2528,7 +2528,7 @@ static enum ea_type process_ea(operand *input, ea *output, int bits,
|
|||||||
if (eaflags & EAF_BYTEOFFS ||
|
if (eaflags & EAF_BYTEOFFS ||
|
||||||
(eaflags & EAF_WORDOFFS &&
|
(eaflags & EAF_WORDOFFS &&
|
||||||
input->disp_size != (addrbits != 16 ? 32 : 16)))
|
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)) {
|
if (bits == 64 && (~input->type & IP_REL)) {
|
||||||
output->sib_present = true;
|
output->sib_present = true;
|
||||||
|
13
asm/error.c
13
asm/error.c
@ -73,11 +73,20 @@ _type nasm_ ## _name (const char *fmt, ...) \
|
|||||||
|
|
||||||
nasm_err_helpers(void, debug, ERR_DEBUG)
|
nasm_err_helpers(void, debug, ERR_DEBUG)
|
||||||
nasm_err_helpers(void, note, ERR_NOTE)
|
nasm_err_helpers(void, note, ERR_NOTE)
|
||||||
nasm_err_helpers(void, warn, ERR_WARNING)
|
|
||||||
nasm_err_helpers(void, nonfatal, ERR_NONFATAL)
|
nasm_err_helpers(void, nonfatal, ERR_NONFATAL)
|
||||||
nasm_err_helpers(fatal_func, fatal, ERR_FATAL)
|
nasm_err_helpers(fatal_func, fatal, ERR_FATAL)
|
||||||
nasm_err_helpers(fatal_func, panic, ERR_PANIC)
|
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)
|
fatal_func nasm_panic_from_macro(const char *file, int line)
|
||||||
{
|
{
|
||||||
nasm_panic("internal error at %s:%d\n", file, 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
|
*! 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.
|
*! 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;
|
return ok;
|
||||||
|
@ -784,7 +784,7 @@ static expr *eval_strfunc(enum strfunc type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rn_warn)
|
if (rn_warn)
|
||||||
nasm_warnf(ERR_PASS1, "character constant too long");
|
nasm_warn(ERR_PASS1, "character constant too long");
|
||||||
|
|
||||||
begintemp();
|
begintemp();
|
||||||
addtotemp(EXPR_SIMPLE, val);
|
addtotemp(EXPR_SIMPLE, val);
|
||||||
@ -942,7 +942,7 @@ static expr *expr6(void)
|
|||||||
case TOKEN_STR:
|
case TOKEN_STR:
|
||||||
tmpval = readstrnum(tokval->t_charptr, tokval->t_inttwo, &rn_warn);
|
tmpval = readstrnum(tokval->t_charptr, tokval->t_inttwo, &rn_warn);
|
||||||
if (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);
|
addtotemp(EXPR_SIMPLE, tmpval);
|
||||||
break;
|
break;
|
||||||
case TOKEN_REG:
|
case TOKEN_REG:
|
||||||
|
12
asm/float.c
12
asm/float.c
@ -236,7 +236,7 @@ static bool ieee_flconvert(const char *string, fp_limb *mant,
|
|||||||
*!float-toolong [on] too many digits in floating-point number
|
*!float-toolong [on] too many digits in floating-point number
|
||||||
*! warns about too many digits in floating-point numbers.
|
*! 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 "
|
"floating-point constant significand contains "
|
||||||
"more than %i digits", MANT_DIGITS);
|
"more than %i digits", MANT_DIGITS);
|
||||||
warned = true;
|
warned = true;
|
||||||
@ -685,7 +685,7 @@ static int to_packed_bcd(const char *str, const char *p,
|
|||||||
if (c >= '0' && c <= '9') {
|
if (c >= '0' && c <= '9') {
|
||||||
if (tv < 0) {
|
if (tv < 0) {
|
||||||
if (n == 9)
|
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';
|
tv = c-'0';
|
||||||
} else {
|
} else {
|
||||||
if (n < 9)
|
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) {
|
if (exponent >= 2 - expmax && exponent <= expmax) {
|
||||||
type = FL_NORMAL;
|
type = FL_NORMAL;
|
||||||
} else if (exponent > 0) {
|
} else if (exponent > 0) {
|
||||||
nasm_warnf(WARN_FLOAT_OVERFLOW|ERR_PASS2,
|
nasm_warn(WARN_FLOAT_OVERFLOW|ERR_PASS2,
|
||||||
"overflow in floating-point constant");
|
"overflow in floating-point constant");
|
||||||
type = FL_INFINITY;
|
type = FL_INFINITY;
|
||||||
} else {
|
} else {
|
||||||
@ -841,7 +841,7 @@ static int to_float(const char *str, int s, uint8_t *result,
|
|||||||
*! warns about floating point underflow (a nonzero
|
*! warns about floating point underflow (a nonzero
|
||||||
*! constant rounded to zero.)
|
*! constant rounded to zero.)
|
||||||
*/
|
*/
|
||||||
nasm_warnf(WARN_FLOAT_UNDERFLOW|ERR_PASS2,
|
nasm_warn(WARN_FLOAT_UNDERFLOW|ERR_PASS2,
|
||||||
"underflow in floating-point constant");
|
"underflow in floating-point constant");
|
||||||
goto zero;
|
goto zero;
|
||||||
} else {
|
} else {
|
||||||
@ -849,7 +849,7 @@ static int to_float(const char *str, int s, uint8_t *result,
|
|||||||
*!float-denorm [off] floating point denormal
|
*!float-denorm [off] floating point denormal
|
||||||
*! warns about denormal floating point constants.
|
*! warns about denormal floating point constants.
|
||||||
*/
|
*/
|
||||||
nasm_warnf(WARN_FLOAT_DENORM|ERR_PASS2,
|
nasm_warn(WARN_FLOAT_DENORM|ERR_PASS2,
|
||||||
"denormal floating-point constant");
|
"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
|
*!float-overflow [on] floating point overflow
|
||||||
*! warns about floating point underflow.
|
*! warns about floating point underflow.
|
||||||
*/
|
*/
|
||||||
nasm_warnf(WARN_FLOAT_OVERFLOW|ERR_PASS2,
|
nasm_warn(WARN_FLOAT_OVERFLOW|ERR_PASS2,
|
||||||
"overflow in floating-point constant");
|
"overflow in floating-point constant");
|
||||||
type = FL_INFINITY;
|
type = FL_INFINITY;
|
||||||
goto overflow;
|
goto overflow;
|
||||||
|
@ -511,7 +511,7 @@ void define_label(const char *label, int32_t segment,
|
|||||||
*! value is identical. It is an unconditional error to
|
*! value is identical. It is an unconditional error to
|
||||||
*! define the same label more than once to \e{different} values.
|
*! 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);
|
"label `%s' redefined to an identical value", lptr->defn.label);
|
||||||
noteflags = ERR_NOTE|ERR_HERE|WARN_LABEL_REDEF;
|
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
|
* Note: As a special case, LBL_SPECIAL symbols are allowed
|
||||||
* to be changed even during the last pass.
|
* 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",
|
"label `%s' %s during code generation",
|
||||||
lptr->defn.label, created ? "defined" : "changed");
|
lptr->defn.label, created ? "defined" : "changed");
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ int main(int argc, char **argv)
|
|||||||
outname = filename_set_extension(inname, ofmt->extension);
|
outname = filename_set_extension(inname, ofmt->extension);
|
||||||
if (!strcmp(outname, inname)) {
|
if (!strcmp(outname, inname)) {
|
||||||
outname = "nasm.out";
|
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
|
*! the second-to-last assembly pass. This is not
|
||||||
*! inherently fatal, but may be a source of bugs.
|
*! 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");
|
"pass, hoping for the best");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ restart_parse:
|
|||||||
*! a label without a trailing colon. This is most likely indicative
|
*! a label without a trailing colon. This is most likely indicative
|
||||||
*! of a typo, but is technically correct NASM syntax (see \k{syntax}.)
|
*! 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");
|
"label alone on a line without a colon might be in error");
|
||||||
}
|
}
|
||||||
if (i != TOKEN_INSN || tokval.t_integer != I_EQU) {
|
if (i != TOKEN_INSN || tokval.t_integer != I_EQU) {
|
||||||
@ -519,7 +519,7 @@ restart_parse:
|
|||||||
int slot = prefix_slot(tokval.t_integer);
|
int slot = prefix_slot(tokval.t_integer);
|
||||||
if (result->prefixes[slot]) {
|
if (result->prefixes[slot]) {
|
||||||
if (result->prefixes[slot] == tokval.t_integer)
|
if (result->prefixes[slot] == tokval.t_integer)
|
||||||
nasm_warnf(ERR_PASS1, "instruction has redundant prefixes");
|
nasm_warn(ERR_PASS1, "instruction has redundant prefixes");
|
||||||
else
|
else
|
||||||
nasm_nonfatal("instruction has conflicting prefixes");
|
nasm_nonfatal("instruction has conflicting prefixes");
|
||||||
}
|
}
|
||||||
@ -736,7 +736,7 @@ is_expression:
|
|||||||
*/
|
*/
|
||||||
goto fail;
|
goto fail;
|
||||||
} else /* DB ... */ if (oper_num == 0)
|
} 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
|
else
|
||||||
result->operands = oper_num;
|
result->operands = oper_num;
|
||||||
|
|
||||||
@ -1130,7 +1130,7 @@ is_expression:
|
|||||||
op->basereg = value->type;
|
op->basereg = value->type;
|
||||||
|
|
||||||
if (rs && (op->type & SIZE_MASK) != rs)
|
if (rs && (op->type & SIZE_MASK) != rs)
|
||||||
nasm_warnf(ERR_PASS1, "register size specification ignored");
|
nasm_warn(ERR_PASS1, "register size specification ignored");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -909,7 +909,7 @@ static Token *tokenize(char *line)
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
if (*p != '}')
|
if (*p != '}')
|
||||||
nasm_warnf(ERR_PASS1, "unterminated %%{ construct");
|
nasm_warn(ERR_PASS1, "unterminated %%{ construct");
|
||||||
p[-1] = '\0';
|
p[-1] = '\0';
|
||||||
if (*p)
|
if (*p)
|
||||||
p++;
|
p++;
|
||||||
@ -997,7 +997,7 @@ static Token *tokenize(char *line)
|
|||||||
if (*p) {
|
if (*p) {
|
||||||
p++;
|
p++;
|
||||||
} else {
|
} else {
|
||||||
nasm_warnf(ERR_PASS1, "unterminated string");
|
nasm_warn(ERR_PASS1, "unterminated string");
|
||||||
/* Handling unterminated strings by UNV */
|
/* Handling unterminated strings by UNV */
|
||||||
/* type = -1; */
|
/* type = -1; */
|
||||||
}
|
}
|
||||||
@ -1911,7 +1911,7 @@ static bool if_condition(Token * tline, enum preproc_token ct)
|
|||||||
mmac = mmac->next;
|
mmac = mmac->next;
|
||||||
}
|
}
|
||||||
if (tline && tline->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);
|
nasm_free(searching.name);
|
||||||
j = found;
|
j = found;
|
||||||
break;
|
break;
|
||||||
@ -1971,7 +1971,7 @@ iftype:
|
|||||||
if (!evalresult)
|
if (!evalresult)
|
||||||
return -1;
|
return -1;
|
||||||
if (tokval.t_type)
|
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)) {
|
if (!is_simple(evalresult)) {
|
||||||
nasm_nonfatal("non-constant value given to `%s'",
|
nasm_nonfatal("non-constant value given to `%s'",
|
||||||
pp_directives[ct]);
|
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 (smacro_defined(ctx, mname, nparam, &smac, casesense)) {
|
||||||
if (!smac) {
|
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);
|
" without parameters", mname);
|
||||||
/*
|
/*
|
||||||
* Some instances of the old code considered this a failure,
|
* 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.
|
*! warns when a macro has more default parameters than optional parameters.
|
||||||
*! See \k{mlmacdef} for why might want to disable this warning.
|
*! 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);
|
"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:
|
case PP_CLEAR:
|
||||||
if (tline->next)
|
if (tline->next)
|
||||||
nasm_warnf(ERR_PASS1, "trailing garbage after `%%clear' ignored");
|
nasm_warn(ERR_PASS1, "trailing garbage after `%%clear' ignored");
|
||||||
free_macros();
|
free_macros();
|
||||||
init_macros();
|
init_macros();
|
||||||
free_tlist(origline);
|
free_tlist(origline);
|
||||||
@ -2531,7 +2531,7 @@ static int do_directive(Token *tline, char **output)
|
|||||||
return DIRECTIVE_FOUND; /* but we did _something_ */
|
return DIRECTIVE_FOUND; /* but we did _something_ */
|
||||||
}
|
}
|
||||||
if (t->next)
|
if (t->next)
|
||||||
nasm_warnf(ERR_PASS1, "trailing garbage after `%%depend' ignored");
|
nasm_warn(ERR_PASS1, "trailing garbage after `%%depend' ignored");
|
||||||
p = t->text;
|
p = t->text;
|
||||||
if (t->type != TOK_INTERNAL_STRING)
|
if (t->type != TOK_INTERNAL_STRING)
|
||||||
nasm_unquote_cstr(p, i);
|
nasm_unquote_cstr(p, i);
|
||||||
@ -2550,7 +2550,7 @@ static int do_directive(Token *tline, char **output)
|
|||||||
return DIRECTIVE_FOUND; /* but we did _something_ */
|
return DIRECTIVE_FOUND; /* but we did _something_ */
|
||||||
}
|
}
|
||||||
if (t->next)
|
if (t->next)
|
||||||
nasm_warnf(ERR_PASS1, "trailing garbage after `%%include' ignored");
|
nasm_warn(ERR_PASS1, "trailing garbage after `%%include' ignored");
|
||||||
p = t->text;
|
p = t->text;
|
||||||
if (t->type != TOK_INTERNAL_STRING)
|
if (t->type != TOK_INTERNAL_STRING)
|
||||||
nasm_unquote_cstr(p, i);
|
nasm_unquote_cstr(p, i);
|
||||||
@ -2592,7 +2592,7 @@ static int do_directive(Token *tline, char **output)
|
|||||||
return DIRECTIVE_FOUND; /* but we did _something_ */
|
return DIRECTIVE_FOUND; /* but we did _something_ */
|
||||||
}
|
}
|
||||||
if (tline->next)
|
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)
|
if (tline->type == TOK_STRING)
|
||||||
nasm_unquote_cstr(tline->text, i);
|
nasm_unquote_cstr(tline->text, i);
|
||||||
use_pkg = nasm_stdmac_find_package(tline->text);
|
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_ */
|
return DIRECTIVE_FOUND; /* but we did _something_ */
|
||||||
}
|
}
|
||||||
if (tline->next)
|
if (tline->next)
|
||||||
nasm_warnf(ERR_PASS1, "trailing garbage after `%s' ignored",
|
nasm_warn(ERR_PASS1, "trailing garbage after `%s' ignored",
|
||||||
pp_directives[i]);
|
pp_directives[i]);
|
||||||
p = nasm_strdup(tline->text);
|
p = nasm_strdup(tline->text);
|
||||||
} else {
|
} else {
|
||||||
@ -2726,7 +2726,7 @@ issue_error:
|
|||||||
|
|
||||||
case COND_ELSE_TRUE:
|
case COND_ELSE_TRUE:
|
||||||
case COND_ELSE_FALSE:
|
case COND_ELSE_FALSE:
|
||||||
nasm_warnf(ERR_PASS1|ERR_PP_PRECOND,
|
nasm_warn(ERR_PASS1|ERR_PP_PRECOND,
|
||||||
"`%%elif' after `%%else' ignored");
|
"`%%elif' after `%%else' ignored");
|
||||||
istk->conds->state = COND_NEVER;
|
istk->conds->state = COND_NEVER;
|
||||||
break;
|
break;
|
||||||
@ -2751,7 +2751,7 @@ issue_error:
|
|||||||
|
|
||||||
case PP_ELSE:
|
case PP_ELSE:
|
||||||
if (tline->next)
|
if (tline->next)
|
||||||
nasm_warnf(ERR_PASS1|ERR_PP_PRECOND,
|
nasm_warn(ERR_PASS1|ERR_PP_PRECOND,
|
||||||
"trailing garbage after `%%else' ignored");
|
"trailing garbage after `%%else' ignored");
|
||||||
if (!istk->conds)
|
if (!istk->conds)
|
||||||
nasm_fatal("`%%else: no matching `%%if'");
|
nasm_fatal("`%%else: no matching `%%if'");
|
||||||
@ -2770,7 +2770,7 @@ issue_error:
|
|||||||
|
|
||||||
case COND_ELSE_TRUE:
|
case COND_ELSE_TRUE:
|
||||||
case COND_ELSE_FALSE:
|
case COND_ELSE_FALSE:
|
||||||
nasm_warnf(ERR_PASS1|ERR_PP_PRECOND,
|
nasm_warn(ERR_PASS1|ERR_PP_PRECOND,
|
||||||
"`%%else' after `%%else' ignored.");
|
"`%%else' after `%%else' ignored.");
|
||||||
istk->conds->state = COND_NEVER;
|
istk->conds->state = COND_NEVER;
|
||||||
break;
|
break;
|
||||||
@ -2780,7 +2780,7 @@ issue_error:
|
|||||||
|
|
||||||
case PP_ENDIF:
|
case PP_ENDIF:
|
||||||
if (tline->next)
|
if (tline->next)
|
||||||
nasm_warnf(ERR_PASS1|ERR_PP_PRECOND,
|
nasm_warn(ERR_PASS1|ERR_PP_PRECOND,
|
||||||
"trailing garbage after `%%endif' ignored");
|
"trailing garbage after `%%endif' ignored");
|
||||||
if (!istk->conds)
|
if (!istk->conds)
|
||||||
nasm_fatal("`%%endif': no matching `%%if'");
|
nasm_fatal("`%%endif': no matching `%%if'");
|
||||||
@ -2820,7 +2820,7 @@ issue_error:
|
|||||||
|| defining->plus)
|
|| defining->plus)
|
||||||
&& (defining->nparam_min <= mmac->nparam_max
|
&& (defining->nparam_min <= mmac->nparam_max
|
||||||
|| mmac->plus)) {
|
|| mmac->plus)) {
|
||||||
nasm_warnf(ERR_PASS1, "redefining multi-line macro `%s'",
|
nasm_warn(ERR_PASS1, "redefining multi-line macro `%s'",
|
||||||
defining->name);
|
defining->name);
|
||||||
return DIRECTIVE_FOUND;
|
return DIRECTIVE_FOUND;
|
||||||
}
|
}
|
||||||
@ -2918,7 +2918,7 @@ issue_error:
|
|||||||
if (!evalresult)
|
if (!evalresult)
|
||||||
return DIRECTIVE_FOUND;
|
return DIRECTIVE_FOUND;
|
||||||
if (tokval.t_type)
|
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)) {
|
if (!is_simple(evalresult)) {
|
||||||
nasm_nonfatal("non-constant value given to `%%rotate'");
|
nasm_nonfatal("non-constant value given to `%%rotate'");
|
||||||
return DIRECTIVE_FOUND;
|
return DIRECTIVE_FOUND;
|
||||||
@ -2966,7 +2966,7 @@ issue_error:
|
|||||||
return DIRECTIVE_FOUND;
|
return DIRECTIVE_FOUND;
|
||||||
}
|
}
|
||||||
if (tokval.t_type)
|
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)) {
|
if (!is_simple(evalresult)) {
|
||||||
nasm_nonfatal("non-constant value given to `%%rep'");
|
nasm_nonfatal("non-constant value given to `%%rep'");
|
||||||
return DIRECTIVE_FOUND;
|
return DIRECTIVE_FOUND;
|
||||||
@ -2982,7 +2982,7 @@ issue_error:
|
|||||||
*! warns about negative counts given to the \c{%rep}
|
*! warns about negative counts given to the \c{%rep}
|
||||||
*! preprocessor directive.
|
*! preprocessor directive.
|
||||||
*/
|
*/
|
||||||
nasm_warnf(ERR_PASS2|WARN_NEGATIVE_REP,
|
nasm_warn(ERR_PASS2|WARN_NEGATIVE_REP,
|
||||||
"negative `%%rep' count: %"PRId64, count);
|
"negative `%%rep' count: %"PRId64, count);
|
||||||
count = 0;
|
count = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -3163,7 +3163,7 @@ issue_error:
|
|||||||
return DIRECTIVE_FOUND;
|
return DIRECTIVE_FOUND;
|
||||||
}
|
}
|
||||||
if (tline->next)
|
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 */
|
/* Find the context that symbol belongs to */
|
||||||
ctx = get_ctx(tline->text, &mname);
|
ctx = get_ctx(tline->text, &mname);
|
||||||
@ -3295,7 +3295,7 @@ issue_error:
|
|||||||
return DIRECTIVE_FOUND; /* but we did _something_ */
|
return DIRECTIVE_FOUND; /* but we did _something_ */
|
||||||
}
|
}
|
||||||
if (t->next)
|
if (t->next)
|
||||||
nasm_warnf(ERR_PASS1, "trailing garbage after `%%pathsearch' ignored");
|
nasm_warn(ERR_PASS1, "trailing garbage after `%%pathsearch' ignored");
|
||||||
p = t->text;
|
p = t->text;
|
||||||
if (t->type != TOK_INTERNAL_STRING)
|
if (t->type != TOK_INTERNAL_STRING)
|
||||||
nasm_unquote(p, NULL);
|
nasm_unquote(p, NULL);
|
||||||
@ -3554,7 +3554,7 @@ issue_error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tokval.t_type)
|
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)) {
|
if (!is_simple(evalresult)) {
|
||||||
nasm_nonfatal("non-constant value given to `%%%sassign'",
|
nasm_nonfatal("non-constant value given to `%%%sassign'",
|
||||||
@ -4311,7 +4311,7 @@ again:
|
|||||||
*! with the wrong number of parameters. See \k{mlmacover} for an
|
*! with the wrong number of parameters. See \k{mlmacover} for an
|
||||||
*! example of why you might want to disable this warning.
|
*! 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, "
|
"macro `%s' exists, "
|
||||||
"but not taking %d parameters",
|
"but not taking %d parameters",
|
||||||
mstart->text, nparam);
|
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->in_progress > m->max_depth) {
|
||||||
if (m->max_depth > 0) {
|
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);
|
m->max_depth);
|
||||||
}
|
}
|
||||||
nasm_free(params);
|
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
|
* After all that, we didn't find one with the right number of
|
||||||
* parameters. Issue a warning, and fail to expand the macro.
|
* 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",
|
"macro `%s' exists, but not taking %d parameters",
|
||||||
tline->text, nparam);
|
tline->text, nparam);
|
||||||
nasm_free(params);
|
nasm_free(params);
|
||||||
@ -5266,7 +5266,7 @@ static void pp_pre_define(char *definition)
|
|||||||
|
|
||||||
if (space->next->type != TOK_PREPROC_ID &&
|
if (space->next->type != TOK_PREPROC_ID &&
|
||||||
space->next->type != TOK_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 = nasm_malloc(sizeof(Line));
|
||||||
l->next = predef;
|
l->next = predef;
|
||||||
|
@ -173,7 +173,7 @@ int stdscan(void *private_data, struct tokenval *tv)
|
|||||||
*! indicate a mistake in the source code. Currently only the MASM
|
*! indicate a mistake in the source code. Currently only the MASM
|
||||||
*! \c{PTR} keyword is recognized.
|
*! \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);
|
tv->t_charptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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(2, 3) nasm_debugf(errflags flags, const char *fmt, ...);
|
||||||
void printf_func(1, 2) nasm_note(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(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_warn(errflags flags, const char *fmt, ...);
|
||||||
void printf_func(2, 3) nasm_warnf(errflags flags, const char *fmt, ...);
|
|
||||||
void printf_func(1, 2) nasm_nonfatal(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, ...);
|
void printf_func(2, 3) nasm_nonfatalf(errflags flags, const char *fmt, ...);
|
||||||
fatal_func printf_func(1, 2) nasm_fatal(const char *fmt, ...);
|
fatal_func printf_func(1, 2) nasm_fatal(const char *fmt, ...);
|
||||||
|
@ -593,13 +593,13 @@ static void aout_out(int32_t segto, const void *data,
|
|||||||
else if (segto == sbss.index)
|
else if (segto == sbss.index)
|
||||||
s = NULL;
|
s = NULL;
|
||||||
else {
|
else {
|
||||||
nasm_warn("attempt to assemble code in"
|
nasm_warn(WARN_OTHER, "attempt to assemble code in"
|
||||||
" segment %d: defaulting to `.text'", segto);
|
" segment %d: defaulting to `.text'", segto);
|
||||||
s = &stext;
|
s = &stext;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s && type != OUT_RESERVE) {
|
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");
|
" BSS section: ignored");
|
||||||
sbss.len += realsize(type, size);
|
sbss.len += realsize(type, size);
|
||||||
return;
|
return;
|
||||||
@ -609,7 +609,7 @@ static void aout_out(int32_t segto, const void *data,
|
|||||||
|
|
||||||
if (type == OUT_RESERVE) {
|
if (type == OUT_RESERVE) {
|
||||||
if (s) {
|
if (s) {
|
||||||
nasm_warn("uninitialized space declared in"
|
nasm_warn(WARN_OTHER, "uninitialized space declared in"
|
||||||
" %s section: zeroing",
|
" %s section: zeroing",
|
||||||
(segto == stext.index ? "code" : "data"));
|
(segto == stext.index ? "code" : "data"));
|
||||||
aout_sect_write(s, NULL, size);
|
aout_sect_write(s, NULL, size);
|
||||||
|
@ -304,13 +304,13 @@ static void as86_out(int32_t segto, const void *data,
|
|||||||
else if (segto == bssindex)
|
else if (segto == bssindex)
|
||||||
s = NULL;
|
s = NULL;
|
||||||
else {
|
else {
|
||||||
nasm_warn("attempt to assemble code in"
|
nasm_warn(WARN_OTHER, "attempt to assemble code in"
|
||||||
" segment %d: defaulting to `.text'", segto);
|
" segment %d: defaulting to `.text'", segto);
|
||||||
s = &stext;
|
s = &stext;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s && type != OUT_RESERVE) {
|
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");
|
" BSS section: ignored");
|
||||||
bsslen += realsize(type, size);
|
bsslen += realsize(type, size);
|
||||||
return;
|
return;
|
||||||
@ -320,7 +320,7 @@ static void as86_out(int32_t segto, const void *data,
|
|||||||
|
|
||||||
if (type == OUT_RESERVE) {
|
if (type == OUT_RESERVE) {
|
||||||
if (s) {
|
if (s) {
|
||||||
nasm_warn("uninitialized space declared in"
|
nasm_warn(WARN_OTHER, "uninitialized space declared in"
|
||||||
" %s section: zeroing",
|
" %s section: zeroing",
|
||||||
(segto == stext.index ? "code" : "data"));
|
(segto == stext.index ? "code" : "data"));
|
||||||
as86_sect_write(s, NULL, size);
|
as86_sect_write(s, NULL, size);
|
||||||
|
@ -746,7 +746,7 @@ static void bin_out(int32_t segto, const void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((s->flags & TYPE_NOBITS) && (type != OUT_RESERVE))
|
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");
|
" nobits section: ignored");
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -786,7 +786,7 @@ static void bin_out(int32_t segto, const void *data,
|
|||||||
|
|
||||||
case OUT_RESERVE:
|
case OUT_RESERVE:
|
||||||
if (s->flags & TYPE_PROGBITS) {
|
if (s->flags & TYPE_PROGBITS) {
|
||||||
nasm_warn("uninitialized space declared in"
|
nasm_warn(WARN_OTHER, "uninitialized space declared in"
|
||||||
" %s section: zeroing", s->name);
|
" %s section: zeroing", s->name);
|
||||||
saa_wbytes(s->contents, NULL, size);
|
saa_wbytes(s->contents, NULL, size);
|
||||||
}
|
}
|
||||||
@ -967,7 +967,7 @@ static int bin_read_attribute(char **line, int *attribute,
|
|||||||
|
|
||||||
/* Check for no value given. */
|
/* Check for no value given. */
|
||||||
if (!*exp) {
|
if (!*exp) {
|
||||||
nasm_warn("No value given to attribute in"
|
nasm_warn(WARN_OTHER, "No value given to attribute in"
|
||||||
" `section' directive");
|
" `section' directive");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1029,7 +1029,7 @@ static void bin_assign_attributes(struct Section *sec, char *astring)
|
|||||||
*astring = '\0';
|
*astring = '\0';
|
||||||
astring++;
|
astring++;
|
||||||
}
|
}
|
||||||
nasm_warn("ignoring unknown section attribute: \"%s\"", p);
|
nasm_warn(WARN_OTHER, "ignoring unknown section attribute: \"%s\"", p);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1327,13 +1327,13 @@ bin_directive(enum directive directive, char *args, int pass)
|
|||||||
else { /* Must be a filename. */
|
else { /* Must be a filename. */
|
||||||
rf = nasm_open_write(p, NF_TEXT);
|
rf = nasm_open_write(p, NF_TEXT);
|
||||||
if (!rf) {
|
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;
|
map_control = 0;
|
||||||
return DIRR_OK;
|
return DIRR_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
nasm_warn("map file already specified");
|
nasm_warn(WARN_OTHER, "map file already specified");
|
||||||
}
|
}
|
||||||
if (map_control == 0)
|
if (map_control == 0)
|
||||||
map_control |= MAP_ORIGIN | MAP_SUMMARY;
|
map_control |= MAP_ORIGIN | MAP_SUMMARY;
|
||||||
|
@ -316,7 +316,7 @@ static int32_t coff_section_names(char *name, int pass, int *bits)
|
|||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
if (strlen(name) > 8) {
|
if (strlen(name) > 8) {
|
||||||
if (!win32 && !win64) {
|
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';
|
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 */
|
/* Warn if non-alignment flags differ */
|
||||||
if ((flags ^ coff_sects[i]->flags) & ~IMAGE_SCN_ALIGN_MASK) {
|
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);
|
" redeclaration of section `%s'", name);
|
||||||
}
|
}
|
||||||
/* Check if alignment might be needed */
|
/* 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) {
|
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);
|
" BSS section `%s': ignored", s->name);
|
||||||
s->len += realsize(type, size);
|
s->len += realsize(type, size);
|
||||||
return;
|
return;
|
||||||
@ -603,7 +603,7 @@ static void coff_out(int32_t segto, const void *data,
|
|||||||
|
|
||||||
if (type == OUT_RESERVE) {
|
if (type == OUT_RESERVE) {
|
||||||
if (s->data) {
|
if (s->data) {
|
||||||
nasm_warn("uninitialised space declared in"
|
nasm_warn(WARN_OTHER, "uninitialised space declared in"
|
||||||
" non-BSS section `%s': zeroing", s->name);
|
" non-BSS section `%s': zeroing", s->name);
|
||||||
coff_sect_write(s, NULL, size);
|
coff_sect_write(s, NULL, size);
|
||||||
} else
|
} else
|
||||||
|
@ -259,7 +259,7 @@ static void elf_section_attrib(char *name, char *attr, int pass,
|
|||||||
} else if (!nasm_stricmp(opt, "nobits")) {
|
} else if (!nasm_stricmp(opt, "nobits")) {
|
||||||
*type = SHT_NOBITS;
|
*type = SHT_NOBITS;
|
||||||
} else if (pass == 1) {
|
} 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);
|
" declaration of section `%s'", opt, name);
|
||||||
}
|
}
|
||||||
opt = next;
|
opt = next;
|
||||||
@ -462,7 +462,7 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
|
|||||||
if ((type && sects[i]->type != type)
|
if ((type && sects[i]->type != type)
|
||||||
|| (align && sects[i]->align != align)
|
|| (align && sects[i]->align != align)
|
||||||
|| (flags_and && ((sects[i]->flags & flags_and) != flags_or)))
|
|| (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);
|
" redeclaration of section `%s'", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -820,7 +820,7 @@ static void elf32_out(int32_t segto, const void *data,
|
|||||||
/* end of debugging stuff */
|
/* end of debugging stuff */
|
||||||
|
|
||||||
if (s->type == SHT_NOBITS && type != OUT_RESERVE) {
|
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);
|
" BSS section `%s': ignored", s->name);
|
||||||
s->len += realsize(type, size);
|
s->len += realsize(type, size);
|
||||||
return;
|
return;
|
||||||
@ -829,7 +829,7 @@ static void elf32_out(int32_t segto, const void *data,
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case OUT_RESERVE:
|
case OUT_RESERVE:
|
||||||
if (s->type == SHT_PROGBITS) {
|
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);
|
" non-BSS section `%s': zeroing", s->name);
|
||||||
elf_sect_write(s, NULL, size);
|
elf_sect_write(s, NULL, size);
|
||||||
} else
|
} 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.
|
*! warns if 8-bit or 16-bit relocations are used in the \c{elf32} output format.
|
||||||
*! The GNU extensions allow this.
|
*! 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");
|
"in ELF32 is a GNU extension");
|
||||||
} else if (asize != 4 && segment != NO_SEG) {
|
} else if (asize != 4 && segment != NO_SEG) {
|
||||||
nasm_nonfatal("Unsupported non-32-bit ELF relocation");
|
nasm_nonfatal("Unsupported non-32-bit ELF relocation");
|
||||||
@ -950,7 +950,7 @@ rel12adr:
|
|||||||
" segment base references");
|
" segment base references");
|
||||||
} else {
|
} else {
|
||||||
if (wrt == NO_SEG) {
|
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");
|
"in ELF is a GNU extension");
|
||||||
elf_add_reloc(s, segment, 0, reltype);
|
elf_add_reloc(s, segment, 0, reltype);
|
||||||
} else {
|
} else {
|
||||||
@ -1031,7 +1031,7 @@ static void elf64_out(int32_t segto, const void *data,
|
|||||||
/* end of debugging stuff */
|
/* end of debugging stuff */
|
||||||
|
|
||||||
if (s->type == SHT_NOBITS && type != OUT_RESERVE) {
|
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);
|
" BSS section `%s': ignored", s->name);
|
||||||
s->len += realsize(type, size);
|
s->len += realsize(type, size);
|
||||||
return;
|
return;
|
||||||
@ -1040,7 +1040,7 @@ static void elf64_out(int32_t segto, const void *data,
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case OUT_RESERVE:
|
case OUT_RESERVE:
|
||||||
if (s->type == SHT_PROGBITS) {
|
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);
|
" non-BSS section `%s': zeroing", s->name);
|
||||||
elf_sect_write(s, NULL, size);
|
elf_sect_write(s, NULL, size);
|
||||||
} else
|
} else
|
||||||
@ -1309,7 +1309,7 @@ static void elfx32_out(int32_t segto, const void *data,
|
|||||||
/* end of debugging stuff */
|
/* end of debugging stuff */
|
||||||
|
|
||||||
if (s->type == SHT_NOBITS && type != OUT_RESERVE) {
|
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);
|
" BSS section `%s': ignored", s->name);
|
||||||
s->len += realsize(type, size);
|
s->len += realsize(type, size);
|
||||||
return;
|
return;
|
||||||
@ -1318,7 +1318,7 @@ static void elfx32_out(int32_t segto, const void *data,
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case OUT_RESERVE:
|
case OUT_RESERVE:
|
||||||
if (s->type == SHT_PROGBITS) {
|
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);
|
" non-BSS section `%s': zeroing", s->name);
|
||||||
elf_sect_write(s, NULL, size);
|
elf_sect_write(s, NULL, size);
|
||||||
} else
|
} else
|
||||||
|
@ -706,7 +706,7 @@ static int32_t ieee_segment(char *name, int pass, int *bits)
|
|||||||
ieee_idx++;
|
ieee_idx++;
|
||||||
if (!strcmp(seg->name, name)) {
|
if (!strcmp(seg->name, name)) {
|
||||||
if (attrs > 0 && pass == 1)
|
if (attrs > 0 && pass == 1)
|
||||||
nasm_warn("segment attributes specified on"
|
nasm_warn(WARN_OTHER, "segment attributes specified on"
|
||||||
" redeclaration of segment: ignoring");
|
" redeclaration of segment: ignoring");
|
||||||
if (seg->use32)
|
if (seg->use32)
|
||||||
*bits = 32;
|
*bits = 32;
|
||||||
|
@ -1380,7 +1380,7 @@ static int32_t obj_segment(char *name, int pass, int *bits)
|
|||||||
|
|
||||||
if (!strcmp(seg->name, name)) {
|
if (!strcmp(seg->name, name)) {
|
||||||
if (attrs > 0 && pass == 1)
|
if (attrs > 0 && pass == 1)
|
||||||
nasm_warn("segment attributes specified on"
|
nasm_warn(WARN_OTHER, "segment attributes specified on"
|
||||||
" redeclaration of segment: ignoring");
|
" redeclaration of segment: ignoring");
|
||||||
if (seg->use32)
|
if (seg->use32)
|
||||||
*bits = 32;
|
*bits = 32;
|
||||||
@ -1482,21 +1482,21 @@ static int32_t obj_segment(char *name, int pass, int *bits)
|
|||||||
case 4096: /* PharLap extension */
|
case 4096: /* PharLap extension */
|
||||||
break;
|
break;
|
||||||
case 8:
|
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");
|
" of 8: rounding up to 16");
|
||||||
seg->align = 16;
|
seg->align = 16;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
case 64:
|
case 64:
|
||||||
case 128:
|
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);
|
" of %d: rounding up to 256", seg->align);
|
||||||
seg->align = 256;
|
seg->align = 256;
|
||||||
break;
|
break;
|
||||||
case 512:
|
case 512:
|
||||||
case 1024:
|
case 1024:
|
||||||
case 2048:
|
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);
|
" of %d: rounding up to 4096", seg->align);
|
||||||
seg->align = 4096;
|
seg->align = 4096;
|
||||||
break;
|
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[i] = grp->segs[grp->nindices];
|
||||||
grp->segs[grp->nindices++].index = seg->obj_index;
|
grp->segs[grp->nindices++].index = seg->obj_index;
|
||||||
if (seg->grp)
|
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",
|
" a group: first one takes precedence",
|
||||||
seg->name);
|
seg->name);
|
||||||
else
|
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->nentries++] = grp->segs[grp->nindices];
|
||||||
grp->segs[grp->nindices++].index = seg->obj_index;
|
grp->segs[grp->nindices++].index = seg->obj_index;
|
||||||
if (seg->grp)
|
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",
|
" a group: first one takes precedence",
|
||||||
seg->name);
|
seg->name);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user