Skip to content

Conversation

@jgarzik
Copy link
Contributor

@jgarzik jgarzik commented Dec 7, 2025

No description provided.

@jgarzik jgarzik requested a review from Copilot December 7, 2025 16:29
@jgarzik jgarzik self-assigned this Dec 7, 2025
@jgarzik jgarzik added bug Something isn't working enhancement New feature or request labels Dec 7, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-asm flag 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.

@jgarzik jgarzik merged commit 4629056 into main Dec 7, 2025
4 checks passed
@jgarzik jgarzik deleted the cc branch December 7, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants