Too many compile errors for LOG calls

If there are any compile errors in a LOG_xxx call, the compiler prints so many error messages that it becomes impossible to tell which is the actual error.  E.g. below is the output from a simple LOG_INF() using a non-existent variable.  In this case the first one is the actual error, but the output has 135 messages! If there are multiple errors it is very difficult to find them.

Is there a way to disable the errors from the LOG subsystem?

    LOG_INF("x does not exist %d",x);

(Had to move the output to a file, it made this post unreadable :^)

Parents
  • C:/NordicTutorial/ncs-intm/inter_less1_exer2_solution/src/main.c:74:35: error: 'x' undeclared (first use in this function)
       74 |     LOG_INF("x does not exist %d",x);
          |                                   ^
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:166:32: note: in definition of macro 'Z_LOG_TO_PRINTK'
      166 |                              ##__VA_ARGS__); \
          |                                ^~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:250:9: note: in expansion of macro 'Z_LOG2'
      250 |         Z_LOG2(_level, 0, __log_current_const_data, __log_current_dynamic_data, __VA_ARGS__)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log.h:63:24: note: in expansion of macro 'Z_LOG'
       63 | #define LOG_INF(...)   Z_LOG(LOG_LEVEL_INF, __VA_ARGS__)
          |                        ^~~~~
    C:/NordicTutorial/ncs-intm/inter_less1_exer2_solution/src/main.c:74:5: note: in expansion of macro 'LOG_INF'
       74 |     LOG_INF("x does not exist %d",x);
          |     ^~~~~~~
    C:/NordicTutorial/ncs-intm/inter_less1_exer2_solution/src/main.c:74:35: note: each undeclared identifier is reported only once for each function it appears in
       74 |     LOG_INF("x does not exist %d",x);
          |                                   ^
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:166:32: note: in definition of macro 'Z_LOG_TO_PRINTK'
      166 |                              ##__VA_ARGS__); \
          |                                ^~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:250:9: note: in expansion of macro 'Z_LOG2'
      250 |         Z_LOG2(_level, 0, __log_current_const_data, __log_current_dynamic_data, __VA_ARGS__)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log.h:63:24: note: in expansion of macro 'Z_LOG'
       63 | #define LOG_INF(...)   Z_LOG(LOG_LEVEL_INF, __VA_ARGS__)
          |                        ^~~~~
    C:/NordicTutorial/ncs-intm/inter_less1_exer2_solution/src/main.c:74:5: note: in expansion of macro 'LOG_INF'
       74 |     LOG_INF("x does not exist %d",x);
          |     ^~~~~~~
    In file included from C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_macro.h:34,
                     from C:/ncs/v2.6.1/zephyr/include/zephyr/sys/atomic.h:16,
                     from C:/ncs/v2.6.1/zephyr/include/zephyr/kernel_includes.h:25,
                     from C:/ncs/v2.6.1/zephyr/include/zephyr/kernel.h:17,
                     from C:/NordicTutorial/ncs-intm/inter_less1_exer2_solution/src/main.c:7:
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:561:65: error: '_v1' undeclared (first use in this function)
      561 | #define Z_LOG_LOCAL_ARG_NAME(idx, arg) COND_CODE_0(idx, (arg), (_v##idx))
          |                                                                 ^~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_internal.h:72:26: note: in definition of macro '__DEBRACKET'
       72 | #define __DEBRACKET(...) __VA_ARGS__
          |                          ^~~~~~~~~~~
    C:/ncs/v2.6.1/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)
          |         ^~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_internal.h:61:9: note: in expansion of macro '__COND_CODE'
       61 |         __COND_CODE(_ZZZZ##_flag, _if_0_code, _else_code)
          |         ^~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_macro.h:196:9: note: in expansion of macro 'Z_COND_CODE_0'
      196 |         Z_COND_CODE_0(_flag, _if_0_code, _else_code)
          |         ^~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:167:9: note: in expansion of macro 'COND_CODE_0'
      167 |         COND_CODE_0(NUM_VA_ARGS_LESS_1(__VA_ARGS__), \
          |         ^~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:153:21: note: in expansion of macro 'Z_CBPRINTF_IS_PCHAR'
      153 |                 0 : Z_CBPRINTF_IS_PCHAR(x, flags))
          |                     ^~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1055:9: note: in expansion of macro 'Z_CBPRINTF_IS_X_PCHAR'
     1055 |         fixed_arg0(idx, x, fixed_arg1)
          |         ^~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:28:9: note: in expansion of macro 'Z_FOR_EACH_IDX_FIXED_ARG_EXEC'
       28 |         z_call(0, x, fixed_arg0, fixed_arg1)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:23:81: note: in expansion of macro 'Z_FOR_LOOP_1'
       23 |                                 _57, _58, _59, _60, _61, _62, _63, _64, N, ...) N
          |                                                                                 ^
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1058:9: note: in expansion of macro 'Z_FOR_EACH_ENGINE'
     1058 |         Z_FOR_EACH_ENGINE(Z_FOR_EACH_IDX_FIXED_ARG_EXEC, sep, \
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_macro.h:590:9: note: in expansion of macro 'Z_FOR_EACH_IDX_FIXED_ARG'
      590 |         Z_FOR_EACH_IDX_FIXED_ARG(F, sep, fixed_arg, REVERSE_ARGS(__VA_ARGS__))
          |         ^~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1075:9: note: in expansion of macro 'Z_BYPASS'
     1075 |         fixed_arg0(x)
          |         ^~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:28:9: note: in expansion of macro 'Z_FOR_EACH_EXEC'
       28 |         z_call(0, x, fixed_arg0, fixed_arg1)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:23:81: note: in expansion of macro 'Z_FOR_LOOP_1'
       23 |                                 _57, _58, _59, _60, _61, _62, _63, _64, N, ...) N
          |                                                                                 ^
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_macro.h:597:9: note: in expansion of macro 'Z_FOR_EACH_ENGINE'
      597 |         Z_FOR_EACH_ENGINE(Z_FOR_EACH_EXEC, (,), Z_BYPASS, _, __VA_ARGS__)
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_macro.h:590:53: note: in expansion of macro 'REVERSE_ARGS'
      590 |         Z_FOR_EACH_IDX_FIXED_ARG(F, sep, fixed_arg, REVERSE_ARGS(__VA_ARGS__))
          |                                                     ^~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:164:10: note: in expansion of macro 'FOR_EACH_IDX_FIXED_ARG'
      164 |         (FOR_EACH_IDX_FIXED_ARG(Z_CBPRINTF_IS_X_PCHAR, (+), flags, __VA_ARGS__))
          |          ^~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:169:22: note: in expansion of macro 'Z_CBPRINTF_HAS_PCHAR_ARGS'
      169 |                     (Z_CBPRINTF_HAS_PCHAR_ARGS(flags, __VA_ARGS__)))
          |                      ^~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:187:23: note: in expansion of macro 'Z_CBPRINTF_PCHAR_COUNT'
      187 |                 _rv = Z_CBPRINTF_PCHAR_COUNT(flags, __VA_ARGS__) > 0 ? 1 : 0; \
          |                       ^~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf.h:354:9: note: in expansion of macro 'Z_CBPRINTF_MUST_RUNTIME_PACKAGE'
      354 |         Z_CBPRINTF_MUST_RUNTIME_PACKAGE(flags, __VA_ARGS__)
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:522:27: note: in expansion of macro 'CBPRINTF_MUST_RUNTIME_PACKAGE'
      522 |         bool has_rw_str = CBPRINTF_MUST_RUNTIME_PACKAGE( \
          |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:578:9: note: in expansion of macro 'Z_LOG_MSG_CREATE3'
      578 |         Z_LOG_MSG_CREATE3(_try_0cpy, _mode,  _cstr_cnt, _domain_id, _source,\
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_internal.h:69:53: note: in expansion of macro '__DEBRACKET'
       69 | #define __GET_ARG2_DEBRACKET(ignore_this, val, ...) __DEBRACKET val
          |                                                     ^~~~~~~~~~~
    C:/ncs/v2.6.1/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)
          |         ^~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_internal.h:61:9: note: in expansion of macro '__COND_CODE'
       61 |         __COND_CODE(_ZZZZ##_flag, _if_0_code, _else_code)
          |         ^~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_macro.h:196:9: note: in expansion of macro 'Z_COND_CODE_0'
      196 |         Z_COND_CODE_0(_flag, _if_0_code, _else_code)
          |         ^~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:561:40: note: in expansion of macro 'COND_CODE_0'
      561 | #define Z_LOG_LOCAL_ARG_NAME(idx, arg) COND_CODE_0(idx, (arg), (_v##idx))
          |                                        ^~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1069:9: note: in expansion of macro 'Z_LOG_LOCAL_ARG_NAME'
     1069 |         fixed_arg0(idx, x)
          |         ^~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:33:9: note: in expansion of macro 'Z_FOR_EACH_IDX_EXEC'
       33 |         z_call(1, x, fixed_arg0, fixed_arg1)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:23:81: note: in expansion of macro 'Z_FOR_LOOP_2'
       23 |                                 _57, _58, _59, _60, _61, _62, _63, _64, N, ...) N
          |                                                                                 ^
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1072:9: note: in expansion of macro 'Z_FOR_EACH_ENGINE'
     1072 |         Z_FOR_EACH_ENGINE(Z_FOR_EACH_IDX_EXEC, sep, F, _, __VA_ARGS__)
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_macro.h:534:9: note: in expansion of macro 'Z_FOR_EACH_IDX'
      534 |         Z_FOR_EACH_IDX(F, sep, REVERSE_ARGS(__VA_ARGS__))
          |         ^~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:580:28: note: in expansion of macro 'FOR_EACH_IDX'
      580 |                            FOR_EACH_IDX(Z_LOG_LOCAL_ARG_NAME, (,), __VA_ARGS__)); \
          |                            ^~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:589:9: note: in expansion of macro 'Z_LOG_MSG_CREATE2'
      589 |         Z_LOG_MSG_CREATE2(_try_0cpy, _mode, UTIL_CAT(Z_LOG_FUNC_PREFIX_, _level), \
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:237:9: note: in expansion of macro 'Z_LOG_MSG_CREATE'
      237 |         Z_LOG_MSG_CREATE(UTIL_NOT(IS_ENABLED(CONFIG_USERSPACE)), _mode, \
          |         ^~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:250:9: note: in expansion of macro 'Z_LOG2'
      250 |         Z_LOG2(_level, 0, __log_current_const_data, __log_current_dynamic_data, __VA_ARGS__)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log.h:63:24: note: in expansion of macro 'Z_LOG'
       63 | #define LOG_INF(...)   Z_LOG(LOG_LEVEL_INF, __VA_ARGS__)
          |                        ^~~~~
    C:/NordicTutorial/ncs-intm/inter_less1_exer2_solution/src/main.c:74:5: note: in expansion of macro 'LOG_INF'
       74 |     LOG_INF("x does not exist %d",x);
          |     ^~~~~~~
    In file included from C:/ncs/v2.6.1/zephyr/include/zephyr/toolchain.h:50,
                     from C:/ncs/v2.6.1/zephyr/include/zephyr/kernel_includes.h:23:
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:325:22: error: expression in static assertion is not an integer
      325 |         BUILD_ASSERT(!((sizeof(double) < VA_STACK_ALIGN(long double)) && \
          |                      ^
    C:/ncs/v2.6.1/zephyr/include/zephyr/toolchain/gcc.h:87:51: note: in definition of macro 'BUILD_ASSERT'
       87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
          |                                                   ^~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:370:9: note: in expansion of macro 'Z_CBPRINTF_PACK_ARG2'
      370 |         Z_CBPRINTF_PACK_ARG2(arg_idx, _pbuf, _pkg_len, _pkg_offset, _pmax, arg)
          |         ^~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1069:9: note: in expansion of macro 'Z_CBPRINTF_PACK_ARG'
     1069 |         fixed_arg0(idx, x)
          |         ^~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:33:9: note: in expansion of macro 'Z_FOR_EACH_IDX_EXEC'
       33 |         z_call(1, x, fixed_arg0, fixed_arg1)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:23:81: note: in expansion of macro 'Z_FOR_LOOP_2'
       23 |                                 _57, _58, _59, _60, _61, _62, _63, _64, N, ...) N
          |                                                                                 ^
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1072:9: note: in expansion of macro 'Z_FOR_EACH_ENGINE'
     1072 |         Z_FOR_EACH_ENGINE(Z_FOR_EACH_IDX_EXEC, sep, F, _, __VA_ARGS__)
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_macro.h:534:9: note: in expansion of macro 'Z_FOR_EACH_IDX'
      534 |         Z_FOR_EACH_IDX(F, sep, REVERSE_ARGS(__VA_ARGS__))
          |         ^~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:491:9: note: in expansion of macro 'FOR_EACH_IDX'
      491 |         FOR_EACH_IDX(Z_CBPRINTF_PACK_ARG, (;), __VA_ARGS__);\
          |         ^~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:528:9: note: in expansion of macro 'Z_CBPRINTF_STATIC_PACKAGE_GENERIC'
      528 |         Z_CBPRINTF_STATIC_PACKAGE_GENERIC(packaged, inlen, outlen, \
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf.h:387:9: note: in expansion of macro 'Z_CBPRINTF_STATIC_PACKAGE'
      387 |         Z_CBPRINTF_STATIC_PACKAGE(packaged, inlen, outlen, \
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:336:17: note: in expansion of macro 'CBPRINTF_STATIC_PACKAGE'
      336 |                 CBPRINTF_STATIC_PACKAGE(NULL, 0, _plen, Z_LOG_MSG_ALIGN_OFFSET, _options, \
          |                 ^~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:545:17: note: in expansion of macro 'Z_LOG_MSG_STACK_CREATE'
      545 |                 Z_LOG_MSG_STACK_CREATE(_cstr_cnt, _domain_id, _source, _level, _data, \
          |                 ^~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:578:9: note: in expansion of macro 'Z_LOG_MSG_CREATE3'
      578 |         Z_LOG_MSG_CREATE3(_try_0cpy, _mode,  _cstr_cnt, _domain_id, _source,\
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:589:9: note: in expansion of macro 'Z_LOG_MSG_CREATE2'
      589 |         Z_LOG_MSG_CREATE2(_try_0cpy, _mode, UTIL_CAT(Z_LOG_FUNC_PREFIX_, _level), \
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:237:9: note: in expansion of macro 'Z_LOG_MSG_CREATE'
      237 |         Z_LOG_MSG_CREATE(UTIL_NOT(IS_ENABLED(CONFIG_USERSPACE)), _mode, \
          |         ^~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:250:9: note: in expansion of macro 'Z_LOG2'
      250 |         Z_LOG2(_level, 0, __log_current_const_data, __log_current_dynamic_data, __VA_ARGS__)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log.h:63:24: note: in expansion of macro 'Z_LOG'
       63 | #define LOG_INF(...)   Z_LOG(LOG_LEVEL_INF, __VA_ARGS__)
          |                        ^~~~~
    C:/NordicTutorial/ncs-intm/inter_less1_exer2_solution/src/main.c:74:5: note: in expansion of macro 'LOG_INF'
       74 |     LOG_INF("x does not exist %d",x);
          |     ^~~~~~~
    In file included from C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf.h:124,
                     from C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:11,
                     from C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:9:
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:211:15: error: '__v' undeclared (first use in this function)
      211 |         (void)__v; \
          |               ^~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:333:30: note: in expansion of macro 'Z_CBPRINTF_ARG_SIZE'
      333 |         uint32_t _arg_size = Z_CBPRINTF_ARG_SIZE(_arg); \
          |                              ^~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:370:9: note: in expansion of macro 'Z_CBPRINTF_PACK_ARG2'
      370 |         Z_CBPRINTF_PACK_ARG2(arg_idx, _pbuf, _pkg_len, _pkg_offset, _pmax, arg)
          |         ^~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1069:9: note: in expansion of macro 'Z_CBPRINTF_PACK_ARG'
     1069 |         fixed_arg0(idx, x)
          |         ^~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:33:9: note: in expansion of macro 'Z_FOR_EACH_IDX_EXEC'
       33 |         z_call(1, x, fixed_arg0, fixed_arg1)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:23:81: note: in expansion of macro 'Z_FOR_LOOP_2'
       23 |                                 _57, _58, _59, _60, _61, _62, _63, _64, N, ...) N
          |                                                                                 ^
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1072:9: note: in expansion of macro 'Z_FOR_EACH_ENGINE'
     1072 |         Z_FOR_EACH_ENGINE(Z_FOR_EACH_IDX_EXEC, sep, F, _, __VA_ARGS__)
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_macro.h:534:9: note: in expansion of macro 'Z_FOR_EACH_IDX'
      534 |         Z_FOR_EACH_IDX(F, sep, REVERSE_ARGS(__VA_ARGS__))
          |         ^~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:491:9: note: in expansion of macro 'FOR_EACH_IDX'
      491 |         FOR_EACH_IDX(Z_CBPRINTF_PACK_ARG, (;), __VA_ARGS__);\
          |         ^~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:528:9: note: in expansion of macro 'Z_CBPRINTF_STATIC_PACKAGE_GENERIC'
      528 |         Z_CBPRINTF_STATIC_PACKAGE_GENERIC(packaged, inlen, outlen, \
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf.h:387:9: note: in expansion of macro 'Z_CBPRINTF_STATIC_PACKAGE'
      387 |         Z_CBPRINTF_STATIC_PACKAGE(packaged, inlen, outlen, \
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:336:17: note: in expansion of macro 'CBPRINTF_STATIC_PACKAGE'
      336 |                 CBPRINTF_STATIC_PACKAGE(NULL, 0, _plen, Z_LOG_MSG_ALIGN_OFFSET, _options, \
          |                 ^~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:545:17: note: in expansion of macro 'Z_LOG_MSG_STACK_CREATE'
      545 |                 Z_LOG_MSG_STACK_CREATE(_cstr_cnt, _domain_id, _source, _level, _data, \
          |                 ^~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:578:9: note: in expansion of macro 'Z_LOG_MSG_CREATE3'
      578 |         Z_LOG_MSG_CREATE3(_try_0cpy, _mode,  _cstr_cnt, _domain_id, _source,\
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:589:9: note: in expansion of macro 'Z_LOG_MSG_CREATE2'
      589 |         Z_LOG_MSG_CREATE2(_try_0cpy, _mode, UTIL_CAT(Z_LOG_FUNC_PREFIX_, _level), \
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:237:9: note: in expansion of macro 'Z_LOG_MSG_CREATE'
      237 |         Z_LOG_MSG_CREATE(UTIL_NOT(IS_ENABLED(CONFIG_USERSPACE)), _mode, \
          |         ^~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:250:9: note: in expansion of macro 'Z_LOG2'
      250 |         Z_LOG2(_level, 0, __log_current_const_data, __log_current_dynamic_data, __VA_ARGS__)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log.h:63:24: note: in expansion of macro 'Z_LOG'
       63 | #define LOG_INF(...)   Z_LOG(LOG_LEVEL_INF, __VA_ARGS__)
          |                        ^~~~~
    C:/NordicTutorial/ncs-intm/inter_less1_exer2_solution/src/main.c:74:5: note: in expansion of macro 'LOG_INF'
       74 |     LOG_INF("x does not exist %d",x);
          |     ^~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:239:23: error: '_v' undeclared (first use in this function); did you mean '_d'?
      239 |                 (void)_v; \
          |                       ^~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:357:17: note: in expansion of macro 'Z_CBPRINTF_STORE_ARG'
      357 |                 Z_CBPRINTF_STORE_ARG(&_buf[_idx], _arg); \
          |                 ^~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:370:9: note: in expansion of macro 'Z_CBPRINTF_PACK_ARG2'
      370 |         Z_CBPRINTF_PACK_ARG2(arg_idx, _pbuf, _pkg_len, _pkg_offset, _pmax, arg)
          |         ^~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1069:9: note: in expansion of macro 'Z_CBPRINTF_PACK_ARG'
     1069 |         fixed_arg0(idx, x)
          |         ^~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:33:9: note: in expansion of macro 'Z_FOR_EACH_IDX_EXEC'
       33 |         z_call(1, x, fixed_arg0, fixed_arg1)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:23:81: note: in expansion of macro 'Z_FOR_LOOP_2'
       23 |                                 _57, _58, _59, _60, _61, _62, _63, _64, N, ...) N
          |                                                                                 ^
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1072:9: note: in expansion of macro 'Z_FOR_EACH_ENGINE'
     1072 |         Z_FOR_EACH_ENGINE(Z_FOR_EACH_IDX_EXEC, sep, F, _, __VA_ARGS__)
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_macro.h:534:9: note: in expansion of macro 'Z_FOR_EACH_IDX'
      534 |         Z_FOR_EACH_IDX(F, sep, REVERSE_ARGS(__VA_ARGS__))
          |         ^~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:491:9: note: in expansion of macro 'FOR_EACH_IDX'
      491 |         FOR_EACH_IDX(Z_CBPRINTF_PACK_ARG, (;), __VA_ARGS__);\
          |         ^~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:528:9: note: in expansion of macro 'Z_CBPRINTF_STATIC_PACKAGE_GENERIC'
      528 |         Z_CBPRINTF_STATIC_PACKAGE_GENERIC(packaged, inlen, outlen, \
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf.h:387:9: note: in expansion of macro 'Z_CBPRINTF_STATIC_PACKAGE'
      387 |         Z_CBPRINTF_STATIC_PACKAGE(packaged, inlen, outlen, \
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:336:17: note: in expansion of macro 'CBPRINTF_STATIC_PACKAGE'
      336 |                 CBPRINTF_STATIC_PACKAGE(NULL, 0, _plen, Z_LOG_MSG_ALIGN_OFFSET, _options, \
          |                 ^~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:545:17: note: in expansion of macro 'Z_LOG_MSG_STACK_CREATE'
      545 |                 Z_LOG_MSG_STACK_CREATE(_cstr_cnt, _domain_id, _source, _level, _data, \
          |                 ^~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:578:9: note: in expansion of macro 'Z_LOG_MSG_CREATE3'
      578 |         Z_LOG_MSG_CREATE3(_try_0cpy, _mode,  _cstr_cnt, _domain_id, _source,\
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:589:9: note: in expansion of macro 'Z_LOG_MSG_CREATE2'
      589 |         Z_LOG_MSG_CREATE2(_try_0cpy, _mode, UTIL_CAT(Z_LOG_FUNC_PREFIX_, _level), \
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:237:9: note: in expansion of macro 'Z_LOG_MSG_CREATE'
      237 |         Z_LOG_MSG_CREATE(UTIL_NOT(IS_ENABLED(CONFIG_USERSPACE)), _mode, \
          |         ^~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:250:9: note: in expansion of macro 'Z_LOG2'
      250 |         Z_LOG2(_level, 0, __log_current_const_data, __log_current_dynamic_data, __VA_ARGS__)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log.h:63:24: note: in expansion of macro 'Z_LOG'
       63 | #define LOG_INF(...)   Z_LOG(LOG_LEVEL_INF, __VA_ARGS__)
          |                        ^~~~~
    C:/NordicTutorial/ncs-intm/inter_less1_exer2_solution/src/main.c:74:5: note: in expansion of macro 'LOG_INF'
       74 |     LOG_INF("x does not exist %d",x);
          |     ^~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:325:22: error: expression in static assertion is not an integer
      325 |         BUILD_ASSERT(!((sizeof(double) < VA_STACK_ALIGN(long double)) && \
          |                      ^
    C:/ncs/v2.6.1/zephyr/include/zephyr/toolchain/gcc.h:87:51: note: in definition of macro 'BUILD_ASSERT'
       87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
          |                                                   ^~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:370:9: note: in expansion of macro 'Z_CBPRINTF_PACK_ARG2'
      370 |         Z_CBPRINTF_PACK_ARG2(arg_idx, _pbuf, _pkg_len, _pkg_offset, _pmax, arg)
          |         ^~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1069:9: note: in expansion of macro 'Z_CBPRINTF_PACK_ARG'
     1069 |         fixed_arg0(idx, x)
          |         ^~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:33:9: note: in expansion of macro 'Z_FOR_EACH_IDX_EXEC'
       33 |         z_call(1, x, fixed_arg0, fixed_arg1)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:23:81: note: in expansion of macro 'Z_FOR_LOOP_2'
       23 |                                 _57, _58, _59, _60, _61, _62, _63, _64, N, ...) N
          |                                                                                 ^
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_loops.h:1072:9: note: in expansion of macro 'Z_FOR_EACH_ENGINE'
     1072 |         Z_FOR_EACH_ENGINE(Z_FOR_EACH_IDX_EXEC, sep, F, _, __VA_ARGS__)
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/util_macro.h:534:9: note: in expansion of macro 'Z_FOR_EACH_IDX'
      534 |         Z_FOR_EACH_IDX(F, sep, REVERSE_ARGS(__VA_ARGS__))
          |         ^~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:491:9: note: in expansion of macro 'FOR_EACH_IDX'
      491 |         FOR_EACH_IDX(Z_CBPRINTF_PACK_ARG, (;), __VA_ARGS__);\
          |         ^~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf_internal.h:528:9: note: in expansion of macro 'Z_CBPRINTF_STATIC_PACKAGE_GENERIC'
      528 |         Z_CBPRINTF_STATIC_PACKAGE_GENERIC(packaged, inlen, outlen, \
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/sys/cbprintf.h:387:9: note: in expansion of macro 'Z_CBPRINTF_STATIC_PACKAGE'
      387 |         Z_CBPRINTF_STATIC_PACKAGE(packaged, inlen, outlen, \
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:345:17: note: in expansion of macro 'CBPRINTF_STATIC_PACKAGE'
      345 |                 CBPRINTF_STATIC_PACKAGE(_msg->data, _plen, \
          |                 ^~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:545:17: note: in expansion of macro 'Z_LOG_MSG_STACK_CREATE'
      545 |                 Z_LOG_MSG_STACK_CREATE(_cstr_cnt, _domain_id, _source, _level, _data, \
          |                 ^~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:578:9: note: in expansion of macro 'Z_LOG_MSG_CREATE3'
      578 |         Z_LOG_MSG_CREATE3(_try_0cpy, _mode,  _cstr_cnt, _domain_id, _source,\
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_msg.h:589:9: note: in expansion of macro 'Z_LOG_MSG_CREATE2'
      589 |         Z_LOG_MSG_CREATE2(_try_0cpy, _mode, UTIL_CAT(Z_LOG_FUNC_PREFIX_, _level), \
          |         ^~~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:237:9: note: in expansion of macro 'Z_LOG_MSG_CREATE'
      237 |         Z_LOG_MSG_CREATE(UTIL_NOT(IS_ENABLED(CONFIG_USERSPACE)), _mode, \
          |         ^~~~~~~~~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log_core.h:250:9: note: in expansion of macro 'Z_LOG2'
      250 |         Z_LOG2(_level, 0, __log_current_const_data, __log_current_dynamic_data, __VA_ARGS__)
          |         ^~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/logging/log.h:63:24: note: in expansion of macro 'Z_LOG'
       63 | #define LOG_INF(...)   Z_LOG(LOG_LEVEL_INF, __VA_ARGS__)
          |                        ^~~~~
    C:/NordicTutorial/ncs-intm/inter_less1_exer2_solution/src/main.c:74:5: note: in expansion of macro 'LOG_INF'
       74 |     LOG_INF("x does not exist %d",x);
          |     ^~~~~~~
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\cf2149caf2\opt\bin\cmake.EXE' --build 'c:\NordicTutorial\ncs-intm\inter_less1_exer2_solution\build'

  • I ran across the Troubleshooting devicetree page, I ran across something about macro expansion errors.

    Bottom line, add "CONFIG_COMPILER_TRACK_MACRO_EXPANSION=n"  to your prj.conf and the 136 errors are gone, replaced by the actual error and a few expansion errors without detail:

    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c: In function 'main':
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: 'x' undeclared (first use in this function)
    42 | LOG_INF("%d",x);
    | ^~~~~~~
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: note: each undeclared identifier is reported only once for each function it appears in
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: '_v1' undeclared (first use in this function)
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: expression in static assertion is not an integer
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: '__v' undeclared (first use in this function)
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: '_v' undeclared (first use in this function); did you mean '_d'?
    42 | LOG_INF("%d",x);
    | ^~~~~~~
    | _d

Reply
  • I ran across the Troubleshooting devicetree page, I ran across something about macro expansion errors.

    Bottom line, add "CONFIG_COMPILER_TRACK_MACRO_EXPANSION=n"  to your prj.conf and the 136 errors are gone, replaced by the actual error and a few expansion errors without detail:

    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c: In function 'main':
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: 'x' undeclared (first use in this function)
    42 | LOG_INF("%d",x);
    | ^~~~~~~
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: note: each undeclared identifier is reported only once for each function it appears in
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: '_v1' undeclared (first use in this function)
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: expression in static assertion is not an integer
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: '__v' undeclared (first use in this function)
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: '_v' undeclared (first use in this function); did you mean '_d'?
    42 | LOG_INF("%d",x);
    | ^~~~~~~
    | _d

Children
No Data
Related