You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ spatch.opt --recursive-includes --include-headers-for-types --verbose-includes --verbose-parsing --parse-c main.c
init_defs_builtins: /home/mrc0mmand/repos/coccinelle/standard.h
PARSING: main.c
failed on stdio.h
including ./macro.h
TYPEDEF: disable typedef cos special case: DIGITS
(ONCE) CPP-TYPEDEF: promoting:(1) DIGITS on line 5
ERROR-RECOV: found sync '}' at line 10
parsing pass2: try again
TYPEDEF:_handle_typedef=false. Not normal if don't come from exn
ERROR-RECOV: found sync '}' at line 10
parsing pass3: try again
ERROR-RECOV: found sync '}' at line 10
parse error
= File "main.c", line 5, column 25, charpos = 81
around = 'DIGITS',
whole content = const char *digits = DIGITS DIGITS;
badcount: 8
bad: #include "macro.h"
bad:
bad: int main(void) {
BAD:!!!!! const char *digits = DIGITS DIGITS;
bad:
bad: puts(digits);
bad:
bad: return 0;
bad: }
-----------------------------------------------------------------------
maybe 10 most problematic tokens
-----------------------------------------------------------------------
DIGITS: present in 2 parsing errors
example:
int main(void) {
const char *digits = DIGITS DIGITS;
digits: present in 1 parsing errors
example:
int main(void) {
const char *digits = DIGITS DIGITS;
main: present in 1 parsing errors
example:
int main(void) {
const char *digits = DIGITS DIGITS;
-----------------------------------------------------------------------
NB total files = 1; perfect = 0; pbs = 1; timeout = 0; =========> 0%
nb good = 1, nb passed = 0 =========> 0.00% passed
nb good = 1, nb bad = 8 =========> 11.11% good or passed
The text was updated successfully, but these errors were encountered:
JuliaLawall
changed the title
spatch struggles with literal concantenationspatch struggles with literal concatenation
Dec 30, 2023
Coccinelle works on C code before the preprocessing step, so it can't understand the DIGITS token.
I ran into a similar macro-related limitation and the solution was to add simplified definitions of "problematic" macros in a header dedicated to Coccinelle usage using the spatch --macro-file option.
spatch
throws a parse error when concatenating two or more string literals defined elswhere and assigning the result to a variable:The text was updated successfully, but these errors were encountered: