-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[rint] Properly support line continuation after backslash \ #8762
Copy link
Copy link
Closed
Description
- Checked for duplicates
Describe the bug
Although cling supports continuation for lines ending with , or \, it seems to fail in the ROOT prompt, i.e.
root [0] const char *s = "string " \
root (cont'ed, cancel with .@) [1]"literal"
ROOT_prompt_0:1:26: error: expected ';' at end of declaration
const char *s = "string " \
^
;
This issue is closely related to JIRA issue ROOT-9202. The problem seems to be in TRint.cxx, which unconditionally inserts a #line PP directive before each input line. This is especially visible here:
root [0] #define def(arg) printf("%s\n", \
root (cont'ed, cancel with .@) [1]arg);
ROOT_prompt_0:2:2: error: '#' is not followed by a macro parameter
#line 1 "ROOT_prompt_1"
^
ROOT_prompt_0:3:4: error: extraneous ')' before ';'
arg);
Expected behavior
As discussed, #line directives should not be inserted if the last input line ends with \.
root [0] const char *s = "string " \
root (cont'ed, cancel with .@) [1]"literal"
(const char *) "string literal"
Reactions are currently unavailable