Commit Graph

4 Commits

Author SHA1 Message Date
H. Peter Anvin (Intel)
5b7369d7e0 Make debug info and error messages correctly reflect macros and reps
1. Error messages would issue with the line number of %endrep.
2. Debug line information would ignore both macros and reps.
   This is doubly wrong; macros are semantically equivalent to
   inline functions, and it is expected that debuggers trace
   into these functions.

These changes finishes the last parts of moving all responsibility for
the listing enable/disable into the preprocessor, so remove the
way over-complicated macro inhibit facility from the listing module
entirely.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-05 02:16:13 -07:00
H. Peter Anvin (Intel)
b292748d9f preproc, srcfile: much saner handling of %line directives
%line directives really need to be preprocessed early, before normal
directive processing. In particular, they are *not* affected by such
thing as smacro expansion, or deferred into an mmacro expansion.

The %line directive is special because it is explicitly indented to be
inserted by an external preprocessor, which can happen at any point.

For mmacro and rep expansions, store the current file and line for
each expansion line. Similarly, let each istk entry contain such
information.

Don't emit empty lines in preprocessing-only mode when we are
already required to issue a %line directive anyway. This cuts down on
clutter a fair bit.

Quote filenames in %line directives (and accept quoted filenames in
%line directives) if and only if it is necessary for
disambiguation. This is required if:

1. The filename contains control characters;
2. The filename begins or ends with whitespace or a quotation mark;
3. The filename is empty.

Otherwise issue the filename as-is, for backwards compatibility.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-14 20:09:11 -07:00
H. Peter Anvin
026b62f264 srcfile: simplify and make most functions inline
Simplify the srcfile subsystem by making it official that any pointer
passed to src_get() needs to have been obtained from the srcfile
subsystem itself.

Move a lot of the srcfile operations into inline code; often they
amount to a single machine instruction...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 23:28:01 -08:00
H. Peter Anvin
1aa794527f Move srcfile.c to asm/
srcfile.c is not used by anything outside asm/, so move it there.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 23:03:04 -08:00