basic/missing_*.h: add asserts that the values are as expected

It's great that we provide fallback values, but if we got one of those wrong,
it could be a long time before anyone noticed. So let's add asserts that the
our internal defines actually match the official ones, when the latter are
available.

I did not add '#include "macro.h"' to missing_{audit,capability}, because
those are processed by an awk script that would need additional include
directories and could be confused by the additional lines. We don't include
those headers standalone anyway, so this is not necessary anyway.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2024-03-15 15:22:31 +01:00
parent 7258971b13
commit 4d6437d33c
17 changed files with 370 additions and 124 deletions

View File

@@ -4,9 +4,11 @@
#include <linux/input.h>
#include <linux/types.h>
#include "macro.h"
/* linux@c7dc65737c9a607d3e6f8478659876074ad129b8 (3.12) */
#ifndef EVIOCREVOKE
#define EVIOCREVOKE _IOW('E', 0x91, int)
# define EVIOCREVOKE _IOW('E', 0x91, int)
#endif
/* linux@06a16293f71927f756dcf37558a79c0b05a91641 (4.4) */
@@ -23,23 +25,34 @@ struct input_mask {
/* linux@7611392fe8ff95ecae528b01a815ae3d72ca6b95 (3.17) */
#ifndef INPUT_PROP_POINTING_STICK
#define INPUT_PROP_POINTING_STICK 0x05
# define INPUT_PROP_POINTING_STICK 0x05
#else
assert_cc(INPUT_PROP_POINTING_STICK == 0x05);
#endif
/* linux@500d4160abe9a2e88b12e319c13ae3ebd1e18108 (4.0) */
#ifndef INPUT_PROP_ACCELEROMETER
#define INPUT_PROP_ACCELEROMETER 0x06
# define INPUT_PROP_ACCELEROMETER 0x06
#else
assert_cc(INPUT_PROP_ACCELEROMETER == 0x06);
#endif
/* linux@d09bbfd2a8408a995419dff0d2ba906013cf4cc9 (3.11) */
#ifndef BTN_DPAD_UP
#define BTN_DPAD_UP 0x220
#define BTN_DPAD_DOWN 0x221
#define BTN_DPAD_LEFT 0x222
#define BTN_DPAD_RIGHT 0x223
# define BTN_DPAD_UP 0x220
# define BTN_DPAD_DOWN 0x221
# define BTN_DPAD_LEFT 0x222
# define BTN_DPAD_RIGHT 0x223
#else
assert_cc(BTN_DPAD_UP == 0x220);
assert_cc(BTN_DPAD_DOWN == 0x221);
assert_cc(BTN_DPAD_LEFT == 0x222);
assert_cc(BTN_DPAD_RIGHT == 0x223);
#endif
/* linux@358f24704f2f016af7d504b357cdf32606091d07 (3.13) */
#ifndef KEY_ALS_TOGGLE
#define KEY_ALS_TOGGLE 0x230
# fine KEY_ALS_TOGGLE 0x230
#else
assert_cc(KEY_ALS_TOGGLE == 0x230);
#endif