On 1 July 2012 05:29, Byron Jeff wrote: > That's exactly what he's trying to do. The problem is that the assembler > doesn't allow for any text to exist after the end statement. So if you tr= y > to conditionally include/exclude it, then the #endif afterwards generates > an an error. > After the end statement the compiler should not read anything ans should not cause a problem -- Having said that, when you do an #ifdef and then there is an 'end' statement, then the compiler does not read the #endif therefore you have an unpaired #ifdef and that's a problem. I agree that the preprocessor should be completely separated from the compiler and therefore this should not be an issue, but my point is that it is not a good idea to put that end statement into conditional compiling directive. So b.asm should be: ; b.asm #ifndef STANDALONE .... #endif and a.asm should be: ; a.asm .... include "b.asm" .... end Also consider, that an include file should not be named xxx.asm but xxx.inc so you know that you are going to include that into an .asm file -- hence the end statement is missing at the end ad that is perfectly all right. after all, your project looks like: ; a.asm .... include "b.inc" .... end ; b.inc #ifndef STANDALONE .... #endif The other solution is what Byron mentioned, you do NOT include the b.asm, but compile it to an object file and link them together (then you continue to use the asm extension and the end statement...). Tamas > Consider two modules a.asm and b.asm. b.asm is the piece with the > conditional end. If can either be assembled standalone (so it needs the > end) or can be included in a.asm (which has its own end). So a.asm would > be: > > ; a.asm > ... > include "b.asm" > ... > end > > and b.asm would be: > > ; b.asm > ... > #ifdef STANDALONE > end > #endif > > So if STANDALONE is defined, the end statement is included into b.asm > otherwise left out. Now everything works with the inclusion into a.asm. > However, when b.asm is assembled with the STANDALONE symbol, the #endif > after the end statement causes the aforementioned error. > > Of course I think you have the solution below: > > > > > Btw, you can try "-DSOME_SYMBOL=3Dend" or "#SOME_SYMBOL end", and then = just > > put the SOME_SYMBOL if you insist with your approach. > > And the SOME_SYMBOL would have to be the last line of the module. This > should work. > > BAJ > > > > > Tamas > > > > > > On 30 June 2012 02:19, Peter wrote: > > > > > I post here since gpasm requires yet another mailing list subscriptio= n, > > > which I > > > do not have time to manage. I hope that this message will be forwarde= d > to > > > the > > > gpasm maintainer(s). > > > > > > While using gpasm-0.14.1 (Mar 7 2012), a construct like: > > > > > > #ifdef SOME_SYMBOL > > > end > > > #endif > > > > > > fails with an error message along the lines of '#endif expected' (at > end). > > > This > > > is a bug imho, the #ifdef etc. is to be treated as a preprocessor > > > directive as > > > in C, and should issue at most a warning in this case. As it is, the > > > feature > > > prevents a test unit from being embedded in an asm file. The intent i= s > to > > > be > > > able to assemble a test unit from the same source using a command lin= e > > > switch > > > such as -DSOME_SYMBOL . The same unit can be assembled as > > > subroutine/library > > > without said symbol (or when defining another). > > > > > > I believe that the error caused by end encountered before an expected > > > #endif (or > > > several, should be a warning which should be promotable to an error, > and > > > not an > > > error per se, around which there is no workaround. > > > > > > thanks, > > > Peter > > > > > > > > > -- > > > http://www.piclist.com PIC/SX FAQ & list archive > > > View/change your membership options at > > > http://mailman.mit.edu/mailman/listinfo/piclist > > > > > > > > > > > -- > > int main() { char *a,*s,*q; printf(s=3D"int main() { char *a,*s,*q; > > printf(s=3D%s%s%s, q=3D%s%s%s%s,s,q,q,a=3D%s%s%s%s,q,q,q,a,a,q); }", > > q=3D"\"",s,q,q,a=3D"\\",q,q,q,a,a,q); } > > -- > > http://www.piclist.com PIC/SX FAQ & list archive > > View/change your membership options at > > http://mailman.mit.edu/mailman/listinfo/piclist > > -- > Byron A. Jeff > Department Chair: IT/CS/CNET > College of Information and Mathematical Sciences > Clayton State University > http://cims.clayton.edu/bjeff > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 int main() { char *a,*s,*q; printf(s=3D"int main() { char *a,*s,*q; printf(s=3D%s%s%s, q=3D%s%s%s%s,s,q,q,a=3D%s%s%s%s,q,q,q,a,a,q); }", q=3D"\"",s,q,q,a=3D"\\",q,q,q,a,a,q); } --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .