Open-source keyboard firmware for Atmel AVR and Arm USB families. Mirror of https://github.com/qmk/qmk_firmware
Go to file
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
.github Merge remote-tracking branch 'origin/master' into develop 2022-08-08 18:06:29 +00:00
.vscode Exclude uf2 files in VS Code (#18186) 2022-08-28 09:59:07 -07:00
builddefs Remove deprecated USBasp and bootloadHID bootloader types (#18195) 2022-08-28 21:20:43 +01:00
data Fix incorrect bluetooth.driver rules.mk mapping (#18205) 2022-08-29 19:05:05 +01:00
docs Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
drivers Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
keyboards Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
layouts Merge remote-tracking branch 'origin/master' into develop 2022-08-29 01:35:17 +00:00
lib Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
platforms Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
quantum Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
tests [Bug] Add key event check to is_tap_record and remove is_tap_key (#18063) 2022-08-15 16:40:51 +02:00
tmk_core Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
users Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
util Nix shell updates for develop (#18131) 2022-08-23 02:59:33 +01:00
.clang-format Clang-format tweaks (#15906) 2022-02-11 20:00:34 -08:00
.editorconfig QMK CLI and JSON keymap support (#6176) 2019-07-15 12:14:27 -07:00
.gitattributes eol=lf, where appropriate (#15752) 2022-01-05 21:56:31 +00:00
.gitignore Add .orig to .gitignore (#17626) 2022-07-17 04:38:56 +10:00
.gitmodules [Core] Add Raspberry Pi RP2040 support (#14877) 2022-06-30 13:19:27 +02:00
Dockerfile move everything from qmkfm/base_container to qmkfm/qmk_cli (#14230) 2021-08-29 16:41:56 -07:00
Doxyfile Internal docs generation updates (#16411) 2022-02-21 15:47:44 +00:00
doxygen-todo Remove SERIAL_LINK feature (#14727) 2021-10-07 12:32:05 +11:00
LICENSE add an explicit lisence file for github to pickup 2017-11-13 20:50:54 -05:00
license_GPLv2.md Clarify the quantum license (#1042) 2017-03-28 15:20:36 -07:00
license_GPLv3.md Clarify the quantum license (#1042) 2017-03-28 15:20:36 -07:00
license_Modified_BSD.md Clarify the quantum license (#1042) 2017-03-28 15:20:36 -07:00
Makefile Merge remote-tracking branch 'origin/master' into develop 2022-08-13 13:24:07 +00:00
nose2.cfg Setup a python test framework 2019-09-07 07:58:41 -07:00
paths.mk Migrate more makefile utilities to builddefs sub-directory (#16002) 2022-02-10 09:45:51 -08:00
readme.md Branch point for 2022 Nov 26 Breaking Change 2022-08-28 14:27:52 +10:00
requirements-dev.txt Macros in JSON keymaps (#14374) 2021-11-22 11:11:35 -08:00
requirements.txt Align CLI requirements (#18117) 2022-08-21 18:38:17 +01:00
setup.cfg Quantum Painter (#10174) 2022-04-13 18:00:18 +10:00
shell.nix Nix shell updates for develop (#18131) 2022-08-23 02:59:33 +01:00
Vagrantfile move everything from qmkfm/base_container to qmkfm/qmk_cli (#14230) 2021-08-29 16:41:56 -07:00

THIS IS THE DEVELOP BRANCH

Warning- This is the develop branch of QMK Firmware. You may encounter broken code here. Please see Breaking Changes for more information.

Quantum Mechanical Keyboard Firmware

Current Version Discord Docs Status GitHub contributors GitHub forks

This is a keyboard firmware based on the tmk_keyboard firmware with some useful features for Atmel AVR and ARM controllers, and more specifically, the OLKB product line, the ErgoDox EZ keyboard, and the Clueboard product line.

Documentation

The docs are powered by Docsify and hosted on GitHub. They are also viewable offline; see Previewing the Documentation for more details.

You can request changes by making a fork and opening a pull request, or by clicking the "Edit this page" link at the bottom of any page.

Supported Keyboards

The project also includes community support for lots of other keyboards.

Maintainers

QMK is developed and maintained by Jack Humbert of OLKB with contributions from the community, and of course, Hasu. The OLKB product firmwares are maintained by Jack Humbert, the Ergodox EZ by ZSA Technology Labs, the Clueboard by Zach White, and the Atreus by Phil Hagelberg.

Official Website

qmk.fm is the official website of QMK, where you can find links to this page, the documentation, and the keyboards supported by QMK.