Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
We also don't want to skip empty string because if a user specifies
an empty string, it is their intention whatever that intention is.
  • Loading branch information
rui314 committed Aug 18, 2024
1 parent 0c74e82 commit 401e019
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/cmdline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,13 @@ static std::vector<std::string_view>
split_by_comma_or_colon(std::string_view str) {
std::vector<std::string_view> vec;

while (!str.empty()) {
for (;;) {
i64 pos = str.find_first_of(",:");
if (pos == str.npos) {
vec.push_back(str);
break;
}
if (pos > 0) {
vec.push_back(str.substr(0, pos));
}
vec.push_back(str.substr(0, pos));
str = str.substr(pos + 1);
}
return vec;
Expand Down
6 changes: 6 additions & 0 deletions test/exclude-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ readelf --dyn-syms $t/f.so > $t/log
! grep -Fq bar $t/log || false
grep -Fq baz $t/log

$CC -B. -shared -o $t/f.so $t/e.o $t/c.a $t/d.a -Wl,-exclude-libs=c.a:d.a
readelf --dyn-syms $t/f.so > $t/log
! grep -Fq foo $t/log || false
! grep -Fq bar $t/log || false
grep -Fq baz $t/log

$CC -B. -shared -o $t/f.so $t/e.o $t/c.a $t/d.a -Wl,-exclude-libs=ALL
readelf --dyn-syms $t/f.so > $t/log
! grep -Fq foo $t/log || false
Expand Down

0 comments on commit 401e019

Please sign in to comment.