Skip to content

[P3] __DATE__ hardcoded to 'Jan 1 2025' instead of actual compilation date #173

@ChaseWNorton

Description

@ChaseWNorton

Problem

In `src/frontend/preprocessor/predefined_macros.rs:154`, `DATE` is hardcoded to `"Jan 1 2025"` instead of the actual compilation date. While hardcoding improves build reproducibility, it breaks code that uses `DATE` for build versioning.

GCC uses the actual date unless `SOURCE_DATE_EPOCH` is set for reproducible builds.

```c
const char *built = DATE;
// GCC: "Feb 6 2026" (actual date)
// CCC: always "Jan 1 2025"
```

Suggested approach

Use the actual date by default, but respect `SOURCE_DATE_EPOCH` environment variable for reproducible builds (matching GCC/Clang behavior).

Files to modify

  • `src/frontend/preprocessor/predefined_macros.rs` — Use `chrono` or `std::time` for actual date, with `SOURCE_DATE_EPOCH` override

Acceptance criteria

  • `DATE` reflects actual compilation date
  • `TIME` reflects actual compilation time (if also hardcoded)
  • `SOURCE_DATE_EPOCH` env var overrides to a fixed date for reproducibility
  • `cargo test --lib` passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions