Skip to content

Defining multiple input-processor-temp-layers produces compile warnings/errors #3282

@adamlopresto

Description

@adamlopresto

I have a setup with two trackballs, and I'm attempting to set different auto mouse layers on each of them. When I add add them both to my keymap, I get a compilation warning/error (warning that causes the build to fail due to -Wfatal-errors). If I have just one, it works correctly.

Excerpt from keymap (at end of behaviors section)

    zip_auto_mouse: zip_auto_mouse {
        compatible = "zmk,input-processor-temp-layer";
        #input-processor-cells = <2>;
        require-prior-idle-ms = <500>;
        excluded-positions = <37 38 39 40>;
    };

    zip_auto_scroll: zip_auto_scroll {
        compatible = "zmk,input-processor-temp-layer";
        #input-processor-cells = <2>;
        require-prior-idle-ms = <500>;
        excluded-positions = <64>;
    };

Error message from github action:

/tmp/zmk-config/zmk/app/src/pointing/input_processor_temp_layer.c: In function 'layer_disable_callback':
/tmp/zmk-config/zmk/app/src/pointing/input_processor_temp_layer.c:126:9: warning: unused variable 'ret' [-Wunused-variable]
126 | int ret = k_msgq_put(&temp_layer_action_msgq, &action, K_MSEC(10));
| ^~~
In file included from /tmp/zmk-config/zephyr/include/zephyr/sys/util_macro.h:34,
from /tmp/zmk-config/zephyr/include/zephyr/sys/util.h:17,
from /tmp/zmk-config/zephyr/include/zephyr/sys/atomic.h:18,
from /tmp/zmk-config/zephyr/include/zephyr/kernel_includes.h:25,
from /tmp/zmk-config/zephyr/include/zephyr/kernel.h:17,
from /tmp/zmk-config/zmk/app/src/pointing/input_processor_temp_layer.c:9:
/tmp/zmk-config/zmk/app/src/pointing/input_processor_temp_layer.c: At top level:
/tmp/zmk-config/zephyr/include/zephyr/sys/util_internal.h:45:70: error: missing binary operator before token "1"
45 | #define Z_IS_ENABLED2(one_or_two_args) Z_IS_ENABLED3(one_or_two_args 1, 0)
| ^
/tmp/zmk-config/zephyr/include/zephyr/sys/util_internal.h:72:26: note: in definition of macro '__DEBRACKET'
72 | #define __DEBRACKET(...) VA_ARGS
| ^~~~~~~~~~~
/tmp/zmk-config/zephyr/include/zephyr/sys/util_internal.h:64:9: note: in expansion of macro '__GET_ARG2_DEBRACKET'
64 | __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code)
| ^~~~~~~~~~~~~~~~~~~~
/tmp/zmk-config/zephyr/include/zephyr/sys/util_internal.h:59:9: note: in expansion of macro '__COND_CODE'
59 | __COND_CODE(_XXXX##_flag, _if_1_code, _else_code)
| ^~~~~~~~~~~
/tmp/zmk-config/zephyr/include/zephyr/sys/util_macro.h:204:9: note: in expansion of macro 'Z_COND_CODE_1'
204 | Z_COND_CODE_1(_flag, _if_1_code, _else_code)
| ^~~~~~~~~~~~~
/tmp/zmk-config/zephyr/include/zephyr/devicetree.h:5004:9: note: in expansion of macro 'COND_CODE_1'
5004 | COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT),
| ^~~~~~~~~~~
/tmp/zmk-config/zephyr/include/zephyr/sys/util_internal.h:45:40: note: in expansion of macro 'Z_IS_ENABLED3'
45 | #define Z_IS_ENABLED2(one_or_two_args) Z_IS_ENABLED3(one_or_two_args 1, 0)
| ^~~~~~~~~~~~~
/tmp/zmk-config/zephyr/include/zephyr/sys/util_internal.h:28:37: note: in expansion of macro 'Z_IS_ENABLED2'
28 | #define Z_IS_ENABLED1(config_macro) Z_IS_ENABLED2(_XXXX##config_macro)
| ^~~~~~~~~~~~~
/tmp/zmk-config/zephyr/include/zephyr/sys/util_macro.h:148:34: note: in expansion of macro 'Z_IS_ENABLED1'
148 | #define IS_ENABLED(config_macro) Z_IS_ENABLED1(config_macro)
| ^~~~~~~~~~~~~
/tmp/zmk-config/zephyr/include/zephyr/devicetree.h:837:9: note: in expansion of macro 'IS_ENABLED'
837 | IS_ENABLED(DT_CAT6(node_id, P, prop, IDX, idx, _EXISTS))
| ^~~~~~~~~~
/tmp/zmk-config/zephyr/include/zephyr/devicetree.h:4207:9: note: in expansion of macro 'DT_PROP_HAS_IDX'
4207 | DT_PROP_HAS_IDX(DT_DRV_INST(inst), prop, idx)
| ^~~~~~~~~~~~~~~
/tmp/zmk-config/zmk/app/src/pointing/input_processor_temp_layer.c:288:41: note: in expansion of macro 'DT_INST_PROP_HAS_IDX'
288 | #define NEEDS_POSITION_HANDLERS(n, ...) DT_INST_PROP_HAS_IDX(n, excluded_positions, 0)
| ^~~~~~~~~~~~~~~~~~~~
/tmp/tmp.cBbLinTFi2/zephyr/include/generated/zephyr/devicetree_generated.h:45856:95: note: in expansion of macro 'NEEDS_POSITION_HANDLERS'
45856 | #define DT_FOREACH_OKAY_INST_VARGS_zmk_input_processor_temp_layer(fn, ...) fn(0, VA_ARGS) fn(1, VA_ARGS)
| ^~
/tmp/zmk-config/zephyr/include/zephyr/sys/util_internal.h:105:36: note: in expansion of macro 'DT_FOREACH_OKAY_INST_VARGS_zmk_input_processor_temp_layer'
105 | #define UTIL_PRIMITIVE_CAT(a, ...) a##VA_ARGS
| ^
/tmp/zmk-config/zmk/app/src/pointing/input_processor_temp_layer.c:296:5: note: in expansion of macro 'DT_INST_FOREACH_STATUS_OKAY_VARGS'
296 | #if DT_INST_FOREACH_STATUS_OKAY_VARGS(NEEDS_POSITION_HANDLERS, ||)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
[31/476] Building C object CMakeFiles/app.dir/src/pointing/input_processor_scaler.c.obj
[32/476] Building C object CMakeFiles/app.dir/src/pointing/input_processor_code_mapper.c.obj
[33/476] Building C object CMakeFiles/app.dir/src/pointing/input_processor_behaviors.c.obj
[34/476] Building C object CMakeFiles/app.dir/src/pointing/input_split.c.obj
[35/476] Building C object CMakeFiles/app.dir/src/hid.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/local/bin/cmake --build /tmp/tmp.cBbLinTFi2
Error: Process completed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions