diff options
author | Khem Raj <raj.khem@gmail.com> | 2021-06-04 12:41:05 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2021-06-05 06:06:27 -0700 |
commit | 2faae996e1139415021e0f1c6a1987b578954e3f (patch) | |
tree | b9d00eacf1c246c804e553bd5300aeecd2281dab | |
parent | 4bcefa8176cb832a20f17c548a3108e7e57d6cf0 (diff) | |
download | meta-openembedded-2faae996e1139415021e0f1c6a1987b578954e3f.tar.gz |
indent: Remove dead code using count_parens function
clang static analyser finds it as dead code, and it indeed is dead code
so remove it
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | meta-oe/recipes-extended/indent/indent/0001-Remove-dead-paren_level-code.patch | 79 | ||||
-rw-r--r-- | meta-oe/recipes-extended/indent/indent_2.2.12.bb | 1 |
2 files changed, 80 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/indent/indent/0001-Remove-dead-paren_level-code.patch b/meta-oe/recipes-extended/indent/indent/0001-Remove-dead-paren_level-code.patch new file mode 100644 index 000000000..5a474cf0f --- /dev/null +++ b/meta-oe/recipes-extended/indent/indent/0001-Remove-dead-paren_level-code.patch | |||
@@ -0,0 +1,79 @@ | |||
1 | From 5af65ce9674a69054c9a8405e51794c6f3ca41df Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 4 Jun 2021 12:34:18 -0700 | ||
4 | Subject: [PATCH] Remove dead paren_level code | ||
5 | |||
6 | Local variable `paren_level' in src/output.c:dump_line_code() is | ||
7 | initialized to 0, then incremented with count_parens() return | ||
8 | value, and then the variable is never used. Also count_parens() | ||
9 | has no side effect. Thus this patch removes this useless code. | ||
10 | |||
11 | Upstream-Status: Submitted [https://mail.gnu.org/archive/html/bug-indent/2011-04/msg00000.html] | ||
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
13 | --- | ||
14 | src/output.c | 35 ----------------------------------- | ||
15 | 1 file changed, 35 deletions(-) | ||
16 | |||
17 | diff --git a/src/output.c b/src/output.c | ||
18 | index ee01bcc..5b92167 100644 | ||
19 | --- a/src/output.c | ||
20 | +++ b/src/output.c | ||
21 | @@ -798,37 +798,6 @@ static int dump_line_label(void) | ||
22 | return cur_col; | ||
23 | } | ||
24 | |||
25 | -/** | ||
26 | - * | ||
27 | - */ | ||
28 | - | ||
29 | -static int count_parens( | ||
30 | - const char * string) | ||
31 | -{ | ||
32 | - int paren_level = 0; | ||
33 | - | ||
34 | - while (*string) | ||
35 | - { | ||
36 | - switch (*string) | ||
37 | - { | ||
38 | - case '(': | ||
39 | - case '[': | ||
40 | - paren_level++; | ||
41 | - break; | ||
42 | - case ')': | ||
43 | - case ']': | ||
44 | - paren_level--; | ||
45 | - break; | ||
46 | - default: | ||
47 | - break; | ||
48 | - } | ||
49 | - | ||
50 | - string++; | ||
51 | - } | ||
52 | - | ||
53 | - return paren_level; | ||
54 | -} | ||
55 | - | ||
56 | /** | ||
57 | * | ||
58 | */ | ||
59 | @@ -840,8 +809,6 @@ static void dump_line_code( | ||
60 | BOOLEAN * pbreak_line, | ||
61 | int target_col_break) | ||
62 | { | ||
63 | - int paren_level = 0; | ||
64 | - | ||
65 | if (s_code != e_code) | ||
66 | { /* print code section, if any */ | ||
67 | int i; | ||
68 | @@ -928,8 +895,6 @@ static void dump_line_code( | ||
69 | |||
70 | *pcur_col = count_columns (*pcur_col, s_code, NULL_CHAR); | ||
71 | |||
72 | - paren_level += count_parens(s_code); | ||
73 | - | ||
74 | s_code[buf_break->offset] = c; | ||
75 | |||
76 | *pnot_truncated = 0; | ||
77 | -- | ||
78 | 2.31.1 | ||
79 | |||
diff --git a/meta-oe/recipes-extended/indent/indent_2.2.12.bb b/meta-oe/recipes-extended/indent/indent_2.2.12.bb index 90ba8a2e6..829bf0fc1 100644 --- a/meta-oe/recipes-extended/indent/indent_2.2.12.bb +++ b/meta-oe/recipes-extended/indent/indent_2.2.12.bb | |||
@@ -16,6 +16,7 @@ SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \ | |||
16 | file://0001-src-indent.c-correct-the-check-for-locale.h.patch \ | 16 | file://0001-src-indent.c-correct-the-check-for-locale.h.patch \ |
17 | file://0001-Makefile.am-remove-regression-dir.patch \ | 17 | file://0001-Makefile.am-remove-regression-dir.patch \ |
18 | file://0001-Fix-builds-with-recent-gettext.patch \ | 18 | file://0001-Fix-builds-with-recent-gettext.patch \ |
19 | file://0001-Remove-dead-paren_level-code.patch \ | ||
19 | " | 20 | " |
20 | SRC_URI[md5sum] = "4764b6ac98f6654a35da117b8e5e8e14" | 21 | SRC_URI[md5sum] = "4764b6ac98f6654a35da117b8e5e8e14" |
21 | SRC_URI[sha256sum] = "e77d68c0211515459b8812118d606812e300097cfac0b4e9fb3472664263bb8b" | 22 | SRC_URI[sha256sum] = "e77d68c0211515459b8812118d606812e300097cfac0b4e9fb3472664263bb8b" |