Title: #elif condition is evaluated after a previous group was taken · Issue #709 · cppcheck-opensource/simplecpp · GitHub
Open Graph Title: #elif condition is evaluated after a previous group was taken · Issue #709 · cppcheck-opensource/simplecpp
X Title: #elif condition is evaluated after a previous group was taken · Issue #709 · cppcheck-opensource/simplecpp
Description: When an #if or #elif group has already been taken, simplecpp still evaluates the conditions of later #elif directives. If one of those conditions is invalid, simplecpp reports an error and throws away all output. The standard says only t...
Open Graph Description: When an #if or #elif group has already been taken, simplecpp still evaluates the conditions of later #elif directives. If one of those conditions is invalid, simplecpp reports an error and throws a...
X Description: When an #if or #elif group has already been taken, simplecpp still evaluates the conditions of later #elif directives. If one of those conditions is invalid, simplecpp reports an error and throws a...
Opengraph URL: https://github.com/cppcheck-opensource/simplecpp/issues/709
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"#elif condition is evaluated after a previous group was taken","articleBody":" When an `#if` or `#elif` group has already been taken, simplecpp still evaluates the\n conditions of later `#elif` directives. If one of those conditions is invalid, simplecpp\n reports an error and throws away all output.\n\n The standard says only the first group whose condition is true is processed. Later groups\n are skipped, and their directives are handled as if they were in a skipped group, so their\n conditions are not evaluated (C11 §6.10.1p6, C++ [cpp.cond]).\n\n ### Example\n \n ```c\n #if 1\n 1\n #elif garbage(\n 2\n #endif\n\n - Expected (gcc, clang): 1\n - Actual (simplecpp): syntax error: failed to evaluate #elif condition, undefined function-like macro invocation: garbage( ... ) and all output is dropped.\n\n #elif 1/0 after a taken group fails the same way, with a division-by-zero error.\n\n Fix\n\n Evaluate #if/#ifdef/#ifndef only inside an active group, and\n #elif/#elifdef/#elifndef only when no earlier group was taken.\n\n Side effect: #elif directives after a taken group no longer get an entry in the\n ifCond list, because they aren't evaluated.\n","author":{"url":"https://github.com/danmar","@type":"Person","name":"danmar"},"datePublished":"2026-11-04T14:29:29Z","url":"https://github.com/cppcheck-opensource/simplecpp/issues/709"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:8bb7f63d-a567-3d0c-3ded-450d4ed5c701 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F5C:1A8E19:3BB3CC:530D18:6AFC51D7 |
| html-safe-nonce | 66765ceaa796f426fa8a78939370da21de75e2eaa0977f571647729a68cc513f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjVDOjFBOEUxOTozQkIzQ0M6NTMwRDE4OjZBRkM1MUQ3IiwidmlzaXRvcl9pZCI6IjE1MTI2MTE2NzI5NzgzNzkyMjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 818b5fbe54a7d9b6151851f070f5b40dc3178ceee8c33cadde3786978e6861d3 |
| hovercard-subject-tag | issue:6204766674 |
| 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/709/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fdd1572ffe104c0f4a08314f5827c569bab9fe33366f42983fc858fc99b633c0/cppcheck-opensource/simplecpp/issues/709 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fdd1572ffe104c0f4a08314f5827c569bab9fe33366f42983fc858fc99b633c0/cppcheck-opensource/simplecpp/issues/709 |
| og:image:alt | When an #if or #elif group has already been taken, simplecpp still evaluates the conditions of later #elif directives. If one of those conditions is invalid, simplecpp reports an error and throws a... |
| 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 | b63557e0027d8014589e873df28328da74a4356701bb1a9eab49dbf012ba8fa6 |
| 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 | 0243355b0352c83733a042e0dfb3d75149b51261 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width