gnupic: Trouble with macros conditionally generating code


Previous by date: 22 Nov 2004 16:26:26 +0000 Re: Trouble with macros conditionally generating code, Pete Elmore
Next by date: 22 Nov 2004 16:26:26 +0000 C compiler for 16F87X, Ricardo
Previous in thread: 22 Nov 2004 16:26:26 +0000 Re: Trouble with macros conditionally generating code, Pete Elmore
Next in thread:

Subject: Re: Trouble with macros conditionally generating code
From: Craig Franklin ####@####.####
Date: 22 Nov 2004 16:26:26 +0000
Message-Id: <41A1BF6A.4070104@users.sourceforge.net>

Pete Elmore wrote:

> -----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.


All gpasm messages are roughly equivalent to the mpasm messages.  In 
this case they are very close.  I agree that the message is a little 
cryptic.  This is mainly because it is a general purpose error that 
handles more than just this case.

Adding a new type of error message is risky.  It could cause some 
existing code not to compile.  Although the code is probably flawed, 
there is a lot of flawed code that gpasm has to assemble.  Not 
assembling an existing project is a more critical problem than the 
contents of an error message being cryptic.

Maybe as a compromise, I should generate a non-constant expression 
warning on the IF expression and leave the error message as is.  My only 
concern is if it became a nuisance warning, everyone would ignore it.  
Can anyone think of a legitimate case when a non-constant if expression 
is required?

> 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-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
>
>


Previous by date: 22 Nov 2004 16:26:26 +0000 Re: Trouble with macros conditionally generating code, Pete Elmore
Next by date: 22 Nov 2004 16:26:26 +0000 C compiler for 16F87X, Ricardo
Previous in thread: 22 Nov 2004 16:26:26 +0000 Re: Trouble with macros conditionally generating code, Pete Elmore
Next in thread:


Powered by ezmlm-browse 0.20.