Skip to content

fix: resolve -Wshadow warnings in sml.hpp (issue #496)#676

Merged
kris-jusiak merged 3 commits into
boost-ext:masterfrom
PavelGuzenfeld:fix/issue-496-wshadow
May 24, 2026
Merged

fix: resolve -Wshadow warnings in sml.hpp (issue #496)#676
kris-jusiak merged 3 commits into
boost-ext:masterfrom
PavelGuzenfeld:fix/issue-496-wshadow

Conversation

@PavelGuzenfeld
Copy link
Copy Markdown
Contributor

@PavelGuzenfeld PavelGuzenfeld commented May 24, 2026

Fixes #496.

Several declarations shadow class members or type aliases, breaking -Wshadow -Werror builds.

Changes:

  • pool_type_impl<T&> ctors: param valueval (shadowed T& value member)
  • zero_wrapper ctors (×6): param ptrfn_ptr
  • queue_event_call ctor: param callcall_fn
  • exception ctor: param exceptionex
  • sm_impl methods (×22): param TDeps &depsTDeps &d; alias using deps = ... kept because merge_deps accesses sm_impl::deps for sub-machine dep collection
  • sm: using deps = ...using dep_list = ... (safe; sm types not passed to merge_deps)
  • sm::set_current_states: local smsm_impl_ref
  • process_impl ctor: param eventev
  • front::transition ctors (×8): params g/ag_init/a_init
  • front::transition execute methods (×11): params event/depsev/d; type aliases kept (accessed externally via transitional_impl and merge_deps)

All tests pass. Zero -Wshadow warnings compiling every test/ft/*.cpp with -Wshadow -Werror.

Several declarations in sml.hpp shadow class members or enclosing-scope
names, causing -Wshadow/-Werror failures in user projects.

Changes:
- pool_type_impl<T&>: rename ctor params 'value' -> 'val' (avoid shadowing
  the T& value member)
- zero_wrapper specializations (6): rename ctor param 'ptr' -> 'fn_ptr'
- queue_event_call: rename ctor param 'call' -> 'call_fn'
- exception: rename ctor param 'exception' -> 'ex'
- sm_impl methods (22): rename param 'deps' -> 'd'; the type alias
  'using deps = ...' is kept because merge_deps accesses ::deps on
  sm_impl sub-machine types
- sm: rename 'using deps = ...' -> 'using dep_list = ...' (not accessed
  externally; sm types are not in sub_sms_t), update the one internal
  use in deps_t
- sm::set_current_states: rename local var 'sm' -> 'sm_impl_ref'
- process_impl: rename ctor param 'event' -> 'ev'
- front::transition ctors (8): rename ctor params 'g'/'a' -> 'g_init'/'a_init'
- front::transition execute methods (11 overloads): rename params
  'event' -> 'ev', 'deps' -> 'd' (these shadow 'using event = E' and
  'using deps = ...' type aliases in the same struct)

All existing tests pass with -Wall -Wextra -Werror -pedantic.
@PavelGuzenfeld
Copy link
Copy Markdown
Contributor Author

May be we should update make a release and update documentation after I'm done with all this.
What is the documentation source repo?

@kris-jusiak
Copy link
Copy Markdown
Collaborator

👍 for release
docs are generated from doc folder make doc and results are in gh-pages branch which is deployed and shown via https://boost-ext.github.io/sml

@kris-jusiak kris-jusiak merged commit 83585c2 into boost-ext:master May 24, 2026
5 checks passed
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.

Can't build 1.1.4 with -Werror -Wshadow

2 participants