Title: failure to preprocess zephyr (blinky example) · Issue #549 · cppcheck-opensource/simplecpp · GitHub
Open Graph Title: failure to preprocess zephyr (blinky example) · Issue #549 · cppcheck-opensource/simplecpp
X Title: failure to preprocess zephyr (blinky example) · Issue #549 · cppcheck-opensource/simplecpp
Description: Reduced example code: #define DT_DRV_COMPAT renesas_ra_external_interrupt #define DT_FOREACH_OKAY_INST_renesas_ra_external_interrupt(fn) fn(0) fn(1) #define _DO_CONCAT(x, y) x ## y #define _CONCAT(x, y) _DO_CONCAT(x, y) #define Z_IS_ENAB...
Open Graph Description: Reduced example code: #define DT_DRV_COMPAT renesas_ra_external_interrupt #define DT_FOREACH_OKAY_INST_renesas_ra_external_interrupt(fn) fn(0) fn(1) #define _DO_CONCAT(x, y) x ## y #define _CONCAT(...
X Description: Reduced example code: #define DT_DRV_COMPAT renesas_ra_external_interrupt #define DT_FOREACH_OKAY_INST_renesas_ra_external_interrupt(fn) fn(0) fn(1) #define _DO_CONCAT(x, y) x ## y #define _CONCAT(...
Opengraph URL: https://github.com/cppcheck-opensource/simplecpp/issues/549
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"failure to preprocess zephyr (blinky example)","articleBody":"Reduced example code:\n```\n#define DT_DRV_COMPAT renesas_ra_external_interrupt\n#define DT_FOREACH_OKAY_INST_renesas_ra_external_interrupt(fn) fn(0) fn(1)\n#define _DO_CONCAT(x, y) x ## y\n#define _CONCAT(x, y) _DO_CONCAT(x, y)\n#define Z_IS_ENABLED1(config_macro) Z_IS_ENABLED2(_XXXX##config_macro)\n#define _XXXX1 _YYYY,\n#define Z_IS_ENABLED2(one_or_two_args) Z_IS_ENABLED3(one_or_two_args 1, 0)\n#define Z_IS_ENABLED3(ignore_this, val, ...) val\n#define Z_COND_CODE_1(_flag, _if_1_code, _else_code)\t__COND_CODE(_XXXX##_flag, _if_1_code, _else_code)\n#define Z_COND_CODE_0(_flag, _if_0_code, _else_code)\t__COND_CODE(_ZZZZ##_flag, _if_0_code, _else_code)\n#define _ZZZZ0 _YYYY,\n#define __COND_CODE(one_or_two_args, _if_code, _else_code)\t__GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code)\n#define __GET_ARG2_DEBRACKET(ignore_this, val, ...) __DEBRACKET val\n#define __DEBRACKET(...) __VA_ARGS__\n#define UTIL_CAT(a, ...) UTIL_PRIMITIVE_CAT(a, __VA_ARGS__)\n#define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__\n#define IS_BIT_SET(value, bit) ((((value) \u003e\u003e (bit)) \u0026 (0x1)) != 0)\n#define COND_CODE_1(_flag, _if_1_code, _else_code)\tZ_COND_CODE_1(_flag, _if_1_code, _else_code)\n#define IS_EQ(a, b) Z_IS_EQ(a, b)\n#define DT_NODE_VENDOR_BY_IDX_OR(node_id, idx, default_value)\tCOND_CODE_1(DT_NODE_VENDOR_HAS_IDX(node_id, idx), (DT_NODE_VENDOR_BY_IDX(node_id, idx)), (default_value))\n\n#define DT_INST_FOREACH_STATUS_OKAY(fn) \\\n\tCOND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT),\t\\\n\t\t (UTIL_CAT(DT_FOREACH_OKAY_INST_,\t\t\\\n\t\t\t DT_DRV_COMPAT)(fn)),\t\t\\\n\t\t ())\n\n#define Z_INIT_PRE_KERNEL_1_PRE_KERNEL_1 1\n#define INIT_LEVEL_ORD(level) \\\n\tCOND_CODE_1(Z_INIT_EARLY_##level, (Z_INIT_ORD_EARLY), \\\n\t(COND_CODE_1(Z_INIT_PRE_KERNEL_1_##level, (Z_INIT_ORD_PRE_KERNEL_1), \\\n\t(COND_CODE_1(Z_INIT_PRE_KERNEL_2_##level, (Z_INIT_ORD_PRE_KERNEL_2), \\\n\t(COND_CODE_1(Z_INIT_POST_KERNEL_##level, (Z_INIT_ORD_POST_KERNEL), \\\n\t(COND_CODE_1(Z_INIT_APPLICATION_##level, (Z_INIT_ORD_APPLICATION), \\\n\t(COND_CODE_1(Z_INIT_SMP_##level, (Z_INIT_ORD_SMP), \\\n\t(ZERO_OR_COMPILE_ERROR(0)))))))))))))\n\n\n#define TYPE_SECTION_ITERABLE(type, varname, secname, section_postfix) \\\n\tZ_DECL_ALIGN(type) varname \\\n\t__in_section(_##secname, static, _CONCAT(section_postfix, _)) __used __noasan\n\n#define STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(struct_type, secname, name, varname) \\\n\tTYPE_SECTION_ITERABLE(struct struct_type, varname, secname, name)\n\n#define DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, pm, data, config, \\\n\t\t\t\tlevel, prio, api, ...) \\\n\tZ_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \\\n\tZ_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \\\n\t\t\tDEVICE_DT_NAME(node_id), init_fn, deinit_fn, \\\n\t\t\tZ_DEVICE_DT_FLAGS(node_id), pm, data, config, level, \\\n\t\t\tprio, api, \\\n\t\t\t\u0026Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)), \\\n\t\t\t__VA_ARGS__)\n\n#define DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, prio, api, \\\n\t\t\t ...) \\\n\tDEVICE_DT_DEINIT_DEFINE(node_id, init_fn, NULL, pm, data, config, \\\n\t\t\t\tlevel, prio, api, __VA_ARGS__)\n\n#define DEVICE_DT_INST_DEFINE(inst, ...)\tDEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)\n\n#define Z_DEVICE_SECTION_NAME(level, prio)\t_CONCAT(INIT_LEVEL_ORD(level), _##prio)\n\n#define Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, init_fn, deinit_fn, flags, pm, data, config, \\\n\t\t\t level, prio, api, state, deps) \\\n\tCOND_CODE_1(DT_NODE_EXISTS(node_id), (), (static)) \\\n\tCOND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (), (const)) \\\n\tSTRUCT_SECTION_ITERABLE_NAMED_ALTERNATE( \\\n\t\tdevice, COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (device_mutable), (device)), \\\n\t\tZ_DEVICE_SECTION_NAME(level, prio), DEVICE_NAME_GET(dev_id)) = \\\n\t\tZ_DEVICE_INIT(name, init_fn, deinit_fn, flags, pm, data, config, api, state, deps, \\\n\t\t\t node_id, dev_id)\n\n#define Z_DEVICE_CHECK_INIT_LEVEL(level) \\\n\tCOND_CODE_1(Z_INIT_PRE_KERNEL_1_##level, (), \\\n\t(COND_CODE_1(Z_INIT_PRE_KERNEL_2_##level, (), \\\n\t(COND_CODE_1(Z_INIT_POST_KERNEL_##level, (), \\\n\t(ZERO_OR_COMPILE_ERROR(0)))))))\n\n#define Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, level, prio) \\\n\tZ_DEVICE_CHECK_INIT_LEVEL(level) \\\n \\\n\tstatic const Z_DECL_ALIGN(struct init_entry) __used __noasan Z_INIT_ENTRY_SECTION( \\\n\t\tlevel, prio, Z_DEVICE_INIT_SUB_PRIO(node_id)) \\\n\t\tZ_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \\\n\t\t\t.init_fn = NULL, \\\n\t\t\t.dev = (const struct device *)\u0026DEVICE_NAME_GET(dev_id), \\\n\t\t}\n\n#define Z_DEVICE_DEFINE(node_id, dev_id, name, init_fn, deinit_fn, flags, pm, \\\n\t\t\tdata, config, level, prio, api, state, ...) \\\n\tZ_DEVICE_NAME_CHECK(name); \\\n \\\n\tIF_ENABLED(CONFIG_DEVICE_DEPS, \\\n\t\t (Z_DEVICE_DEPS_DEFINE(node_id, dev_id, __VA_ARGS__);)) \\\n \\\n\tIF_ENABLED(CONFIG_DEVICE_DT_METADATA, \\\n\t\t (IF_ENABLED(DT_NODE_EXISTS(node_id), \\\n\t\t\t (Z_DEVICE_DT_METADATA_DEFINE(node_id, dev_id);))))\\\n \\\n\tZ_DEVICE_BASE_DEFINE(node_id, dev_id, name, init_fn, deinit_fn, flags, \\\n\t\t\t pm, data, config, level, prio, api, state, \\\n\t\t\t Z_DEVICE_DEPS_NAME(dev_id)); \\\n \\\n\tZ_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, level, prio); \\\n \\\n\tIF_ENABLED(CONFIG_LLEXT_EXPORT_DEVICES, \\\n\t\t(IF_ENABLED(DT_NODE_EXISTS(node_id), \\\n\t\t\t\t(Z_DEVICE_EXPORT(node_id);))))\n\n#define EVENT_ICU_IRQ(channel) BSP_PRV_IELS_ENUM(CONCAT(EVENT_ICU_IRQ, channel))\n\n#define GPIO_INTERRUPT_INIT(index) \\\n\tstatic const struct gpio_ra_irq_config gpio_ra_irq_config##index = { \\\n\t\t.reg = DT_INST_REG_ADDR(index), \\\n\t\t.channel = DT_INST_PROP(index, channel), \\\n\t\t.trigger = \\\n\t\t\tDT_INST_ENUM_IDX_OR(index, renesas_trigger, EXT_INTERRUPT_EDGE_FALLING), \\\n\t\t.digital_filter = DT_INST_PROP_OR(index, renesas_digital_filtering, false), \\\n\t\t.sample_clock = UTIL_CAT(EXT_INTERRUPT_SAMPLE_CLOCK_DIV_, \\\n\t\t\t\t\t DT_INST_PROP_OR(index, renesas_sample_clock_div, 1)), \\\n\t\t.irq = DT_INST_IRQ(index, irq), \\\n\t}; \\\n\tstatic struct gpio_ra_irq_data gpio_ra_irq_data##index; \\\n\tstatic int gpio_ra_irq_init##index(const struct device *dev) \\\n\t{ \\\n\t\tR_ICU-\u003eIELSR[DT_INST_IRQ(index, irq)] = \\\n\t\t\tEVENT_ICU_IRQ(DT_INST_PROP(index, channel)); \\\n \\\n\t\tBSP_ASSIGN_EVENT_TO_CURRENT_CORE(EVENT_ICU_IRQ(DT_INST_PROP(index, channel))); \\\n \\\n\t\tIRQ_CONNECT(DT_INST_IRQ(index, irq), DT_INST_IRQ(index, priority), gpio_ra_isr, \\\n\t\t\t DEVICE_DT_INST_GET(index), 0); \\\n\t\treturn gpio_ra_interrupt_init(dev); \\\n\t}; \\\n\tDEVICE_DT_INST_DEFINE(index, gpio_ra_irq_init##index, NULL, \u0026gpio_ra_irq_data##index, \\\n\t\t\t \u0026gpio_ra_irq_config##index, PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \\\n\t\t\t NULL);\n\nDT_INST_FOREACH_STATUS_OKAY(GPIO_INTERRUPT_INIT)\n```\n\ngcc can preprocess this code without errors but simplecpp generates this error:\n```\nsyntax error: failed to expand 'DT_INST_FOREACH_STATUS_OKAY', Wrong number of parameters for macro 'TYPE_SECTION_ITERABLE'.\n```","author":{"url":"https://github.com/danmar","@type":"Person","name":"danmar"},"datePublished":"2025-09-25T19:48:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/549/simplecpp/issues/549"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7be6b361-be23-bc58-d6cc-4d708a35267d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AA78:383777:2FEE874:4222898:6A4F17B9 |
| html-safe-nonce | e20deb884023b45048cafd365d2109ad25887d58c304b8f8cdbc27b7606f971d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTc4OjM4Mzc3NzoyRkVFODc0OjQyMjI4OTg6NkE0RjE3QjkiLCJ2aXNpdG9yX2lkIjoiNDM0NTU4ODM4ODQwNDIxNjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bbd1a5ae4aa3dd33a40c0a4235e4b5bd88c866b1e6cc8649e7df1e60cbfc8dd5 |
| hovercard-subject-tag | issue:3454892732 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/cppcheck-opensource/simplecpp/549/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e491f7865d422f3fef19f2634b12f29df80ddcddf81be436cab1e5d4be796c75/cppcheck-opensource/simplecpp/issues/549 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e491f7865d422f3fef19f2634b12f29df80ddcddf81be436cab1e5d4be796c75/cppcheck-opensource/simplecpp/issues/549 |
| og:image:alt | Reduced example code: #define DT_DRV_COMPAT renesas_ra_external_interrupt #define DT_FOREACH_OKAY_INST_renesas_ra_external_interrupt(fn) fn(0) fn(1) #define _DO_CONCAT(x, y) x ## y #define _CONCAT(... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | danmar |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/cppcheck-opensource/simplecpp git https://github.com/cppcheck-opensource/simplecpp.git |
| octolytics-dimension-user_id | 278097703 |
| octolytics-dimension-user_login | cppcheck-opensource |
| octolytics-dimension-repository_id | 33434464 |
| octolytics-dimension-repository_nwo | cppcheck-opensource/simplecpp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 33434464 |
| octolytics-dimension-repository_network_root_nwo | cppcheck-opensource/simplecpp |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b8f23afb982271f1b22258a94aede67a6b77760 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width