diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-10-24 14:33:43 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-10-24 14:36:34 +0200 |
commit | f893618745f8ca12533a6bcedbc224e4b9ee3479 (patch) | |
tree | d9dde05cacff678f4e0c1eaf5bd6fb83990806a2 | |
parent | e89c99a8ce264173a9d9cbb6df09d7811d6b34cc (diff) |
concat-deps: fix breakage introduced by eliding:
The call to elide_dependency in _process was broken because it checked
the full line, which ends with " : " usually, breaking the build with LO
customised GNU make on cygwin.
(regression from 140281898f21f707582f395918e5234bdb67e435)
Also handle empty lines following '\' better while at it.
Change-Id: Iadc6349e5b6930945e46e244bcbee37a632e0d71
-rw-r--r-- | solenv/bin/concat-deps.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/solenv/bin/concat-deps.c b/solenv/bin/concat-deps.c index ccc117fd2838..d2d9d50b1a67 100644 --- a/solenv/bin/concat-deps.c +++ b/solenv/bin/concat-deps.c @@ -811,6 +811,17 @@ static inline void print_fullpaths(char* line) } } +static inline char * eat_space_at_end(char * end) +{ + assert('\0' == *end); + char * real_end = end - 1; + while (' ' == *real_end || '\t' == *real_end || '\n' == *real_end + || ':' == *real_end) + { /* eat colon and whitespace at end */ + --real_end; + } + return real_end; +} static int _process(struct hash* dep_hash, char* fn) { @@ -866,8 +877,8 @@ off_t size; * these are the one for which we want to filter * duplicate out */ - int key_len = cursor_out - base; - if(!elide_dependency(base,key_len - 1, NULL) && + int key_len = eat_space_at_end(cursor_out) - base; + if(!elide_dependency(base,key_len + 1, NULL) && hash_store(dep_hash, base, key_len)) { /* DO NOT modify base after it has been added @@ -882,6 +893,7 @@ off_t size; print_fullpaths(base); putc('\n', stdout); } + last_ns = ' '; // cannot hurt to reset it } cursor += 1; base = cursor_out = cursor; @@ -892,6 +904,7 @@ off_t size; * i.e not a complete rule yet */ *cursor_out++ = *cursor++; + continuation = 0; // cancel current one (empty lines!) } } else @@ -910,7 +923,9 @@ off_t size; { if(last_ns == ':') { - if(hash_store(dep_hash, base, (int)(cursor_out - base))) + int key_len = eat_space_at_end(cursor_out) - base; + if (!elide_dependency(base,key_len + 1, NULL) && + hash_store(dep_hash, base, key_len)) { puts(base); putc('\n', stdout); |