Skip to content

[rint] Properly support line continuation after backslash \  #8762

@jalopezg-git

Description

@jalopezg-git
  • 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"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions