cake icon indicating copy to clipboard operation
cake copied to clipboard

backslash-newline can split text anywhere

Open madebr opened this issue 2 years ago • 2 comments

https://gcc.gnu.org/onlinedocs/cpp/Initial-processing.html

This is a valid C program on which cake fails:

i\
n\
t\
 \
m\
a\
i\
n\
(\
)\
{\
r\
e\
t\
u\
r\
n\
 \
0\
;\
}

madebr avatar Nov 06 '23 15:11 madebr

It may be a regression after implementation some warnings. On online http://thradams.com/cake/playground.html select [Extensions] and [line slicing checks]

But all all these are suppose to be just warnings and not error so it is a bug.

thradams avatar Nov 06 '23 18:11 thradams

Because cake must "rebuild" source code line slicing are preserved (instead of discarded) inside tokens. When required, for instance to add into a symbol table or compare tokens these line slicing needs to be ignored. (See remove_line_continuation) The implementation of is_keyword is wrong because it using strcmp. We need something line token compare that ignores line slicing. See also https://github.com/thradams/cake/blob/main/docs/remove_phase_2.md

thradams avatar Nov 06 '23 18:11 thradams