#100 The -U option is not there


Hello, guys!

I am an old NASM user for now! Since my bare Assembly
necessities diminished through time, I kept using the old
NASM 0.98bf. But recently I had to translate some
gigantic sources. The branch offsets were causing me
troubles, as I got tired to write "jmp short" and so on.
So I downloaded the latest NASM I could find.

Unfortunately, the latest (as we speak) NASM 0.98.36 is
missing one of the features I direly need: -U, aka
undefine in command line (true for DOS/DJGPP, Windows
and Linux versions). So I grabbed the NASM sourcetree
(nasm-0.98.36.tar.bz2) and browsed the files. I found
how to re-implement the -U feature.

Now, the project I am working on is a public project.
Users get tired when they see the compilation process
involves the re-compilation of the assembler. Distributing
the NASM patches along with the project tarball is not
an option.

OTOH, the -U option is documented as working. So why
not *MAKING* it work? Here are the DIFF output files I
got (the *.org denote ORIGINAL file):

*** nasm.c.org Mon Feb 24 22:22:48 2003
--- nasm.c Wed Jun 11 12:51:04 2003
*************** static int process_arg (char *p,
char *q
*** 378,383 ****
--- 378,385 ----
case 'E':
case 'F':
case 'X':
+ case 'u':
+ case 'U':
if ( !(param = get_param (p, q, &advance)) )
if (p[1]=='o') { /* output file */

*** preproc.c.org Thu Sep 12 02:23:54 2002
--- preproc.c Sun May 18 19:26:40 2003
*************** pp_pre_undefine(char *definition)
*** 4429,4434 ****
--- 4429,4435 ----

space = new_Token(NULL, TOK_WHITESPACE, NULL,
def = new_Token(space, TOK_PREPROC_ID, "%
undef", 0);
+ space->next = tokenise(definition);

l = nasm_malloc(sizeof(Line));
l->next = predef;

I hope I got it right :) Keep up the good work!


  • Daniel Borca
    Daniel Borca

    Patches for -U

  • Logged In: NO

    Good catch.

    Looks fine to me. Should go in.

  • Frank Kotler
    Frank Kotler

    Logged In: YES

    The "-U" switch will be there in 0.98.37 - or you should be
    able to grab it off CVS now.

    Thanks a lot, Daniel! That's what we like to see -
    complaints with ready-to-apply patches!!!

    I would have sworn I fixed that way back around when 0.98bf
    came out, but if I did, it didn't stay fixed.

    Thanks again,

  • Logged In: NO

    In my local NASM tree I have added support for -d and -D
    as well as -u and -U. While the lower-case variants result
    in case-insensitive behavior (a la NASM), the upper-case
    variants result in case-sensitive behavior (a la the good
    old C preprocessor).

    Just my $0.02.

  • H. Peter Anvin
    H. Peter Anvin

    • status: open --> closed