Fix issue #4645: Uncrustify breaks on files longer than 10000 lines.#4646
Fix issue #4645: Uncrustify breaks on files longer than 10000 lines.#4646danielgora wants to merge 1 commit into
Conversation
…00 lines. Remove the checks for line numbers being larger than TOO_BIG_VALUE in Chunk::SetOrigLine and ParenStackEntry::SetOpenLine. Fixes: uncrustify#4645 Signed-off-by: Dan Gora <dan.gora@gmail.com>
|
I think we should remove all those "debug" checks about lines/columns/levels/... being to big. I don't see any real benefit having them, unless there was a specific issue I am not aware of. |
|
The code should help finding value underfloww for size_t variable, as soon as possible. |
I don't see the point to be honest. First I doubt there will even be a file with more that 18446744073709551608 lines or columns (and if there is, I am ok with uncrustify failing in such case) and second if we are seeing an underflow of a size_t variable, it means there is a logic error somewhere. The check is just hiding the problem instead of fixing it. |
|
Having the test against the big value give me an oportunity to set a breakpunkt with the program eclipse. We could use another macro to test it only if set. Such as at parsing_frame.cpp with the macro DEBUG_PUSH_POP |
|
IMHO, the checks are fine for things other than the lines, since that clearly breaks when running with files longer than 10000 lines. That's why I only removed the checks for the lines. Changing the value from 10000 to 2^63 isn't going to help anything. You might as well just remove the checks in that case since the program would have to run for 10000 years for the trigger to hit. |
I find restrictive for users to have such limits and again, if the problem was caused by a size_t value that went underflow, the checks are hiding the problem instead of fixing it. |
|
@guy-maurel I tracked down that issue where we were having size_t underflow (see PR #4547). Is that the reason why we introduced the limit checks? |
|
I wanted to repeat my position: |
Yes, that would be perfect. You can build with the option set when you want to be able to add breakpoints for testing, while normal users won't be affected by the tests. |
|
It can be a simple #define in the code, for example: Then when you call cmake, you can pass the value like |
Remove the checks for line numbers being larger than TOO_BIG_VALUE in Chunk::SetOrigLine and ParenStackEntry::SetOpenLine.
Fixes: #4645