Skip to content

cgen: include stdio for GCC MinGW prelude - #27577

Merged
medvednikov merged 2 commits into
masterfrom
fix-27512-mingw-gcc-stdio
Jun 27, 2026
Merged

cgen: include stdio for GCC MinGW prelude#27577
medvednikov merged 2 commits into
masterfrom
fix-27512-mingw-gcc-stdio

Conversation

@medvednikov

@medvednikov medvednikov commented Jun 27, 2026

Copy link
Copy Markdown
Member

Fixes #27512.

Summary

  • Include <stdarg.h> and <stdio.h> for the GCC+MinGW generated C prelude so varargs macros and system fprintf/vfprintf declarations are visible.
  • Keep the manual formatted-stdio prototype block skipped for GCC+MinGW to avoid mingw-w64 static/extern conflicts.
  • Update the manual stdlib/stdio prelude regression assertions for the new branch ordering.

Testing

  • ./vnew fmt -w vlib/v/gen/c/cheaders.v vlib/v/gen/c/cheaders_manual_stdlib_decls_test.v
  • ./v -g -keepc -o ./vnew cmd/v
  • ./vnew -silent test vlib/v/gen/c/cheaders_manual_stdlib_decls_test.v
  • ./vnew -skip-running -cc x86_64-w64-mingw32-gcc -os windows -o /tmp/v_va_arg_after.exe vlib/v/tests/va_arg_test.v
  • ./vnew -silent vlib/v/gen/c/coutput_test.v
  • ./vnew -silent vlib/v/compiler_errors_test.v
  • ./vnew -cc x86_64-w64-mingw32-gcc -os windows -o /tmp/v_issue_27512_relaxed.exe examples/hello_world.v

Note: ./vnew -silent test vlib/v/ was attempted locally, but the default TCC-backed run on macOS arm64 failed unrelated tests before completion, including tcc_backtrace visibility in link_generated_c_files_test.v, TCC ARM asm support, and path-with-spaces codesign handling.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d593c0042

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vlib/v/gen/c/cheaders.v
@medvednikov
medvednikov merged commit cef604a into master Jun 27, 2026
69 of 93 checks passed
@JalonSolov
JalonSolov deleted the fix-27512-mingw-gcc-stdio branch July 28, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] fprintf miss matching with GCC

1 participant