-
Notifications
You must be signed in to change notification settings - Fork 274
goto-cc: newlines in command files are just whitespace #6595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
goto-cc: newlines in command files are just whitespace #6595
Conversation
GCC's doc says that options are separated by whitespace, with no particular significance of newlines. Therefore, process the entire file at once rather than line-by-line. Fixes: diffblue#6592
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving because this is an improvement on the existing behaviour, and fixes a known bug. I've left a comment for consideration, but that may just be something to raise as a new bug, rather than to be fixed in this PR.
{ | ||
// erase leading whitespace | ||
line.erase(0, line.find_first_not_of("\t ")); | ||
all_lines << ' ' << line; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this will effectively be replacing newlines with single spaces... it may be an edge case that we really don't care about too much, but just to check have you considered how this may/may not play with the quoting and escaping rules for @files ? It looks to me like theoretically a "backslash, newline" sequence is valid and should be preserved as a newline, for instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good call-out, but I'm not entirely sure how where I might be able to put such a newline. The following won't work with GCC:
-o
file.gb
-Dhello=" \
"
test.c
With the above, hello
just expands to an empty token. I also tried
-o
file.gb
'-Dhello=" \
"'
test.c
but then I even get a warning:
<command-line>:0:7: warning: missing terminating " character
Any ideas what else I might try?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats good enough for me to think that "theoretically" doesn't map to "actually supported by gcc in reality" :-)
Codecov Report
@@ Coverage Diff @@
## develop #6595 +/- ##
===========================================
+ Coverage 76.21% 76.48% +0.26%
===========================================
Files 1578 1578
Lines 181393 181385 -8
===========================================
+ Hits 138253 138736 +483
+ Misses 43140 42649 -491
Continue to review full report at Codecov.
|
GCC's doc says that options are separated by whitespace, with no
particular significance of newlines. Therefore, process the entire file
at once rather than line-by-line.
Fixes: #6592