Skip to content

Commit d060d96

Browse files
Steven Rostedtrostedt
authored andcommitted
kconfig/streamline-config.pl: Simplify backslash line concatination
Simplify the way lines ending with backslashes (continuation) in Makefiles is parsed. This is needed to implement a necessary fix. Tested-by: Thomas Lange <thomas-lange2@gmx.de> Cc: stable@vger.kernel.org Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 805a6af commit d060d96

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

‎scripts/kconfig/streamline_config.pl‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -253,30 +253,29 @@ sub read_kconfig {
253253
# Read all Makefiles to map the configs to the objects
254254
foreach my $makefile (@makefiles) {
255255

256-
my $cont = 0;
256+
my $line = "";
257257

258258
open(MIN,$makefile) || die "Can't open $makefile";
259259
while (<MIN>) {
260-
my $objs;
261-
262-
# is this a line after a line with a backslash?
263-
if ($cont && /(\S.*)$/) {
264-
$objs = $1;
260+
# if this line ends with a backslash, continue
261+
chomp;
262+
if (/^(.*)\\$/) {
263+
$line .= $1;
264+
next;
265265
}
266-
$cont = 0;
266+
267+
$line .= $_;
268+
$_ = $line;
269+
$line = "";
270+
271+
my $objs;
267272

268273
# collect objects after obj-$(CONFIG_FOO_BAR)
269274
if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
270275
$var = $1;
271276
$objs = $2;
272277
}
273278
if (defined($objs)) {
274-
# test if the line ends with a backslash
275-
if ($objs =~ m,(.*)\\$,) {
276-
$objs = $1;
277-
$cont = 1;
278-
}
279-
280279
foreach my $obj (split /\s+/,$objs) {
281280
$obj =~ s/-/_/g;
282281
if ($obj =~ /(.*)\.o$/) {

0 commit comments

Comments
 (0)