Title: #line takes effect inside skipped groups and does not expand macros · Issue #734 · cppcheck-opensource/simplecpp · GitHub
Open Graph Title: #line takes effect inside skipped groups and does not expand macros · Issue #734 · cppcheck-opensource/simplecpp
X Title: #line takes effect inside skipped groups and does not expand macros · Issue #734 · cppcheck-opensource/simplecpp
Description: simplecpp handles #line while the file is read (TokenList::readfile), before conditional inclusion and macros are processed. A #line in a skipped group therefore still changes the line numbers, and a #line whose operands are macros is ig...
Open Graph Description: simplecpp handles #line while the file is read (TokenList::readfile), before conditional inclusion and macros are processed. A #line in a skipped group therefore still changes the line numbers, and...
X Description: simplecpp handles #line while the file is read (TokenList::readfile), before conditional inclusion and macros are processed. A #line in a skipped group therefore still changes the line numbers, and...
Opengraph URL: https://github.com/cppcheck-opensource/simplecpp/issues/734
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"#line takes effect inside skipped groups and does not expand macros","articleBody":" simplecpp handles `#line` while the file is read (`TokenList::readfile`), before conditional inclusion and macros are processed. A\n `#line` in a skipped group therefore still changes the line numbers, and a `#line` whose operands are macros is ignored.\n \n ```c\n #if 0\n #line 100\n #endif\n __LINE__\n ```\n\n gcc: `4`. simplecpp: `101`.\n\n ### Inside a skipped group\n\n | Input | gcc | simplecpp |\n |---|---|---|\n | `#if 0` / `#line 100` / `#endif` / `__LINE__` | `4` | `101` |\n | `#ifdef X` / `#line 100` / `#endif` / `__LINE__` | `4` | `101` |\n | `#if 0` / `#line 100 \"x.c\"` / `#endif` / `__FILE__` | `\"c.c\"` | `\"x.c\"` |\n | `#if 0` / `#line -5` / `#endif` / `int x;` | `int x;` | error: Invalid character in line directive: '-'. (all output is lost) |\n\n ### Operands are macros\n\n The standard says the tokens after `#line` are macro-expanded when they don't match one of the two forms directly (C11 §6.10.4p5, C++\n [cpp.line]).\n\n | Input | gcc | simplecpp |\n |---|---|---|\n | `#define L 200` / `#line L` / `__LINE__` | `200` | `3` |\n | `#define F \"y.c\"` / `#line 10 F` / `__FILE__ __LINE__` | `\"y.c\" 10` | `\"c.c\" 10` |\n | `#define LF 20 \"z.c\"` / `#line LF` / `__FILE__ __LINE__` | `\"z.c\" 20` | `\"c.c\" 3` |\n\n Already correct, and must stay correct: `#line 10 \"f.c\"` and the GCC line marker `# 10 \"m.c\"` (used in preprocessed `.i` files).\n","author":{"url":"https://github.com/danmar","@type":"Person","name":"danmar"},"datePublished":"2026-11-07T14:48:29Z","url":"https://github.com/cppcheck-opensource/simplecpp/issues/734"}
| 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:c145bd97-7e8a-737e-d9cc-018e617d4e0b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ACDA:11F164:1A58DB:255948:6AFC4AF4 |
| html-safe-nonce | 1cb4c8ce75eae1f001ed9a72ff4c673bacd3f70bbf537b8eb2044e443b45064a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0RBOjExRjE2NDoxQTU4REI6MjU1OTQ4OjZBRkM0QUY0IiwidmlzaXRvcl9pZCI6IjM5OTc5NjkwNzIzMjU5Mzc5MDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1bff9b37e3a0606a90ad1c90b2296332ef1aaae14b7b38d11309d8eb2ad8a6fe |
| hovercard-subject-tag | issue:6260392933 |
| 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/734/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c1a7c3acb1925d3f13d2abb4d570c291c75ad1b80716e6297d0a259d5c29b474/cppcheck-opensource/simplecpp/issues/734 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c1a7c3acb1925d3f13d2abb4d570c291c75ad1b80716e6297d0a259d5c29b474/cppcheck-opensource/simplecpp/issues/734 |
| og:image:alt | simplecpp handles #line while the file is read (TokenList::readfile), before conditional inclusion and macros are processed. A #line in a skipped group therefore still changes the line numbers, and... |
| 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 | 20dfdada12bc00bbf8065dc10dfe3ff3711b85db5cc117f83296f8074e861960 |
| 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 | 041909865f220ab51714e7efdc276dd349a99ade |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width