mapping->line_inc = line_inc;
}
+unsigned long
+yasm_linemap_poke(yasm_linemap *linemap, const char *filename,
+ unsigned long file_line)
+{
+ unsigned long line;
+ line_mapping *mapping = &linemap->map->vector[linemap->map->size-1];
+
+ linemap->current++;
+ yasm_linemap_set(linemap, filename, file_line, 0);
+
+ line = linemap->current;
+
+ linemap->current++;
+ yasm_linemap_set(linemap, mapping->filename, mapping->file_line,
+ mapping->line_inc);
+
+ return line;
+}
+
yasm_linemap *
yasm_linemap_create(void)
{
void yasm_linemap_set(yasm_linemap *linemap, /*@null@*/ const char *filename,
unsigned long file_line, unsigned long line_inc);
+/** Poke a single file/line association, restoring the original physical
+ * association starting point. Caution: increments the current virtual line
+ * twice.
+ * \param linemap line mapping repository
+ * \param filename physical file name (if NULL, not changed)
+ * \param file_line physical line number
+ * \return The virtual line number of the poked association.
+ */
+unsigned long yasm_linemap_poke(yasm_linemap *linemap,
+ /*@null@*/ const char *filename,
+ unsigned long file_line);
+
/** Look up the associated physical file and line for a virtual line.
* \param linemap line mapping repository
* \param line virtual line
case TOKEN_ID:
case TOKEN_HERE:
case TOKEN_BASE:
- error(ERR_NONFATAL, "%s not supported",
- (i == TOKEN_ID ? "symbol references" :
- i == TOKEN_HERE ? "`$'" : "`$$'"));
+ error(ERR_NONFATAL,
+ "cannot reference symbol `%s' in preprocessor",
+ (i == TOKEN_ID ? tokval->t_charptr :
+ i == TOKEN_HERE ? "$" : "$$"));
e = yasm_expr_create_ident(yasm_expr_int(yasm_intnum_create_int(1)),
0);
break;
break;
}
va_end(va);
- yasm_errwarn_propagate(cur_errwarns, yasm_linemap_get_current(cur_lm));
+ yasm_errwarn_propagate(cur_errwarns,
+ yasm_linemap_poke(cur_lm, nasm_src_get_fname(),
+ (unsigned long)nasm_src_get_linnum()));
}
static yasm_preproc *
--:4: symbol references not supported
+-:5: cannot reference symbol `teststringlen' in preprocessor
--:26: warning: (WORK_1:4) 0x4
--:26: warning: (WORK_2:4) 0x4
--:26: warning: (DONT_WORK_1:6) 0x4 0x4
+-:27: warning: (WORK_1:4) 0x4
+-:28: warning: (WORK_2:4) 0x4
+-:29: warning: (DONT_WORK_1:6) 0x4 0x4