gnupic: Trouble with macros conditionally generating code
Subject:
Re: Trouble with macros conditionally generating code
From:
Pete Elmore ####@####.####
Date:
22 Nov 2004 14:30:41 +0000
Message-Id: <41A1F859.8050601@petta-tech.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
In response to the request for a short, complete program that reproduces
the problem I'm talking about:
pete@bob:~$ cat t.s
~ processor 16f877
if(main == 0)
~ nop
endif
main:
end
pete@bob:~$ gpasm t.s
t.s:5:Error [116] Value of symbol "main" differs on second pass
~ pass 1=0, pass 2=1
I've generalized this a bit; really it has nothing to do with macros.
It's a problem with the preprocessor. To clarify, I don't have a
problem with the fact that the assembler refuses to assemble the
program; no assembler could assemble the above program. What I don't
like is the error message. This is how gas handles the same thing:
pete@bob:~$ cat u.s
.org 0
.if (_start == 0)
~ nop
.endif
_start:
pete@bob:~$ as u.s
u.s: Assembler messages:
u.s:2: Error: non-constant expression in ".if" statement
Notice that with gas's error message, the problem is obvious.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org
iD8DBQFBofhZv24lB609Ih8RAtfDAKCbonDfywtzKOhb498cKUIU7vaQawCfd2aj
FFcYAWWIIBBWgHB2SzP8TfY=
=/1Nk
-----END PGP SIGNATURE-----