Title: Fix: simplecpp ## fails to expand function-like macro when '(' is not adjacent by paulafy6 · Pull Request #655 · cppcheck-opensource/simplecpp · GitHub
Open Graph Title: Fix: simplecpp ## fails to expand function-like macro when '(' is not adjacent by paulafy6 · Pull Request #655 · cppcheck-opensource/simplecpp
X Title: Fix: simplecpp ## fails to expand function-like macro when '(' is not adjacent by paulafy6 · Pull Request #655 · cppcheck-opensource/simplecpp
Description: When the ## operator concatenates two tokens to form a function-like macro name (e.g. PREFIX_ ## kind → PREFIX_SCALAR), simplecpp looked for the argument list '(...)' only at B->next. In PAR-style indirection patterns the '(' is separated from B by a comma or a variadic parameter token: #define PAR(a, ...) a __VA_ARGS__ #define PREFIX_SCALAR(T, N) T N #define DISPATCH(kind, ...) PAR(PREFIX_ ## kind, (__VA_ARGS__)) DISPATCH(SCALAR, int, x) // was: [unknownMacro] — now: int x Because '(' was not found, expansion was aborted and the macro was reported as unknownMacro, causing cppcheck to skip the entire translation unit. Fix: when B->next is not '(' and we are in the appendTokens context (expandResult==false), walk forward on the same line skipping ',' separators and resolving named parameter tokens via expandArg(). The first '(' found (literally or as the head of an expanded argument) is used as lpar and passed to appendTokens() as before. The forwardScan flag ensures expandToken() is called on the result even when expandResult is false. The forward scan is restricted to expandResult==false to avoid unintended side-effects in the main expansion loop.
Open Graph Description: When the ## operator concatenates two tokens to form a function-like macro name (e.g. PREFIX_ ## kind → PREFIX_SCALAR), simplecpp looked for the argument list '(...)' only at B->next. In...
X Description: When the ## operator concatenates two tokens to form a function-like macro name (e.g. PREFIX_ ## kind → PREFIX_SCALAR), simplecpp looked for the argument list '(...)' only at B-&...
Opengraph URL: https://github.com/cppcheck-opensource/simplecpp/pull/655
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:f251edd9-c9d7-f78d-c877-48968aa3e536 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B7D8:13C54:3CCB966:562AF11:6A4FAAA0 |
| html-safe-nonce | 58a3b3d409d09ffbb9c3687c2b18e7d74e249625ae9f3805cbb200e201ceb3d7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCN0Q4OjEzQzU0OjNDQ0I5NjY6NTYyQUYxMTo2QTRGQUFBMCIsInZpc2l0b3JfaWQiOiI4NTUzMDA4MzQxODczMzA2MjcyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4cfd7026e36be4244a78fc40505ce7aca8178c44d80e18ab782f6026a02a879d |
| hovercard-subject-tag | pull_request:3753122898 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/cppcheck-opensource/simplecpp/pull/655/files |
| twitter:image | https://avatars.githubusercontent.com/u/63363980?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/63363980?s=400&v=4 |
| og:image:alt | When the ## operator concatenates two tokens to form a function-like macro name (e.g. PREFIX_ ## kind → PREFIX_SCALAR), simplecpp looked for the argument list '(...)' only at B->next. In... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| 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