Skip to content

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

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

build: pin -std=c11 for instrument-hooks core.c#128
not-matthias wants to merge 1 commit into
masterfrom
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 in the native extension build.
@codspeed-hq

codspeed-hq Bot commented Jun 22, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 2.8%

⚠️ 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

⚡ 22 improved benchmarks
❌ 15 regressed benchmarks
✅ 240 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime test_sum_of_squares[sum_of_squares_sum_labmda_product] 279.3 µs 301.2 µs -7.27%
Memory test_multiprocessing_map[10000] 3.5 MB 3.8 MB -7.25%
WallTime test_multiprocessing_map[1000] 57.6 ms 61.2 ms -5.9%
WallTime test_is_complete[board0] 1.8 µs 1.9 µs -4.8%
WallTime test_combination_sum[candidates0-8] 11.3 µs 11.8 µs -4.73%
WallTime test_hostname_resolution[google.com] 396.6 µs 413 µs -3.98%
WallTime test_open_close_fd[10] 92.1 µs 95.8 µs -3.82%
WallTime test_open_knight_tour[1] 4.3 µs 4.4 µs -3.73%
WallTime test_make_highshelf 7.6 µs 7.9 µs -3.69%
WallTime test_array_alloc[100000] 189 µs 194.7 µs -2.91%
WallTime test_pipe_communication[1000] 6.5 ms 6.7 ms -2.73%
WallTime test_generate_all_permutations[sequence1] 163.8 µs 168.4 µs -2.72%
WallTime test_color[graph0-3] 30.5 µs 31.1 µs -2.2%
WallTime test_fs_write[1000000] 2.7 ms 2.7 ms -2.16%
WallTime test_hostname_resolution[localhost] 121.2 µs 123.8 µs -2.07%
Memory test_multiprocessing_map[1000] 4.8 MB 3.3 MB +46%
Memory test_multiprocessing_map[100] 3.5 MB 2.8 MB +22.59%
WallTime test_tcp_connection[1.1.1.1-53] 964.4 µs 837 µs +15.22%
Memory test_multiprocessing_map[10] 3.9 MB 3.4 MB +13.97%
WallTime test_sum_of_squares[sum_of_squares_sum_labmda_power] 359.8 µs 325.7 µs +10.46%
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

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 (65832cc) with master (b2d12d8)

Open in CodSpeed

@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 the C standard to C11 when building the native dist_instrument_hooks extension by adding -std=c11 to extra_compile_args in setup.py. This aligns the Python package build with how the upstream instrument-hooks CI already compiles core.c (see test-gcc-versions and test-clang-versions jobs), fixing build failures on stricter toolchains that default to an older C standard.

  • Adds -std=c11 as the first entry in extra_compile_args, matching the standard used by the upstream gcc/clang CI jobs that compile dist/core.c.
  • The flag is not part of upstream's COMMON_CFLAGS env var (which the code comment references for sync), but is applied per-job alongside it — the fix is correct regardless.

Confidence Score: 5/5

Safe to merge — adds a single, well-supported compiler flag that the upstream project already requires when building the same source file.

The change is a one-line addition of -std=c11 to the compile flags for core.c. The upstream instrument-hooks CI already passes -std=c11 explicitly when compiling core.c with both GCC (versions 9–15) and Clang (versions 13–19), confirming the flag is expected and correct. All target platforms (Linux x86_64/aarch64, macOS arm64) use compilers that support C11 without issue.

No files require special attention.

Important Files Changed

Filename Overview
setup.py Adds -std=c11 to the C extension compile flags, consistent with how instrument-hooks CI tests core.c (gcc/clang version jobs pass -std=c11 alongside COMMON_CFLAGS).

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[setup.py] --> B{IS_EXTENSION_BUILDABLE?}
    B -- Yes --> C[Build native_extension]
    B -- No --> D[No ext_modules]
    C --> E["extra_compile_args\n-std=c11 NEW\n-Wno-format\n-Wno-format-security\n-Wno-unused-but-set-variable\n-Wno-unused-const-variable\n-Wno-type-limits\n-Wno-uninitialized"]
    E --> F[Compile instrument_hooks_module.c]
    E --> G[Compile instrument-hooks/dist/core.c]
    F & G --> H[dist_instrument_hooks.so]
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[setup.py] --> B{IS_EXTENSION_BUILDABLE?}
    B -- Yes --> C[Build native_extension]
    B -- No --> D[No ext_modules]
    C --> E["extra_compile_args\n-std=c11 NEW\n-Wno-format\n-Wno-format-security\n-Wno-unused-but-set-variable\n-Wno-unused-const-variable\n-Wno-type-limits\n-Wno-uninitialized"]
    E --> F[Compile instrument_hooks_module.c]
    E --> G[Compile instrument-hooks/dist/core.c]
    F & G --> H[dist_instrument_hooks.so]
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