Weird issue with openspin preprocessor
macca
Posts: 780
Hi,
I'm facing a weird issue when using the preprocessor directives with openspin, I don't understand if it is a bug or I'm missing something, hope someone can help.
The following sample code:
Fails to properly compile the preprocessor directive, no matter how I define it on the command line, it always fails on the bbb statement (should fail on the aaa statement)
However if I remove the OBJ section, the compiler works as expected:
Hope I'm not missing something obvious.
Any hint ?
I'm facing a weird issue when using the preprocessor directives with openspin, I don't understand if it is a bug or I'm missing something, hope someone can help.
The following sample code:
CON _XINFREQ = 5_000_000 _CLKMODE = XTAL1 + PLL16X OBJ debug : "com.serial.terminal" PUB start | temp debug.start(115200) #ifdef MODE1 aaa #else bbb #endif waitcnt(CNT + CLKFREQ)
Fails to properly compile the preprocessor directive, no matter how I define it on the command line, it always fails on the bbb statement (should fail on the aaa statement)
openspin -b -u -DMODE1 preproc.spin Propeller Spin/PASM Compiler 'OpenSpin' (c)2012-2016 Parallax Inc. DBA Parallax Semiconductor. Version 1.00.80 Compiled on Nov 4 2017 20:31:52 Compiling... preproc.spin preproc.spin(18:5) : error : Expected an instruction or variable Line: bbb Offending Item: bbb
However if I remove the OBJ section, the compiler works as expected:
CON _XINFREQ = 5_000_000 _CLKMODE = XTAL1 + PLL16X PUB start | temp 'debug.start(115200) waitcnt(CNT + CLKFREQ) #ifdef MODE1 aaa #else bbb #endif waitcnt(CNT + CLKFREQ) openspin -b -u -DMODE1 preproc.spin Propeller Spin/PASM Compiler 'OpenSpin' (c)2012-2016 Parallax Inc. DBA Parallax Semiconductor. Version 1.00.80 Compiled on Nov 4 2017 20:31:52 Compiling... preproc.spin preproc.spin(12:5) : error : Expected an instruction or variable Line: aaa Offending Item: aaa
Hope I'm not missing something obvious.
Any hint ?
Comments
https://github.com/parallaxinc/OpenSpin/issues/37
Submitted an analysis and proposed patch, for anyone interested.
Be patient someone will be with you very soon. This is a great resource so use it often.