Compiling xz-5.0.3, Solaris CC 5.12 tells us:
libtool: compile: cc -m64 -DHAVE_CONFIG_H -I. -I../.. -I../../src/liblzma/api -I../../src/liblzma/common -I../../src/liblzma/check -I../../src/liblzma/lz -I../../src/liblzma/rangecoder -I../../src/liblzma/lzma -I../../src/liblzma/delta -I../../src/liblzma/simple -I../../src/common -DTUKLIB_SYMBOL_PREFIX=lzma_ -D_REENTRANT -m64 -O -c lzma/lzma_decoder.c -KPIC -DPIC -o liblzma_la-lzma_decoder.o
"lzma/lzma_decoder.c", line 344: warning: statement not reached
Could this while loop be converted into something more portable? Would it help if I suggest a patch?
It sounds like a bogus warning. If "make check" passes, it definitely is a bogus warning. I'm not aware of any portability issues in that file. A bogus warning is not a portability issue.
The code looks ugly though. It was tested with GCC 3.4 and unrolling some loops manually made it faster. Nowadays with a recent GCC the difference is smaller. Last time I checked it with recent GCC, liblzma was still faster than the nice-looking code in XZ Embedded. Unfortunately I haven't tested performance with other compilers.
liblzma has to do more than XZ Embedded, because liblzma supports also LZMA1 in addition to LZMA2. Supporting LZMA1 is more complicated than LZMA2 with buffer-to-buffer multi-call API. The switch-while construct is one way to do it. LZMA SDK has a different approach. It probably is a matter of opinion which one looks less ugly (the loop unrolling is the ugliest thing in lzma_decoder.c in liblzma).
So while the code could be cleaned up, the current code works and also has good performance. There are many other things in liblzma that should be cleaned up too, and I think lzma_decoder.c isn't the most important one of those.
Thanks for your reply. I understand your reasoning; we will ignore the warning. make check says "All 7 tests passed" which presumably means xv 5.0.3 also works on Solaris 11.11 with CC 5.12, despite the warning.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.