Skip to content

Add iteration limit warning to static_val and code formatting fixes#197

Open
PhilippGrulich wants to merge 2 commits intov0.1from
claude/add-iteration-limit-warning-2kqhh
Open

Add iteration limit warning to static_val and code formatting fixes#197
PhilippGrulich wants to merge 2 commits intov0.1from
claude/add-iteration-limit-warning-2kqhh

Conversation

@PhilippGrulich
Copy link
Copy Markdown
Member

Summary

This PR adds a warning mechanism to static_val when iteration limits are exceeded, and applies consistent code formatting across the codebase.

Key Changes

  • Add iteration limit warning to static_val:

    • Introduced MAX_ITERATIONS constant (1000) to static_val class
    • Added WarnStaticValIterationLimit() function to log warnings when iteration limit is reached
    • Created new static.cpp file to implement the warning function using spdlog logging
    • Warnings are triggered in both prefix and postfix increment operators
  • Add warn() logging function:

    • Implemented warn() template function in logging.hpp to support warning-level log messages
    • Follows the same pattern as existing trace() and error() functions with conditional compilation based on ENABLE_LOGGING
  • Code formatting improvements:

    • Fixed spacing in macro-generated operators (e.g., operator##=operator##= without space)
    • Reformatted long function signatures to split parameters across multiple lines for better readability
    • Applied consistent formatting to formatter specializations in IRGraph.cpp, ExecutionTrace.cpp, and TracingUtil.cpp
    • Fixed pointer-to-member syntax spacing (e.g., F T::* pmF T::*pm)
    • Simplified single-statement block formatting in test code
  • Build system update:

    • Added static.cpp to CMakeLists.txt source files

Implementation Details

The iteration limit warning helps developers identify when static_val loops may be causing excessive trace sizes and long compilation times, encouraging them to use regular val<> loops instead. The warning is only emitted once per loop when the limit is first reached.

https://claude.ai/code/session_01DtVn8hcLR2jjfA7dB4A4xy

claude added 2 commits March 19, 2026 08:34
Warn on stderr when a static_val exceeds 1000 increments, as excessive
iterations cause large traces and slow compilation. The warning fires
once (at exactly 1000) and suggests using a regular val<> loop instead.

Also applies clang-format fixes to several files.

https://claude.ai/code/session_01DtVn8hcLR2jjfA7dB4A4xy
Replace std::cerr with spdlog::warn via the existing logging
infrastructure. Add a free function WarnStaticValIterationLimit declared
in the public header and defined in a new static.cpp, avoiding the
namespace clash between nautilus::log (logging) and nautilus::log (cmath).
Also add log::warn to logging.hpp.

https://claude.ai/code/session_01DtVn8hcLR2jjfA7dB4A4xy
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