EdouardBERGE / rasm

RASM powerful Z80 assembler
132 stars 16 forks source link

Files are included even if the unmatching branch of conditional expression #5

Closed rgiot closed 4 years ago

rgiot commented 4 years ago

it seems that directive are executed in branches that correspond to the wrong case of if/else/endif directive.

For example, this piece of code

USE_EXO = 0
    IF USE_EXO
        ld de, CURRENT_LEVEL_UNCRUNCH_ZONE
        call deexo
        ret
        include 'deexo.asm'
deexo Mizoumizeur (void)
    endif

fails because the deexo.asm file is not present. The appropriate behavior would be to do nothing

fidergo-stephane-gourichon commented 4 years ago

Hi rgiot!

Summary: not reproduced here

To reproduce the error, I just pasted your sample into a file named x.asm and ran rasm x.asm. Result:

Pre-processing [x.asm]
Assembling
Warning: Not a single byte to output

No error.

If I add at the end of the file

        include 'fail.asm'

I correctly get an error

[x.asm:9] file not found [./fail.asm]

Here running

RASM v0.119 (build xx/12/2019) (c) 2017 Edouard BERGE (use -n option to display all licenses)

Next step

Can you double check your setup? Also, please tell your RASM version, OS and other relevant informations. Thanks!

EdouardBERGE commented 4 years ago

Oui le code à l'intérieur d'un IF 0 est analysé, il doit être correct (même si je tolère que les fichiers ne soit pas présent)

Pour désactiver du code, c'est comme en C => utilisation des commentaires

ouuuuups, missing english translation

code inside IF 0 is analysed, he must be almost OK, even i allow include with missing files

that's because IF ENDIF is done after pre-processing

rgiot commented 4 years ago

@fidergo-stephane-gourichon using the exactly same procedure than you, I obtain the error.

cat x.asm && rasm x.asm && rasm --version
USE_EXO = 0
    IF USE_EXO
        ld de, CURRENT_LEVEL_UNCRUNCH_ZONE
        call deexo
        ret
        include 'fake.asm'
deexo Mizoumizeur (void)
    endif

Pre-processing [x.asm]
[x.asm:6] Cannot include file [./fake.asm]
Assembling
1 error
RASM v1.2 nightly (build xx/07/2020) (c) 2017 Edouard BERGE (use -n option to display all licenses / -autotest for self-testing)

@EdouardBERGE ah ok this is an implementation choice. However, I think it is a strong limitation. It should be interesting to put in the documentation. So I close this issue. Thx

cpcitor commented 4 years ago

@fidergo-stephane-gourichon using the exactly same procedure than you, I obtain the error.

Thanks for notifying. My rasm was simply older than the bug. I confirmed bug is solved (from 84762394c956b3ad73f9ccb6e06e132b972b52b6 on).