-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
GH-125521: Remove if (true)
from generated output to reduce C compiler warnings
#125700
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,16 +165,24 @@ def error_if( | |
storage: Storage, | ||
inst: Instruction | None, | ||
) -> bool: | ||
self.out.emit_at("if ", tkn) | ||
lparen = next(tkn_iter) | ||
self.emit(lparen) | ||
assert lparen.kind == "LPAREN" | ||
first_tkn = tkn_iter.peek() | ||
emit_to(self.out, tkn_iter, "COMMA") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't it be simpler to just add an unconditional There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That wouldn't prevent anyone writing |
||
unconditional = always_true(first_tkn) | ||
if unconditional: | ||
next(tkn_iter) | ||
comma = next(tkn_iter) | ||
if comma.kind != "COMMA": | ||
raise analysis_error(f"Expected comma, got '{comma.text}'", comma) | ||
self.out.start_line() | ||
else: | ||
self.out.emit_at("if ", tkn) | ||
self.emit(lparen) | ||
emit_to(self.out, tkn_iter, "COMMA") | ||
self.out.emit(") ") | ||
label = next(tkn_iter).text | ||
next(tkn_iter) # RPAREN | ||
next(tkn_iter) # Semi colon | ||
self.out.emit(") ") | ||
storage.clear_inputs("at ERROR_IF") | ||
c_offset = storage.stack.peek_offset() | ||
try: | ||
|
@@ -196,7 +204,7 @@ def error_if( | |
self.out.emit(label) | ||
self.out.emit(";\n") | ||
self.out.emit("}\n") | ||
return not always_true(first_tkn) | ||
return not unconditional | ||
|
||
def error_no_pop( | ||
self, | ||
|
Uh oh!
There was an error while loading. Please reload this page.