hello all
I found, that program like this is impossible to compile
#define QUARTZ 36000000
const code char *main(void)
{
return (
"EW"
#if QUARTZ/10000000%10==0
"0"
#elif QUARTZ/10000000%10==1
"1"
#endif
);
}
The problem is, that the preprocessor makes an comment between
parts of string and C compiler does not like this
output of preprocessor is:
$sdcpp product_info.c
# 3 "product_info.c"
const code char *main(void)
{
return (
"EW"
# 15 "product_info.c"
);
}
and C compiler result:
$sdcc product_info.c
product_info.c:7: syntax error: token -> '15' ; column 12
product_info.c:10: error 103: code not generated for 'main' due to
previous errors
I'm using the latest snapshot of the sdcc
bye
Logged In: YES
user_id=203539
Can't reproduce it with cygwin-based sdcc.
What platform do you use?
If windoze: could you please try again with LF-only line
ending instead of CR/LF?
The preprocessor emits line number 15, but your source has
only 13 lines. What's the reason? Did you omit anything?
Logged In: YES
user_id=756222
hi Bernhard
I'm sorry.
Seems, that simplifying the source by cancel some empty line, the bug was
svanished.
Please try the attached file.
I'm using the linux version, LF only in the source.
$ sdcc --version
SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.5.4
#1149 (Nov 8 2005) (UNIX)
the file that could not be compiled
Logged In: YES
user_id=756222
the problem is quite simply
if many empty lines are between the parts of string, the preprocessor
inserts an comment and this comment makes the intermediate result
impossible to compile by sdcc
try this:
$ cat t.c
main()
{
return "A"
"B";
}
$ sdcpp t.c
# 1 "t.c"
main()
{
return "A"
# 15 "t.c"
"B";
}
$ sdcc t.c
t.c:4: syntax error: token -> '15' ; column 12
t.c:6: error 103: code not generated for 'main' due to previous errors
Logged In: YES
user_id=568035
Originator: NO
Fixed in SDCC 2.6.2 #4519
Added regression test support/regression/tests/bug-1351710.c
Borut
Logged In: YES
user_id=568035
Originator: NO
Fixed in SDCC 2.6.2 #4519
Added regression test support/regression/tests/bug-1351710.c
Borut