forked from platformio/platformio-core
Fix incorrect line order when converting from INO to CPP and pointer is used
This commit is contained in:
@ -146,6 +146,8 @@ class InoToCPPConverter(object):
|
||||
|
||||
def _get_total_lines(self, contents):
|
||||
total = 0
|
||||
if contents.endswith("\n"):
|
||||
contents = contents[:-1]
|
||||
for line in contents.split("\n")[::-1]:
|
||||
linenum = self._parse_preproc_line_num(line)
|
||||
if linenum is not None:
|
||||
@ -164,7 +166,7 @@ class InoToCPPConverter(object):
|
||||
("|".join(prototype_names)),
|
||||
contents[:split_pos], re.M)
|
||||
if match_ptrs:
|
||||
split_pos = contents.rfind("\n", 0, match_ptrs.start())
|
||||
split_pos = contents.rfind("\n", 0, match_ptrs.start()) + 1
|
||||
|
||||
result = []
|
||||
result.append(contents[:split_pos].strip())
|
||||
|
@ -40,6 +40,8 @@ void myFunction(struct Item *item) {
|
||||
|
||||
}
|
||||
|
||||
#warning "Line number is 43"
|
||||
|
||||
void fooCallback(){
|
||||
|
||||
}
|
||||
|
@ -42,6 +42,8 @@ def test_warning_line(clirunner, validate_cliresult):
|
||||
validate_cliresult(result)
|
||||
assert ('basic.ino:16:14: warning: #warning "Line number is 16"' in
|
||||
result.output)
|
||||
assert ('basic.ino:43:2: warning: #warning "Line number is 43"' in
|
||||
result.output)
|
||||
result = clirunner.invoke(
|
||||
cmd_ci, [join(INOTEST_DIR, "strmultilines"), "-b", "uno"])
|
||||
validate_cliresult(result)
|
||||
|
Reference in New Issue
Block a user