aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2018-08-05 12:41:09 -0400
committerJonathan Corbet <corbet@lwn.net>2018-08-06 15:36:20 -0400
commit673bb2dfc36488abfdbbfc2ce2631204eaf682f2 (patch)
treee7caada77d3ec0a1ecf34a70f7e605444a6e45a2 /scripts/kernel-doc
parent0bf1bd84f3657dc51acb9d30629c1967a6b91e76 (diff)
scripts/kernel-doc: Escape all literal braces in regexes
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. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc20
1 files changed, 10 insertions, 10 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 31a34ced55a3..8f0f508a78e9 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1062,7 +1062,7 @@ sub dump_struct($$) {
1062 my $x = shift; 1062 my $x = shift;
1063 my $file = shift; 1063 my $file = shift;
1064 1064
1065 if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { 1065 if ($x =~ /(struct|union)\s+(\w+)\s*\{(.*)\}/) {
1066 my $decl_type = $1; 1066 my $decl_type = $1;
1067 $declaration_name = $2; 1067 $declaration_name = $2;
1068 my $members = $3; 1068 my $members = $3;
@@ -1148,20 +1148,20 @@ sub dump_struct($$) {
1148 } 1148 }
1149 } 1149 }
1150 } 1150 }
1151 $members =~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)}([^\{\}\;]*)\;/$newmember/; 1151 $members =~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)\}([^\{\}\;]*)\;/$newmember/;
1152 } 1152 }
1153 1153
1154 # Ignore other nested elements, like enums 1154 # Ignore other nested elements, like enums
1155 $members =~ s/(\{[^\{\}]*})//g; 1155 $members =~ s/(\{[^\{\}]*\})//g;
1156 1156
1157 create_parameterlist($members, ';', $file, $declaration_name); 1157 create_parameterlist($members, ';', $file, $declaration_name);
1158 check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual); 1158 check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual);
1159 1159
1160 # Adjust declaration for better display 1160 # Adjust declaration for better display
1161 $declaration =~ s/([{;])/$1\n/g; 1161 $declaration =~ s/([\{;])/$1\n/g;
1162 $declaration =~ s/}\s+;/};/g; 1162 $declaration =~ s/\}\s+;/};/g;
1163 # Better handle inlined enums 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 my @def_args = split /\n/, $declaration; 1166 my @def_args = split /\n/, $declaration;
1167 my $level = 1; 1167 my $level = 1;
@@ -1171,12 +1171,12 @@ sub dump_struct($$) {
1171 $clause =~ s/\s+$//; 1171 $clause =~ s/\s+$//;
1172 $clause =~ s/\s+/ /; 1172 $clause =~ s/\s+/ /;
1173 next if (!$clause); 1173 next if (!$clause);
1174 $level-- if ($clause =~ m/(})/ && $level > 1); 1174 $level-- if ($clause =~ m/(\})/ && $level > 1);
1175 if (!($clause =~ m/^\s*#/)) { 1175 if (!($clause =~ m/^\s*#/)) {
1176 $declaration .= "\t" x $level; 1176 $declaration .= "\t" x $level;
1177 } 1177 }
1178 $declaration .= "\t" . $clause . "\n"; 1178 $declaration .= "\t" . $clause . "\n";
1179 $level++ if ($clause =~ m/(\{)/ && !($clause =~m/}/)); 1179 $level++ if ($clause =~ m/(\{)/ && !($clause =~m/\}/));
1180 } 1180 }
1181 output_declaration($declaration_name, 1181 output_declaration($declaration_name,
1182 'struct', 1182 'struct',
@@ -1244,7 +1244,7 @@ sub dump_enum($$) {
1244 # strip #define macros inside enums 1244 # strip #define macros inside enums
1245 $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos; 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 $declaration_name = $1; 1248 $declaration_name = $1;
1249 my $members = $2; 1249 my $members = $2;
1250 my %_members; 1250 my %_members;
@@ -1785,7 +1785,7 @@ sub process_proto_type($$) {
1785 } 1785 }
1786 1786
1787 while (1) { 1787 while (1) {
1788 if ( $x =~ /([^{};]*)([{};])(.*)/ ) { 1788 if ( $x =~ /([^\{\};]*)([\{\};])(.*)/ ) {
1789 if( length $prototype ) { 1789 if( length $prototype ) {
1790 $prototype .= " " 1790 $prototype .= " "
1791 } 1791 }