mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
codeview: Look up %include path when determining files to hash.
The hash calculation in calc_md5 tries to open the source file via "filename" again. For %includes, this is the file name that was specified in the %include directive, not the actual name of the file that was opened by the preprocessor. In other words, this fails if the include file is not in the current working directory. Add pp_input_fopen that uses the preprocessor include path lookup code to resolve a file name and open it, and use that in codeview.c. Signed-off-by: Fabian Giesen <fabiang@radgametools.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
3421a3f3f3
commit
0bbc38dbd5
@ -44,6 +44,7 @@
|
||||
|
||||
#include "nasm.h"
|
||||
#include "nasmlib.h"
|
||||
#include "preproc.h"
|
||||
#include "saa.h"
|
||||
#include "output/outlib.h"
|
||||
#include "output/pecoff.h"
|
||||
@ -308,7 +309,7 @@ static void calc_md5(const char *const filename,
|
||||
FILE *f;
|
||||
MD5_CTX ctx;
|
||||
|
||||
f = fopen(filename, "r");
|
||||
f = pp_input_fopen(filename);
|
||||
if (!f)
|
||||
goto done;
|
||||
|
||||
|
17
preproc.c
17
preproc.c
@ -1554,6 +1554,23 @@ static FILE *inc_fopen(const char *file, StrList **dhead, StrList ***dtail,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Opens an include or input file. Public version, for use by modules
|
||||
* that get a file:lineno pair and need to look at the file again
|
||||
* (e.g. the CodeView debug backend). Returns NULL on failure.
|
||||
*/
|
||||
FILE *pp_input_fopen(const char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
StrList *xsl = NULL;
|
||||
StrList **xst = &xsl;
|
||||
|
||||
fp = inc_fopen(filename, &xsl, &xst, true);
|
||||
if (xsl)
|
||||
nasm_free(xsl);
|
||||
return fp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine if we should warn on defining a single-line macro of
|
||||
* name `name', with `nparam' parameters. If nparam is 0 or -1, will
|
||||
|
Loading…
Reference in New Issue
Block a user