qmk_firmware icon indicating copy to clipboard operation
qmk_firmware copied to clipboard

[Feature] Implement `mod_t` packed struct

Open elpekenin opened this issue 8 months ago • 4 comments

Description

As per title, a little more info the issue

Types of Changes

  • [X] Core
  • [ ] Bugfix
  • [X] New feature
  • [X] Enhancement/optimization
  • [ ] Keyboard (addition or update)
  • [ ] Keymap/layout (addition or update)
  • [ ] Documentation

Issues Fixed or Closed by This PR

  • Fixes #25163

Checklist

  • [x] My code follows the code style of this project: C, Python
  • [x] I have read the PR Checklist document and have made the appropriate changes.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • [x] I have tested the changes and verified that they work and don't break anything (as well as I can manage).

elpekenin avatar Apr 18 '25 13:04 elpekenin

Looks like CPP (used for tests) does not like _Static_assert

Should i add something like this to util.h and update all references to "bad" name across codebase?

/**
 * @brief Perfom an assertion at compile time.
 *
 * _Static_assert is C<23, while static_assert is C++/C23.
 */
#if !defined(STATIC_ASSERT)
#    ifdef __cplusplus
#        define STATIC_ASSERT static_assert
#    else
#        define STATIC_ASSERT _Static_assert
#    endif
#endif

elpekenin avatar Apr 23 '25 14:04 elpekenin

Noticed that there's already a couple places adding compatibility by means of

#ifdef __cplusplus
#    define _Static_assert static_assert
#endif

But i don't know where this could be unified. Perhaps just declare this as a flag passed to the compiler when building tests? 🤔

elpekenin avatar Apr 23 '25 14:04 elpekenin

I'd say we start a compiler_support.h file -- there are adaptations of _Static_assert/static_assert which I'd like to include as well in the future.

tzarc avatar May 18 '25 23:05 tzarc

Please remove the changes to quantum/led.h as they have no bearing on the functionality being added.

zvecr avatar May 19 '25 11:05 zvecr

Thank you for your contribution! This pull request has been automatically marked as stale because it has not had activity in the last 45 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, or re-open when it's ready. For maintainers: Please label with bug, awaiting review, breaking_change, in progress, or on hold to prevent the issue from being re-flagged.

github-actions[bot] avatar Jul 07 '25 02:07 github-actions[bot]

Thank you for your contribution! This pull request has been automatically marked as stale because it has not had activity in the last 45 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, or re-open when it's ready. For maintainers: Please label with bug, awaiting review, breaking_change, in progress, or on hold to prevent the issue from being re-flagged.

github-actions[bot] avatar Sep 05 '25 02:09 github-actions[bot]