)]}'
{"id":"openocd~master~Id7a8e3f03696f2fbb0237e4a71add0d5ccc1b7df","project":"openocd","branch":"master","hashtags":[],"change_id":"Id7a8e3f03696f2fbb0237e4a71add0d5ccc1b7df","subject":"openocd: simplify return path dropping temp variable","status":"NEW","created":"2026-03-29 21:55:42.000000000","updated":"2026-04-06 22:07:20.000000000","submit_type":"CHERRY_PICK","mergeable":true,"submittable":false,"total_comment_count":1,"unresolved_comment_count":0,"has_review_started":true,"meta_rev_id":"50d11797ff13f12c2f8dcfd29e9ed224ecc76d79","_number":9552,"owner":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"actions":{},"labels":{"Verified":{"approved":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"all":[{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},{"tag":"autogenerated:jenkins-gerrit-trigger","value":1,"date":"2026-04-06 21:27:45.000000000","permitted_voting_range":{"min":-1,"max":1},"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]}],"values":{"-1":"Fails"," 0":"No score","+1":"Verified"},"description":"","default_value":0},"Code-Review":{"recommended":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"all":[{"value":1,"date":"2026-04-06 22:07:20.000000000","permitted_voting_range":{"min":-2,"max":2},"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]}],"values":{"-2":"This shall not be merged","-1":"I would prefer this is not merged as is"," 0":"No score","+1":"Looks good to me, but someone else must approve","+2":"Looks good to me, approved"},"description":"","value":1,"default_value":0}},"removable_reviewers":[],"reviewers":{"REVIEWER":[{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"}]},"pending_reviewers":{},"reviewer_updates":[{"updated":"2026-03-29 22:59:44.000000000","updated_by":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"reviewer":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"state":"CC"},{"updated":"2026-03-30 00:51:27.000000000","updated_by":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"reviewer":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"state":"REVIEWER"}],"messages":[{"id":"f295a1692541b8d2b129467705fcac9fbc5fd75d","tag":"autogenerated:gerrit:newPatchSet","author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"real_author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"date":"2026-03-29 21:55:42.000000000","message":"Uploaded patch set 1.","accounts_in_message":[],"_revision_number":1},{"id":"d7dc97b058ec54961dfade8f08529ffd98a6059e","tag":"autogenerated:jenkins-gerrit-trigger","author":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"real_author":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"date":"2026-03-30 00:51:27.000000000","message":"Patch Set 1: Verified+1\n\nBuild Successful \n\nhttps://build.openocd.org/job/openocd-gerrit-build/22034/ : SUCCESS\n\nhttps://build.openocd.org/job/openocd-gerrit/22930/ : SUCCESS","accounts_in_message":[],"_revision_number":1},{"id":"f55f797ec4298b1f339af1cc9b5e6f8840b63cc3","author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"real_author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"date":"2026-03-30 08:12:57.000000000","message":"Patch Set 1:\n\n(1 comment)","accounts_in_message":[],"_revision_number":1},{"id":"cd2a1a1d7f393baed200b3cb55bb9b6f92f6d6a1","tag":"autogenerated:gerrit:newPatchSet","author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"real_author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"date":"2026-04-06 17:22:23.000000000","message":"Uploaded patch set 2.\n\nOutdated Votes:\n* Verified+1 (copy condition: \"changekind:NO_CHANGE\")\n","accounts_in_message":[],"_revision_number":2},{"id":"4d8dddf15f2a3c9920b9fc7b20ab18361238db44","tag":"autogenerated:jenkins-gerrit-trigger","author":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"real_author":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"date":"2026-04-06 21:27:45.000000000","message":"Patch Set 2: Verified+1\n\nBuild Successful \n\nhttps://build.openocd.org/job/openocd-gerrit-build/22063/ : SUCCESS\n\nhttps://build.openocd.org/job/openocd-gerrit/22959/ : SUCCESS","accounts_in_message":[],"_revision_number":2},{"id":"50d11797ff13f12c2f8dcfd29e9ed224ecc76d79","author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"real_author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"date":"2026-04-06 22:07:20.000000000","message":"Patch Set 2: Code-Review+1","accounts_in_message":[],"_revision_number":2}],"current_revision":"5cbe09ad76fa7abea63fdffb0179ab8f01d17f23","revisions":{"9ad0294e373e1bd42c9cdcb4a18baae82fe9951a":{"kind":"REWORK","_number":1,"created":"2026-03-29 21:55:42.000000000","uploader":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"ref":"refs/changes/52/9552/1","fetch":{"anonymous http":{"url":"https://review.openocd.org/openocd","ref":"refs/changes/52/9552/1","commands":{"Branch":"git fetch https://review.openocd.org/openocd refs/changes/52/9552/1 \u0026\u0026 git checkout -b change-9552 FETCH_HEAD","Checkout":"git fetch https://review.openocd.org/openocd refs/changes/52/9552/1 \u0026\u0026 git checkout FETCH_HEAD","Cherry Pick":"git fetch https://review.openocd.org/openocd refs/changes/52/9552/1 \u0026\u0026 git cherry-pick FETCH_HEAD","Format Patch":"git fetch https://review.openocd.org/openocd refs/changes/52/9552/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD","Pull":"git pull https://review.openocd.org/openocd refs/changes/52/9552/1","Reset To":"git fetch https://review.openocd.org/openocd refs/changes/52/9552/1 \u0026\u0026 git reset --hard FETCH_HEAD"}}},"commit":{"parents":[{"commit":"9236444d42722c6da0bb66d6e4a50e07a368b75c","subject":"openocd: drop variable for constant return value"}],"author":{"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","date":"2026-03-29 21:29:18.000000000","tz":120},"committer":{"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","date":"2026-03-29 21:54:21.000000000","tz":120},"subject":"openocd: simplify return path dropping temp variable","message":"openocd: simplify return path dropping temp variable\n\nDetect the pattern:\n\tvariable \u003d expression;\n\treturn variable;\nreplace it with:\n\treturn expression;\nand if the temporarily variable is not anymore used, remove it.\n\nThis patch has been implemented with a simple coccinelle script\n\t// Step 1: simplify `v \u003d e; return v;` -\u003e `return e;`\n\t@@\n\tidentifier v;\n\texpression e;\n\t@@\n\t- v \u003d e;\n\t- return v;\n\t+ return e;\n\n\t// Step 2: drop declaration of v if it is never used\n\t@@\n\tidentifier v;\n\ttype T;\n\t@@\n\t- T v;\n\t  ... when !\u003d v\n\nwhich is nice but not fully trustable as it:\n- uses default 8 space TAB indentation;\n- replaces also non-local variables;\n- drops comments at the end of the modified line;\n- doesn\u0027t drop useless parenthesis.\n\nAlso some replacement makes the code less readable, so the whole\nhas been manually checked and fixed.\n\nWhile step 1 in the script is very fast, step 2 is deadly slow.\n\nChange-Id: Id7a8e3f03696f2fbb0237e4a71add0d5ccc1b7df\nSigned-off-by: Antonio Borneo \u003cborneo.antonio@gmail.com\u003e\n"}},"5cbe09ad76fa7abea63fdffb0179ab8f01d17f23":{"kind":"REWORK","_number":2,"created":"2026-04-06 17:22:23.000000000","uploader":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"ref":"refs/changes/52/9552/2","fetch":{"anonymous http":{"url":"https://review.openocd.org/openocd","ref":"refs/changes/52/9552/2","commands":{"Branch":"git fetch https://review.openocd.org/openocd refs/changes/52/9552/2 \u0026\u0026 git checkout -b change-9552 FETCH_HEAD","Checkout":"git fetch https://review.openocd.org/openocd refs/changes/52/9552/2 \u0026\u0026 git checkout FETCH_HEAD","Cherry Pick":"git fetch https://review.openocd.org/openocd refs/changes/52/9552/2 \u0026\u0026 git cherry-pick FETCH_HEAD","Format Patch":"git fetch https://review.openocd.org/openocd refs/changes/52/9552/2 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD","Pull":"git pull https://review.openocd.org/openocd refs/changes/52/9552/2","Reset To":"git fetch https://review.openocd.org/openocd refs/changes/52/9552/2 \u0026\u0026 git reset --hard FETCH_HEAD"}}},"commit":{"parents":[{"commit":"f1b5910bc5e8c25fc391d50d8dd7c6c9fe08185e","subject":"openocd: drop variable for constant return value"}],"author":{"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","date":"2026-03-29 21:29:18.000000000","tz":120},"committer":{"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","date":"2026-04-06 17:21:29.000000000","tz":120},"subject":"openocd: simplify return path dropping temp variable","message":"openocd: simplify return path dropping temp variable\n\nDetect the pattern:\n\tvariable \u003d expression;\n\treturn variable;\nreplace it with:\n\treturn expression;\nand if the temporarily variable is not anymore used, remove it.\n\nThis patch has been implemented with a simple coccinelle script\n\t// Step 1: simplify `v \u003d e; return v;` -\u003e `return e;`\n\t@@\n\tidentifier v;\n\texpression e;\n\t@@\n\t- v \u003d e;\n\t- return v;\n\t+ return e;\n\n\t// Step 2: drop declaration of v if it is never used\n\t@@\n\tidentifier v;\n\ttype T;\n\t@@\n\t- T v;\n\t  ... when !\u003d v\n\nwhich is nice but not fully trustable as it:\n- uses default 8 space TAB indentation;\n- replaces also non-local variables;\n- drops comments at the end of the modified line;\n- doesn\u0027t drop useless parenthesis.\n\nAlso some replacement makes the code less readable, so the whole\nhas been manually checked and fixed.\n\nWhile step 1 in the script is very fast, step 2 is deadly slow.\n\nChange-Id: Id7a8e3f03696f2fbb0237e4a71add0d5ccc1b7df\nSigned-off-by: Antonio Borneo \u003cborneo.antonio@gmail.com\u003e\n"}}},"requirements":[],"submit_records":[{"rule_name":"gerrit~DefaultSubmitRule","status":"NOT_READY","labels":[{"label":"Verified","status":"OK","applied_by":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]}},{"label":"Code-Review","status":"NEED"}]}],"submit_requirements":[{"name":"Verified","status":"SATISFIED","is_legacy":true,"submittability_expression_result":{"expression":"label:Verified\u003dMAX -label:Verified\u003dMIN","fulfilled":true,"status":"PASS","passing_atoms":["label:Verified\u003dMAX","-label:Verified\u003dMIN"],"failing_atoms":[]}},{"name":"Code-Review","status":"UNSATISFIED","is_legacy":true,"submittability_expression_result":{"expression":"label:Code-Review\u003dMAX -label:Code-Review\u003dMIN","fulfilled":false,"status":"FAIL","passing_atoms":[],"failing_atoms":["label:Code-Review\u003dMAX","-label:Code-Review\u003dMIN"]}}]}
