Skip to content

Commit 08a59b5

Browse files
committed
DOC: Add compiler-cautions.md with pitfalls
Distilled from review of 1,296+ COMP: commits (2019-2026), GitHub PR review comments, and CDash failure analysis. Covers: - Smart pointer / forward-declared type hazards (GCC 7-9.1 brace-init bug, destructor-in-header UB with unique_ptr<Incomplete>) - Template deduction pitfalls (missing typename, non-type param type mismatch, constexpr static ODR-use in lambdas) - constexpr edge cases (MSVC x86 if constexpr, function pointer arrays) - Undefined behavior patterns (bit shift overflow, implicit truncation, empty-vector data(), uninitialized loop vars) - Platform specifics (char signedness on ARM, missing <cstdint> on GCC 13+, reserved identifiers on AppleClang) - GCC warnings (-Wmaybe-uninitialized false positives on ARM64, -Wdeprecated-copy Rule of Zero violations) - MSVC C4805 bool/int mixing, constexpr arrays - Clang suppression macros for third-party headers - ITK deprecated API replacements (ITK_LEGACY_REMOVE=ON breaks) - Shared library symbol visibility (ITK_TEMPLATE_EXPORT) - Python binding removals (np.bool, PySequence_Fast_GET_ITEM) - 13-item refactoring checklist Add routing entry to AGENTS.md table. Document that refactoring should not introduce new clang-tidy diagnostics, and enumerate check families that conflict with ITK coding standards (llvmlibc-*, readability-identifier-length, google-*, etc.). AI agents must consult compiler-cautions.md, compile the changed module, and run relevant tests before committing C++ code. Update AGENTS.md routing row for commit tasks to surface these docs.
1 parent 89df941 commit 08a59b5

File tree

3 files changed

+560
-1
lines changed

3 files changed

+560
-1
lines changed

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ Load only what your task requires:
1515
| Writing or running tests | [./Documentation/AI/testing.md](./Documentation/AI/testing.md) |
1616
| Code style, naming conventions | [./Documentation/AI/style.md](./Documentation/AI/style.md) |
1717
| Writing ITK C++ classes, CMake build configuration, and Python wrapping configuration | [./Documentation/AI/conventions.md](./Documentation/AI/conventions.md) |
18-
| Creating a git commit | [./Documentation/AI/git-commits.md](./Documentation/AI/git-commits.md) |
18+
| Creating a git commit with C++ changes | [./Documentation/AI/git-commits.md](./Documentation/AI/git-commits.md), [./Documentation/AI/compiler-cautions.md](./Documentation/AI/compiler-cautions.md), [./Documentation/AI/building.md](./Documentation/AI/building.md), [./Documentation/AI/testing.md](./Documentation/AI/testing.md) |
1919
| Opening or updating a pull request | [./Documentation/AI/pull-requests.md](./Documentation/AI/pull-requests.md) |
20+
| Avoiding compiler-specific pitfalls and refactoring hazards | [./Documentation/AI/compiler-cautions.md](./Documentation/AI/compiler-cautions.md) |
2021

2122
## Critical Pitfalls
2223

0 commit comments

Comments
 (0)