Commit 701b3a3c0ac4 ("PATCH scripts/kernel-doc") fixed the two instances of literal braces that Perl 5.28 warns about, but there are still more than it doesn't warn about. Escape all left braces that are treated as literal characters. Also escape literal right braces, for consistency and to avoid confusing bracket-matching in text editors.
Showing the changes to scripts/kernel-doc (1 of 1 file). Show all
Unified · Split
| @@ -1062,7 +1062,7 @@ sub dump_struct($$) { · 1061 unmodified lines | ||
| 1062 | 1062 | my $x = shift; |
| 1063 | 1063 | my $file = shift; |
| 1064 | 1064 | |
| 1065 | − if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { | |
| 1065 | + if ($x =~ /(struct|union)\s+(\w+)\s*\{(.*)\}/) { | |
| 1066 | 1066 | my $decl_type = $1; |
| 1067 | 1067 | $declaration_name = $2; |
| 1068 | 1068 | my $members = $3; |
| @@ -1148,20 +1148,20 @@ sub dump_struct($$) { · 79 unmodified lines | ||
| 1148 | 1148 | } |
| 1149 | 1149 | } |
| 1150 | 1150 | } |
| 1151 | − $members =~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)}([^\{\}\;]*)\;/$newmember/; | |
| 1151 | + $members =~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)\}([^\{\}\;]*)\;/$newmember/; | |
| 1152 | 1152 | } |
| 1153 | 1153 | |
| 1154 | 1154 | # Ignore other nested elements, like enums |
| 1155 | − $members =~ s/(\{[^\{\}]*})//g; | |
| 1155 | + $members =~ s/(\{[^\{\}]*\})//g; | |
| 1156 | 1156 | |
| 1157 | 1157 | create_parameterlist($members, ';', $file, $declaration_name); |
| 1158 | 1158 | check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual); |
| 1159 | 1159 | |
| 1160 | 1160 | # Adjust declaration for better display |
| 1161 | − $declaration =~ s/([{;])/$1\n/g; | |
| 1162 | − $declaration =~ s/}\s+;/};/g; | |
| 1161 | + $declaration =~ s/([\{;])/$1\n/g; | |
| 1162 | + $declaration =~ s/\}\s+;/};/g; | |
| 1163 | 1163 | # Better handle inlined enums |
| 1164 | − do {} while ($declaration =~ s/(enum\s+{[^}]+),([^\n])/$1,\n$2/); | |
| 1164 | + do {} while ($declaration =~ s/(enum\s+\{[^\}]+),([^\n])/$1,\n$2/); | |
| 1165 | 1165 | |
| 1166 | 1166 | my @def_args = split /\n/, $declaration; |
| 1167 | 1167 | my $level = 1; |
| @@ -1171,12 +1171,12 @@ sub dump_struct($$) { · 3 unmodified lines | ||
| 1171 | 1171 | $clause =~ s/\s+$//; |
| 1172 | 1172 | $clause =~ s/\s+/ /; |
| 1173 | 1173 | next if (!$clause); |
| 1174 | − $level-- if ($clause =~ m/(})/ && $level > 1); | |
| 1174 | + $level-- if ($clause =~ m/(\})/ && $level > 1); | |
| 1175 | 1175 | if (!($clause =~ m/^\s*#/)) { |
| 1176 | 1176 | $declaration .= "\t" x $level; |
| 1177 | 1177 | } |
| 1178 | 1178 | $declaration .= "\t" . $clause . "\n"; |
| 1179 | − $level++ if ($clause =~ m/(\{)/ && !($clause =~m/}/)); | |
| 1179 | + $level++ if ($clause =~ m/(\{)/ && !($clause =~m/\}/)); | |
| 1180 | 1180 | } |
| 1181 | 1181 | output_declaration($declaration_name, |
| 1182 | 1182 | 'struct', |
| @@ -1244,7 +1244,7 @@ sub dump_enum($$) { · 61 unmodified lines | ||
| 1244 | 1244 | # strip #define macros inside enums |
| 1245 | 1245 | $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos; |
| 1246 | 1246 | |
| 1247 | − if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { | |
| 1247 | + if ($x =~ /enum\s+(\w+)\s*\{(.*)\}/) { | |
| 1248 | 1248 | $declaration_name = $1; |
| 1249 | 1249 | my $members = $2; |
| 1250 | 1250 | my %_members; |
| @@ -1785,7 +1785,7 @@ sub process_proto_type($$) { · 534 unmodified lines | ||
| 1785 | 1785 | } |
| 1786 | 1786 | |
| 1787 | 1787 | while (1) { |
| 1788 | − if ( $x =~ /([^{};]*)([{};])(.*)/ ) { | |
| 1788 | + if ( $x =~ /([^\{\};]*)([\{\};])(.*)/ ) { | |
| 1789 | 1789 | if( length $prototype ) { |
| 1790 | 1790 | $prototype .= " " |
| 1791 | 1791 | } |