Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for goto statements, enhances preprocessor macro support, and improves CLI compatibility with standard C compilers.
- Implements goto statement handling in the linearizer with proper basic block termination and dead code handling
- Adds comprehensive predefined macros for stdint.h, stddef.h, and inttypes.h compatibility (type definitions, limits, format specifiers)
- Enables _has* feature detection macros in preprocessor conditional expressions
- Replaces non-standard
--dump-asmflag with standard-S -o -for assembly output
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| cc/token/preprocess.rs | Adds architecture-specific macro definitions during preprocessor initialization and implements __has_attribute/__has_builtin/__has_feature/__has_extension support in preprocessor conditional expressions |
| cc/tests/pcc/mod.rs | Adds three comprehensive tests for goto statement functionality (forward jump, backward jump/loop, and multiple labels) |
| cc/tests/features/debug.rs | Updates test commands from --dump-asm to -S -o - to align with standard compiler CLI conventions |
| cc/main.rs | Removes deprecated --dump-asm flag and implements -S -o - for assembly output to stdout |
| cc/linearize.rs | Implements proper goto statement handling by setting current_bb to None after branch emission to mark subsequent code as unreachable |
| cc/arch/x86_64/codegen.rs | Simplifies block label emission to always use block ID labels for consistency with IR jumps, removing special handling for C source labels |
| cc/arch/aarch64/codegen.rs | Applies the same block label simplification as x86_64 for consistency |
| cc/arch/mod.rs | Adds six new helper functions providing comprehensive predefined macros for stdint.h, stddef.h, and inttypes.h compatibility |
| cc/arch/lir.rs | Removes unused Directive::Raw variant that was previously used for custom label formatting |
| cc/TODO.md | Adds detailed implementation guides for future C11 features (complex numbers, alignment, thread-local storage) |
| cc/README.md | Updates documentation to reflect goto support and standardized CLI flags |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.