Last line comment produces an error (without a newline at the end)
I noticed that if the last line of an analysed file includes a double-slash comment (e.g: "#endif // FOO") without a newline at the end, vera++ quits the entire analysis with a single error message, such as:
#!
error: test.h:11: illegal token in column 8, giving up (hint: fix the file or remove it from the working set)
while executing
"getAllLines $f"
("foreach" body line 4)
invoked from within
"foreach f [getSourceFileNames] {
set lineNumber 1
set previousIndent ""
foreach line [getAllLines $f] {
if [regexp {^.*[[:space:]..."
(file "C:/vera++-1.2.1.win/lib/vera++/scripts/rules/L001.tcl" line 6)
A comment should be allowed in a case like this. The used vera++ version is 1.2.1 on a Windows Server 2008 platform.
Comments (17)
-
-
Same here. When can we expect this to be fixed?
-
Sorry for the very late answer. We were quite busy the last months.
Thank you for reporting the issue. I will have a look at this.
It is totally a valid use case.
-
I also encountered this bug in 1.2.1. The problem is in Tokens::parse() which affects multiple rules making it difficult to work around.
-
Added a test case for the L001 rule (no trailing whitespace). refs #34
→ <<cset 5bccfe3d5f94>>
-
Account Deleted Hi guys, anyone has fixed this or has some workaround yet? Thanks
-
Hi,
We are still brainstorming about this issue. We have a patch but we are not satisfied with it. This bug has pointed out a little design issue which we are working on at the moment.
Besides it seems that a comment without a carriage return is not a valid c++ sequence.
Thanks for your concern. We will provide more feedback once we have decided how to fix this correctly.
-
invalid tokens now generates an internal report and are non blocking - see #34
→ <<cset ddac46a5881a>>
-
Could you check that this bug is fixed in
master
? -
Still same behavior here. Last line:
Produces error:
#endif // __FILE_H
OK:
#endif /* __FILE_H */
-
Sorry for the long delay to reply and the lack of description of the expected behavior.
The token is actually invalid, so an error must be produced. However the error is now non blocking and does not prevent to parse the tokens before it or the other files.
-
I have also encountered this issue, but I see there hasn't been an install uploaded since the fix. Are there any plans to upload a new install file any time soon ?
-
Yes, there are such plans, but I've said that once already and we didn't had time to make the release, so I prefer to not announce any date
-
It seems the only way (at the moment) is that all files should end with a line break.
-
- changed title to Last line comment produces an error (without a newline at the end)
-
Any progress on this?, or at least, any workaround without modifying analyzed source files? Thanks!
-
Sorry, nothing new regarding this issue. As said earlier by Gaëtan this is an invalid token. Vera++ is able to provide an error and go on without crashing. So far we could only provide this.
Best regards
- Log in to comment
see the same behaviour here