diff options
| author | Joe Slater <joe.slater@windriver.com> | 2019-03-14 12:19:24 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-03-18 23:47:43 +0000 |
| commit | 418021ce9d6444340c612f09926b5e39c2d4307f (patch) | |
| tree | e6218ae14c4c2661cb1991a51cb863690e597874 | |
| parent | 9d6a429f5813e67185abe0140163c253878124e6 (diff) | |
| download | poky-418021ce9d6444340c612f09926b5e39c2d4307f.tar.gz | |
puzzles: fix uninitialized variable compiler error
In tree234.c, change a while() loop to a for() loop so
that the compiler will realize we loop at least once.
(From OE-Core rev: 631cd6f9144fa5dd3a36480905d6edc9b5e81520)
Signed-off-by: Joe Slater <joe.slater@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch | 25 | ||||
| -rw-r--r-- | meta/recipes-sato/puzzles/puzzles_git.bb | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch b/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch new file mode 100644 index 0000000000..7218d620ec --- /dev/null +++ b/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | puzzles: avoid compiler unitialized variable error | ||
| 2 | |||
| 3 | The compiler does not realize that we must go through the while() | ||
| 4 | loop at least once, so we replace it with a for() loop. | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | |||
| 8 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
| 9 | |||
| 10 | --- a/tree234.c | ||
| 11 | +++ b/tree234.c | ||
| 12 | @@ -326,8 +326,11 @@ static void *add234_internal(tree234 *t, | ||
| 13 | return orig_e; | ||
| 14 | } | ||
| 15 | |||
| 16 | - n = t->root; | ||
| 17 | - while (n) { | ||
| 18 | + /* | ||
| 19 | + * We know t->root is not NULL. The logic | ||
| 20 | + * to break out of this is at the end of the loop. | ||
| 21 | + */ | ||
| 22 | + for (n = t->root;;) { | ||
| 23 | LOG((" node %p: %p/%d \"%s\" %p/%d \"%s\" %p/%d \"%s\" %p/%d\n", | ||
| 24 | n, | ||
| 25 | n->kids[0], n->counts[0], n->elems[0], | ||
diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb index 0766bd4ff1..59b952522d 100644 --- a/meta/recipes-sato/puzzles/puzzles_git.bb +++ b/meta/recipes-sato/puzzles/puzzles_git.bb | |||
| @@ -14,6 +14,7 @@ SRC_URI = "git://git.tartarus.org/simon/puzzles.git \ | |||
| 14 | file://0001-palisade-Fix-warnings-with-clang-on-arm.patch \ | 14 | file://0001-palisade-Fix-warnings-with-clang-on-arm.patch \ |
| 15 | file://0001-Use-Wno-error-format-overflow-if-the-compiler-suppor.patch \ | 15 | file://0001-Use-Wno-error-format-overflow-if-the-compiler-suppor.patch \ |
| 16 | file://0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch \ | 16 | file://0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch \ |
| 17 | file://fix-ki-uninitialized.patch \ | ||
| 17 | " | 18 | " |
| 18 | 19 | ||
| 19 | UPSTREAM_CHECK_COMMITS = "1" | 20 | UPSTREAM_CHECK_COMMITS = "1" |
