qmk_firmware/quantum/process_keycode
Jeff Epler 9632360caa
Use a macro to compute the size of arrays at compile time (#18044)
* Add ARRAY_SIZE and CEILING utility macros

* Apply a coccinelle patch to use ARRAY_SIZE

* fix up some straggling items

* Fix 'make test:secure'

* Enhance ARRAY_SIZE macro to reject acting on pointers

The previous definition would not produce a diagnostic for
```
int *p;
size_t num_elem = ARRAY_SIZE(p)
```
but the new one will.

* explicitly get definition of ARRAY_SIZE

* Convert to ARRAY_SIZE when const is involved

The following spatch finds additional instances where the array is
const and the division is by the size of the type, not the size of
the first element:
```
@ rule5a using "empty.iso" @
type T;
const T[] E;
@@

- (sizeof(E)/sizeof(T))
+ ARRAY_SIZE(E)

@ rule6a using "empty.iso" @
type T;
const T[] E;
@@

- sizeof(E)/sizeof(T)
+ ARRAY_SIZE(E)
```

* New instances of ARRAY_SIZE added since initial spatch run

* Use `ARRAY_SIZE` in docs (found by grep)

* Manually use ARRAY_SIZE

hs_set is expected to be the same size as uint16_t, though it's made
of two 8-bit integers

* Just like char, sizeof(uint8_t) is guaranteed to be 1

This is at least true on any plausible system where qmk is actually used.

Per my understanding it's universally true, assuming that uint8_t exists:
https://stackoverflow.com/questions/48655310/can-i-assume-that-sizeofuint8-t-1

* Run qmk-format on core C files touched in this branch

Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
2022-08-30 10:20:04 +02:00
..
process_audio.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_audio.h added missing audio_off_user() callback (#15457) 2021-12-11 16:58:25 -08:00
process_auto_shift.c Fix Caps Word capitalization when used with Combos + Auto Shift. (#17549) 2022-08-13 23:48:51 +10:00
process_auto_shift.h Add Retro Shift (Auto Shift for Tap Hold via Retro Tapping) and Custom Auto Shifts (#11059) 2021-11-25 23:12:14 +11:00
process_backlight.c LED Matrix: decouple from Backlight (#12054) 2021-03-08 16:55:00 +11:00
process_backlight.h 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
process_caps_word.c Fix Caps Word to treat mod-taps more consistently. (#17463) 2022-08-14 20:25:32 +01:00
process_caps_word.h [Core] Add Caps Word feature to core (#16588) 2022-05-14 16:00:32 +10:00
process_clicky.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_clicky.h Change include guards in quantum/ to pragma once (#11239) 2020-12-26 15:53:12 +11:00
process_combo.c Fix Caps Word capitalization when used with Combos + Auto Shift. (#17549) 2022-08-13 23:48:51 +10:00
process_combo.h Manually format develop (#15003) 2021-11-01 19:18:33 +00:00
process_dynamic_macro.c Added Wait time to sending each Keys for Dynamic Macros function (#16800) 2022-07-02 21:48:26 +10:00
process_dynamic_macro.h [Core] Convert Dynamic Macro to a Core Feature (#5948) 2019-11-04 22:59:13 -08:00
process_dynamic_tapping_term.c Feature-ify Send String (#17275) 2022-07-02 22:10:08 +10:00
process_dynamic_tapping_term.h New feature: DYNAMIC_TAPPING_TERM_ENABLE (#11036) 2021-11-26 07:06:50 +11:00
process_grave_esc.c Rename some Quantum keycodes (#15968) 2022-01-22 03:34:15 +00:00
process_grave_esc.h Relocate grave keycode processing (#8082) 2020-02-04 18:49:10 -08:00
process_haptic.c Rip out old macro and action_function system (#16025) 2022-01-24 21:22:20 +00:00
process_haptic.h Haptic: driver-> feature (#13713) 2021-07-25 19:14:58 -07:00
process_joystick.c Fix check when compiling HID Joystick with digital driver (#17844) 2022-07-30 01:32:06 +01:00
process_joystick.h Hid joystick interface (#4226) 2020-08-29 14:30:02 -07:00
process_key_lock.c Added cancel_key_lock function (#15321) 2021-11-29 00:17:07 -08:00
process_key_lock.h Added cancel_key_lock function (#15321) 2021-11-29 00:17:07 -08:00
process_key_override.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_key_override.h Minor tidy up of key overrides (#13747) 2021-07-28 12:01:49 +01:00
process_leader.c Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
process_leader.h Fix bad PR merge for #6580. (#12721) 2021-04-28 11:42:53 +01:00
process_magic.c PoC: Swap Escape and Caps (#16336) 2022-07-02 22:08:48 +10:00
process_magic.h Relocate magic keycode processing (#7512) 2019-12-03 19:48:55 +00:00
process_midi.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_midi.h Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_music.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_music.h Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_printer_bb.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_printer.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_printer.h Migrate serial_uart usages to UART driver (#15479) 2021-12-15 11:00:39 +00:00
process_programmable_button.c Add Support for USB programmable buttons (#12950) 2021-09-15 08:40:22 -07:00
process_programmable_button.h Add Support for USB programmable buttons (#12950) 2021-09-15 08:40:22 -07:00
process_rgb.c Allow for RGB actions to take place on Keydown instead of Keyup (#16886) 2022-07-02 22:49:49 +10:00
process_rgb.h Relocate RGB keycode processing (#7508) 2019-12-16 12:27:53 -08:00
process_secure.c Enhancement and fixes of "Secure" feature (#16958) 2022-05-14 23:07:08 +01:00
process_secure.h Implement XAP 'secure' core requirements (#16843) 2022-04-16 11:13:05 -07:00
process_sequencer.c 2020 November 28 Breaking Changes Update (#11053) 2020-11-28 12:02:18 -08:00
process_sequencer.h 2020 November 28 Breaking Changes Update (#11053) 2020-11-28 12:02:18 -08:00
process_space_cadet.c Add GET_TAPPING_TERM macro to reduce duplicate code (#16681) 2022-04-16 11:24:09 -07:00
process_space_cadet.h Fix Tap-Hold Configs (#11127) 2021-01-04 16:37:20 -08:00
process_steno.c Rename postprocess_steno_user → post_process_steno_user (#17823) 2022-07-28 21:51:01 -07:00
process_steno.h Refactor steno and add STENO_PROTOCOL = [all|txbolt|geminipr] (#17065) 2022-06-23 20:43:24 +02:00
process_tap_dance.c tap-dance: Restructure code and document in more detail (#16394) 2022-06-13 22:12:55 +02:00
process_tap_dance.h tap-dance: Restructure code and document in more detail (#16394) 2022-06-13 22:12:55 +02:00
process_ucis.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_ucis.h Standardize how unicode is processed (fixes #8768) (#8770) 2020-06-18 08:07:34 +01:00
process_unicode_common.c Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
process_unicode_common.h Added emacs as an "operating system" for input mode. (#16949) 2022-08-14 20:24:52 +01:00
process_unicode.c clang-format changes 2019-08-30 15:01:52 -07:00
process_unicode.h New keycode macro (XP) for shifted character pairs using UNICODEMAP + bug fixes and improvements (#4803) 2019-05-03 09:33:00 -07:00
process_unicodemap.c Fix Issue #9533 - Delayed shift state handling (#11220) 2020-12-22 18:23:09 +01:00
process_unicodemap.h send_unicode_string(): Add support for code points > 0xFFFF (#8236) 2020-02-25 12:54:51 +11:00