{"action":"created","issue":{"url":"https://api.github.com/repos/uncrustify/uncrustify/issues/817","repository_url":"https://api.github.com/repos/uncrustify/uncrustify","labels_url":"https://api.github.com/repos/uncrustify/uncrustify/issues/817/labels{/name}","comments_url":"https://api.github.com/repos/uncrustify/uncrustify/issues/817/comments","events_url":"https://api.github.com/repos/uncrustify/uncrustify/issues/817/events","html_url":"https://github.com/uncrustify/uncrustify/issues/817","id":189351743,"number":817,"title":"Wrong #endif indentation in switch with pp_indent_at_level=true","user":{"login":"Soukyuu","id":2095054,"avatar_url":"https://avatars.githubusercontent.com/u/2095054?v=3","gravatar_id":"","url":"https://api.github.com/users/Soukyuu","html_url":"https://github.com/Soukyuu","followers_url":"https://api.github.com/users/Soukyuu/followers","following_url":"https://api.github.com/users/Soukyuu/following{/other_user}","gists_url":"https://api.github.com/users/Soukyuu/gists{/gist_id}","starred_url":"https://api.github.com/users/Soukyuu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Soukyuu/subscriptions","organizations_url":"https://api.github.com/users/Soukyuu/orgs","repos_url":"https://api.github.com/users/Soukyuu/repos","events_url":"https://api.github.com/users/Soukyuu/events{/privacy}","received_events_url":"https://api.github.com/users/Soukyuu/received_events","type":"User","site_admin":false},"labels":[{"id":414546969,"url":"https://api.github.com/repos/uncrustify/uncrustify/labels/C%20and%20C++","name":"C and C++","color":"5319e7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-11-15T10:18:03Z","updated_at":"2016-11-21T15:20:09Z","closed_at":"2016-11-21T14:18:16Z","body":"This is with version 0.64 on windows.\r\n\r\nMinimal example:\r\n```\r\n#define MYDEF 1\r\n\r\nvoid test()\r\n{\r\n   int a = 0;\r\n   switch(a)\r\n   {\r\n      #if MYDEF 1\r\n         case 0:\r\n      #else\r\n         case 1:\r\n      #endif\r\n            a = 123;\r\n            break;\r\n   }\r\n}\r\n```\r\nOutput:\r\n```\r\nvoid test()\r\n{\r\n   int a = 0;\r\n   switch(a)\r\n   {\r\n      #if MYDEF 1\r\n         case 0:\r\n      #else\r\n         case 1:\r\n            #endif\r\n            a = 123;\r\n            break;\r\n   }\r\n}\r\n```\r\nMinimal config to reproduce:\r\n```\r\npp_indent_at_level=true\r\npp_if_indent_code=true\r\nindent_columns=3\r\nindent_switch_case=3\r\n```\r\nThe option that actually causes it is `pp_indent_at_level`, while `pp_if_indent_code` adds another indent to it. The \"beauty\" of this code fragment aside, I'd expect the `#endif` to be at the same level as their corresponding `#if` and `#else`..."},"comment":{"url":"https://api.github.com/repos/uncrustify/uncrustify/issues/comments/261966543","html_url":"https://github.com/uncrustify/uncrustify/issues/817#issuecomment-261966543","issue_url":"https://api.github.com/repos/uncrustify/uncrustify/issues/817","id":261966543,"user":{"login":"Soukyuu","id":2095054,"avatar_url":"https://avatars.githubusercontent.com/u/2095054?v=3","gravatar_id":"","url":"https://api.github.com/users/Soukyuu","html_url":"https://github.com/Soukyuu","followers_url":"https://api.github.com/users/Soukyuu/followers","following_url":"https://api.github.com/users/Soukyuu/following{/other_user}","gists_url":"https://api.github.com/users/Soukyuu/gists{/gist_id}","starred_url":"https://api.github.com/users/Soukyuu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Soukyuu/subscriptions","organizations_url":"https://api.github.com/users/Soukyuu/orgs","repos_url":"https://api.github.com/users/Soukyuu/repos","events_url":"https://api.github.com/users/Soukyuu/events{/privacy}","received_events_url":"https://api.github.com/users/Soukyuu/received_events","type":"User","site_admin":false},"created_at":"2016-11-21T15:20:09Z","updated_at":"2016-11-21T15:20:09Z","body":"It can be, and is, compiled regularly. The code is certainly not beautiful, but it _is_ syntactically correct.\r\nIf the define is set to one specific value, then the condition is different from when it's not set:\r\n\r\nFor `MYDEF 1`, the source code would be\r\n```\r\nvoid test()\r\n{\r\n   int a = 0;\r\n   switch(a)\r\n   {\r\n         case 0:\r\n            a = 123;\r\n            break;\r\n   }\r\n}\r\n```\r\nFor any other value,\r\n```\r\nvoid test()\r\n{\r\n   int a = 0;\r\n   switch(a)\r\n   {\r\n         case 1:\r\n            a = 123;\r\n            break;\r\n   }\r\n}\r\n```\r\nWhat is the reason uncrustify cannot be extended to be able to deal with that?"}}
{"actor":{"display_login":"Soukyuu"}}