Skip to content

build: pin -std=c11 for instrument-hooks core.c#84

Open
not-matthias wants to merge 1 commit into
mainfrom
cod-2953-use-stdc11-for-instrument-hooks-in-integrations
Open

build: pin -std=c11 for instrument-hooks core.c#84
not-matthias wants to merge 1 commit into
mainfrom
cod-2953-use-stdc11-for-instrument-hooks-in-integrations

Conversation

@not-matthias

Copy link
Copy Markdown
Member

No description provided.

The Zig-generated dist/core.c is rejected under C23 (GCC 15's default),
so pin C11 via cflags_c (C-only, so the C++ sources are unaffected).
@codspeed-hq

codspeed-hq Bot commented Jun 22, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by ×2.6

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 6 improved benchmarks
❌ 2 regressed benchmarks
✅ 217 untouched benchmarks
⏩ 1 skipped benchmark1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory long body 960 B 6,296 B -84.75%
Memory wait 1ms 7 B 16 B -56.25%
Memory short body 3 25,960 B 11 B ×2,400
Memory one 45.9 KB 14.3 KB ×3.2
Memory wait 500ms 64.1 KB 23 KB ×2.8
WallTime switch 2 336 ns 300 ns +12%
WallTime short body 2.7 µs 2.4 µs +11.62%
WallTime short body 1.6 µs 1.5 µs +10.66%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing cod-2953-use-stdc11-for-instrument-hooks-in-integrations (0b9689b) with main (bcd7e64)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@not-matthias not-matthias marked this pull request as ready for review June 22, 2026 12:14
@greptile-apps

greptile-apps Bot commented Jun 22, 2026

Copy link
Copy Markdown

Greptile Summary

Pins -std=c11 for the C-language compilation step in the native-addon build, specifically targeting src/native_core/instruments/hooks/dist/core.c — the auto-generated Zig-output file from instrument-hooks.

  • Adds cflags_c: [\"-std=c11\"] to pin the C standard when compiling core.c, using the correct C-only flag key so it does not affect C++ compilation units.
  • The auto-generated core.c from instrument-hooks relies on C11 semantics, making this a necessary correctness fix.

Confidence Score: 5/5

Safe to merge — the change is a single, well-scoped compiler flag addition with no logic or API changes.

The fix correctly uses cflags_c (C-only) rather than cflags (all files), so it won't bleed into the C++ compilation units. The auto-generated core.c from instrument-hooks is Zig-output code that requires C11, making this a necessary correctness fix. On Windows, node-gyp routes to MSVC which ignores cflags_c entirely, so there is no cross-platform breakage.

No files require special attention.

Important Files Changed

Filename Overview
packages/core/binding.gyp Adds cflags_c: ["-std=c11"] to pin the C standard when compiling core.c. Correctly uses cflags_c (C-only) rather than cflags (C+C++) so the flag doesn't conflict with C++ compilation of the other sources.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["binding.gyp (node-gyp config)"] --> B{Source file type}
    B -->|".cc / .cpp"| C["cflags_cc applied\n(-Wno-maybe-uninitialized, etc.)"]
    B -->|".c"| D["cflags_c applied\n(-std=c11) NEW"]
    B -->|"all files"| E["cflags applied\n(-g, -Wno-format, etc.)"]
    D --> F["core.c\n(auto-generated from instrument-hooks/Zig)"]
    C --> G["linux_perf.cc\nhooks_wrapper.cc\nnative_core.cc"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["binding.gyp (node-gyp config)"] --> B{Source file type}
    B -->|".cc / .cpp"| C["cflags_cc applied\n(-Wno-maybe-uninitialized, etc.)"]
    B -->|".c"| D["cflags_c applied\n(-std=c11) NEW"]
    B -->|"all files"| E["cflags applied\n(-g, -Wno-format, etc.)"]
    D --> F["core.c\n(auto-generated from instrument-hooks/Zig)"]
    C --> G["linux_perf.cc\nhooks_wrapper.cc\nnative_core.cc"]
Loading

Reviews (1): Last reviewed commit: "build: pin -std=c11 for instrument-hooks..." | Re-trigger Greptile

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.

2 participants