Title: Defect: Prepocessor fails to expand x-macro macro parameter · Issue #201 · cppcheck-opensource/simplecpp · GitHub
Open Graph Title: Defect: Prepocessor fails to expand x-macro macro parameter · Issue #201 · cppcheck-opensource/simplecpp
X Title: Defect: Prepocessor fails to expand x-macro macro parameter · Issue #201 · cppcheck-opensource/simplecpp
Description: cppcheck fails to preprocess the code below: > cppcheck --version Cppcheck 2.3 > cppcheck -E main.c main.c:12:0: error: failed to expand 'COLOR_SET', Wrong number of parameters for macro 'ALL_COLORS'. [preprocessorErrorDirective] #define...
Open Graph Description: cppcheck fails to preprocess the code below: > cppcheck --version Cppcheck 2.3 > cppcheck -E main.c main.c:12:0: error: failed to expand 'COLOR_SET', Wrong number of parameters for macro 'ALL_COLOR...
X Description: cppcheck fails to preprocess the code below: > cppcheck --version Cppcheck 2.3 > cppcheck -E main.c main.c:12:0: error: failed to expand 'COLOR_SET', Wrong number of parameters for ma...
Opengraph URL: https://github.com/cppcheck-opensource/simplecpp/issues/201
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Defect: Prepocessor fails to expand x-macro macro parameter","articleBody":"cppcheck fails to preprocess the code below:\r\n\r\n```\r\n\u003e cppcheck --version\r\nCppcheck 2.3\r\n\u003e cppcheck -E main.c\r\nmain.c:12:0: error: failed to expand 'COLOR_SET', Wrong number of parameters for macro 'ALL_COLORS'. [preprocessorErrorDirective]\r\n#define COLOR_SET ALL_COLORS(WARM_COLORS)\r\n^\r\n\r\n```\r\n\r\nmain.c:\r\n\r\n```\r\n#define ALL_COLORS(warm_colors) \\\r\n\tX(Blue) \\\r\n\tX(Green) \\\r\n\tX(Purple) \\\r\n\twarm_colors\r\n\r\n#define WARM_COLORS \\\r\n\tX(Red) \\\r\n\tX(Yellow) \\\r\n\tX(Orange)\r\n\r\n#define COLOR_SET ALL_COLORS(WARM_COLORS)\r\n\r\n#define X(color) #color,\r\n\r\nCOLOR_SET\r\n```\r\n\r\ngcc handles it fine:\r\n\r\n```\r\n\u003e gcc -E main.c\r\n# 1 \"main.c\"\r\n# 1 \"\u003cbuilt-in\u003e\"\r\n# 1 \"\u003ccommand-line\u003e\"\r\n# 1 \"/usr/include/stdc-predef.h\" 1 3 4\r\n# 1 \"\u003ccommand-line\u003e\" 2\r\n# 1 \"main.c\"\r\n# 16 \"main.c\"\r\n\"Blue\", \"Green\", \"Purple\", \"Red\", \"Yellow\", \"Orange\",\r\n```","author":{"url":"https://github.com/mavik1","@type":"Person","name":"mavik1"},"datePublished":"2021-01-07T14:11:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/201/simplecpp/issues/201"}
| 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:01a451eb-ddf3-82b9-5977-b2021ff52424 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A398:34DA5A:2619925:3508B60:6A4F5489 |
| html-safe-nonce | dc4f32dfb58711503ce069adc6ff7e9a086f91b360a6e11e5fa2bfc657cbb7be |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzk4OjM0REE1QToyNjE5OTI1OjM1MDhCNjA6NkE0RjU0ODkiLCJ2aXNpdG9yX2lkIjoiODgyNDk4Mzk5MzM4NjQ4ODk3MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a64889f9f67c460a6626ef461da17114c2709ab6ae11f7e1ffe3052862ae6f88 |
| hovercard-subject-tag | issue:781341868 |
| 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/201/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fa30c98e556cad76474bab4ae31b78c6a0b0fed115caf80b85aa1e73cbb38355/cppcheck-opensource/simplecpp/issues/201 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fa30c98e556cad76474bab4ae31b78c6a0b0fed115caf80b85aa1e73cbb38355/cppcheck-opensource/simplecpp/issues/201 |
| og:image:alt | cppcheck fails to preprocess the code below: > cppcheck --version Cppcheck 2.3 > cppcheck -E main.c main.c:12:0: error: failed to expand 'COLOR_SET', Wrong number of parameters for macro 'ALL_COLOR... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mavik1 |
| 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 | 4b249b445842943ed31549e027f57a8ade9881ed |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width