qmk_firmware/keyboards/handwired
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
..
2x5keypad
3dfoxc RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
3dortho14u
3dp660
6key
6macro RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
10k
42
108key_trackpoint
412_64
aball
aek64 RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
aim65 RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
amigopunk
angel
aplx2
aranck RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
arrow_pad Switch over MANUFACTURER and PRODUCT to string literals (#18183) 2022-08-28 09:59:40 -07:00
atreus50 Clean-up of `#define _ADJUST 16` instances (#18182) 2022-08-27 23:13:44 -07:00
axon
baredev/rev1 RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
battleship_gamepad
bdn9_ble
bento RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
bigmac
bolek
boss566y/redragon_vara
brain
bstk100
cans12er
carpolly
chiron
ck4x4
cmd60
co60 RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
colorlice
concertina
consolekeyboard
croxsplit44
curiosity
cyberstar
d48 RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
dactyl RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
dactyl_left
dactyl_manuform RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
dactyl_promicro
dactyl_rah RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
daishi
datahand
dc/mc/001
ddg_56
dqz11n1g
dygma/raise
eagleii
elrgo_s RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
ergocheap
evk
fc200rt_qmk
fivethirteen
floorboard
frankie_macropad
frenchdev
freoduo
fruity60
gamenum
hacked_motospeed
heisenberg RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
hexon38
hillside [Keymap] Add Miryoku keymap for Hillside 48 (#18191) 2022-08-28 13:20:30 -07:00
hnah40
hnah40rgb
hnah108
ibm122m
ibm_wheelwriter
jn68m
jopr
jot50
jotanck
jotpad16
jtallbean
juliet
k8split
k_numpad17
kbod
ks63
lagrange Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
leftynumpad
lemonpad
lovelive9
m40/5x5_macropad
macroboard
magicforce61
magicforce68
marauder
mechboards_micropad
meck_tkl
minorca RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
misterdeck
ms_sculpt_mobile
mutepad
myskeeb Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
nicekey Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
not_so_minidox
novem
nozbe_macro
numpad20
obuwunkunubi/spaget
oem_ansi_fullsize
oem_iso_fullsize
onekey Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
ortho5x13 Clean-up of `#define _ADJUST 16` instances (#18182) 2022-08-27 23:13:44 -07:00
ortho5x14 RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
ortho_brass
owlet60
p65rgb
pilcrow
pill60
postageboard
prime_exl
prime_exl_plus
prkl30 RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
promethium Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
pterodactyl
pteron RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
pteron38
pteron44
pytest
qc60 RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
reclined
retro_refit
riblee_f401
riblee_f411
rs60
selene
sick68
sick_pad
skakunm_dactyl
slash
snatchpad
sono1
space_oddity
split65
split89
splittest
steamvan RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
stef9998/split_5x7 [Keyboard] Add handwired Split 5x7 (#18128) 2022-08-28 21:49:17 -07:00
sticc14
stream_cheap
swiftrax [Keyboard] add rgb animation handwired/swiftrax/glacier (#18121) 2022-08-22 19:12:33 -07:00
symmetric70_proto Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
symmetry60
t111
tennie
terminus_mini
trackpoint
tractyl_manuform [Keymap] Drashna keymap updates for 0.18.0 (#18184) 2022-08-28 12:55:19 -07:00
traveller
tritium_numpad RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
twadlee/tp69
unicomp_mini_m
unk
uthol RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
videowriter RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
wabi RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
wakizashi40
woodpad
wulkan
xealous
xealousbrown
z150 RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
zergo