[Nasm-devel] [PATCH] Handling TASM non-quoted include filenames

H. Peter Anvin hpa at zytor.com
Mon Feb 5 13:52:17 PST 2024


On 1/25/24 12:19, Ray Ransom wrote:
> TASM non-quoted include filenames:
> ==================================
> 
> This is pretty simple.  No long description is required.
> 
> preproc.c (2.16.02rc7)  line 4306:
> ----------------------
>      case PP_INCLUDE:
>          if (tasm_compatible_mode)
>          {
>            j = (int)TOKEN_ID;       // TASM include names are not quoted
>            goto IntReq;
>          }
>      case PP_REQUIRE:
>          j = (int)TOKEN_STR;
>          IntReq:
>          t = tline->next = expand_smacro(tline->next);
>          t = skip_white(t);
> 
>          if (!t || (t->type != (enum token_type)j &&
>                     t->type != TOKEN_INTERNAL_STR)) {
> 
> Signed-off-by: Ray M. Ransom <nasm at micosyen.com>
> 
> I've never submitted a patch before, so please advise if there is 
> addition protocol required.  I have another, bigger patch, but I will 
> wait and see how this goes before submitting it.

The protocol is documented in the file SubmittingPatches. The best way 
is to put your changes into a git repository with a good commit 
description(s), and then use "git format-patch" to produce a series of 
patch emails.

I have a couple of concerns with this:

1. This will break if there are multi-token filenames, e.g. 
"sys/foo.inc" or "foo+bar.inc".

2. This breaks people adding NASM-style directives which *are* quoted, 
and that is not OK.

3. I don't particularly like special-casing tasm mode if there isn't a 
strong syntactical requirement for it, and I *definitely* don't like 
treating filenames inconsistently across the process.

Perhaps the easiest would be to add include as a macro to the TASM macro 
set in macros/stdmac.mac; the 1+ will deal with the multi-token issue.

%imacro include 1+.nolist
  %ifstr %1
   %include %1
  %else
   %include %str(%1)
  %endif
%endmacro

Could you perhaps try that out and see if that does what you need?

	-hpa


More information about the Nasm-devel mailing list