Repository navigation
Conversation
On Windows builds, the include path for vibe.h is sometimes presented with mixed slashes (e.g. "fastled6/./src\fl/audio/detector/vibe.h"), which can defeat `#pragma once`'s file-identity check. When vibe.h is included both via audio_processor.h and via tests/fl/audio/detector/vibe.hpp, the resulting translation unit sees VibeLevels and Vibe defined twice and fails with a redefinition error. Fix: add a classic `#ifndef FL_AUDIO_DETECTOR_VIBE_H` guard alongside the existing `#pragma once`. This matches the belt-and-suspenders pattern already used in audio_processor.h and is content-based (path-agnostic), so it deduplicates regardless of how the include path is spelled. Verified with `bash test --cpp`: 299/299 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded a conventional include guard to the header file using preprocessor directives ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
this is the wrong fxi, the right fix is normalization of the paths that clang is presented with FROM us |
On Windows, Meson's `include_directories()` propagates `-I` flags using native backslash + relative-path spellings (e.g. `-I..\..\src\platforms\stub`). Clang keys `#pragma once` deduplication on the raw resolved path string — if the same directory reaches a translation unit via two different spellings (forward slash vs backslash, absolute vs relative), the header appears to be two different files and `#pragma once` is silently defeated, producing double-definition errors (#2324, #2325). This change ensures every `-I` flag we generate is absolute + forward-slash + spelled identically everywhere: * Add canonical `path_norm_*` -I args in ci/meson/shared/meson.build (path_norm_I_root, path_norm_I_src, path_norm_I_tests, path_norm_I_stub). Every consumer meson.build references these instead of redeclaring. * Replace every project-wide `include_directories(...)` consumer (`include_directories: [src_dir, stub_dir, ...]`) with explicit absolute cpp_args. This stops Meson from injecting relative backslash `-I` flags into the propagated compile lines. * For per-example discovered include dirs, build absolute forward-slash `-I` args from the discovered relative path via the `/` operator and the canonical `path_norm_root` prefix, replacing the previous `include_directories(inc_dir_fixed)` call. * Remove the `#ifndef FL_AUDIO_DETECTOR_VIBE_H` belt-and-suspenders guard added in #2325. With all `-I` flags normalized, `#pragma once` alone is sufficient. Verified with `bash test --cpp`: 300/300 tests pass. * Add ci/tests/test_meson_include_paths.py — a CI check that parses `.build/meson*/compile_commands.json` after setup and fails if any non-Meson-auto `-I` flag contains a backslash or is not absolute. Fixes #2328. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
On Windows, Meson's `include_directories()` propagates `-I` flags using native backslash + relative-path spellings (e.g. `-I..\..\src\platforms\stub`). Clang keys `#pragma once` deduplication on the raw resolved path string — if the same directory reaches a translation unit via two different spellings (forward slash vs backslash, absolute vs relative), the header appears to be two different files and `#pragma once` is silently defeated, producing double-definition errors (#2324, #2325). This change ensures every `-I` flag we generate is absolute + forward-slash + spelled identically everywhere: * Add canonical `path_norm_*` -I args in ci/meson/shared/meson.build (path_norm_I_root, path_norm_I_src, path_norm_I_tests, path_norm_I_stub). Every consumer meson.build references these instead of redeclaring. * Replace every project-wide `include_directories(...)` consumer (`include_directories: [src_dir, stub_dir, ...]`) with explicit absolute cpp_args. This stops Meson from injecting relative backslash `-I` flags into the propagated compile lines. * For per-example discovered include dirs, build absolute forward-slash `-I` args from the discovered relative path via the `/` operator and the canonical `path_norm_root` prefix, replacing the previous `include_directories(inc_dir_fixed)` call. * Remove the `#ifndef FL_AUDIO_DETECTOR_VIBE_H` belt-and-suspenders guard added in #2325. With all `-I` flags normalized, `#pragma once` alone is sufficient. Verified with `bash test --cpp`: 300/300 tests pass. * Add ci/tests/test_meson_include_paths.py — a CI check that parses `.build/meson*/compile_commands.json` after setup and fails if any non-Meson-auto `-I` flag contains a backslash or is not absolute. Fixes #2328. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
… (#2332) On Windows, Meson's `include_directories()` propagates `-I` flags using native backslash + relative-path spellings (e.g. `-I..\..\src\platforms\stub`). Clang keys `#pragma once` deduplication on the raw resolved path string — if the same directory reaches a translation unit via two different spellings (forward slash vs backslash, absolute vs relative), the header appears to be two different files and `#pragma once` is silently defeated, producing double-definition errors (#2324, #2325). This change ensures every `-I` flag we generate is absolute + forward-slash + spelled identically everywhere: * Add canonical `path_norm_*` -I args in ci/meson/shared/meson.build (path_norm_I_root, path_norm_I_src, path_norm_I_tests, path_norm_I_stub). Every consumer meson.build references these instead of redeclaring. * Replace every project-wide `include_directories(...)` consumer (`include_directories: [src_dir, stub_dir, ...]`) with explicit absolute cpp_args. This stops Meson from injecting relative backslash `-I` flags into the propagated compile lines. * For per-example discovered include dirs, build absolute forward-slash `-I` args from the discovered relative path via the `/` operator and the canonical `path_norm_root` prefix, replacing the previous `include_directories(inc_dir_fixed)` call. * Remove the `#ifndef FL_AUDIO_DETECTOR_VIBE_H` belt-and-suspenders guard added in #2325. With all `-I` flags normalized, `#pragma once` alone is sufficient. Verified with `bash test --cpp`: 300/300 tests pass. * Add ci/tests/test_meson_include_paths.py — a CI check that parses `.build/meson*/compile_commands.json` after setup and fails if any non-Meson-auto `-I` flag contains a backslash or is not absolute. Fixes #2328. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
#ifndef FL_AUDIO_DETECTOR_VIBE_Hguard alongside the existing#pragma onceinsrc/fl/audio/detector/vibe.h.src/fl/audio/audio_processor.h.Background
On Windows builds, clang sometimes presents the include path for
vibe.hwith mixed slashes:When
vibe.his pulled in through two different paths in the same translation unit — once viaaudio_processor.h(line 9) and once viatests/fl/audio/detector/vibe.hpp(line 6) —#pragma once's file-identity check can fail to deduplicate. The TU then seesVibeLevelsandVibedefined twice and fails with:Adding an
#ifndefguard is content-based and path-agnostic, so it deduplicates regardless of how the include path is spelled. This mirrors whataudio_processor.halready does.Why this matters
Master CI has been failing on this error. Reproduced locally on Windows; the guard fixes it.
Test plan
bash test vibe --cpp— vibe unit test passesbash test --cpp— all 299 C++ unit tests + examples pass🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes