wierd make issue with C++
Steve Hutton <[email protected]>
| Newsgroups | gmane.comp.kde.cafe |
|---|---|
| Message-ID | <[email protected]> |
Ok, I haven't had luck getting anyone to answer this on comp.os.linux.development.apps, [email protected], or [email protected], so I thought perhaps some kind soul here might take a moment to at least try to reproduce this problem (of course an explanation/fix/workaround would be even better ;-) In article <[email protected]>, Steve Hutton wrote: > Make check succeeds (as expected) when my test program > returns 0, but it fails (not what I expected) when the same > test program has thrown and caught a C++ exception. I have now distilled this down to a very simple test case, reproducible outside of automake with a small makefile based the make check target that automake generates. I would very much appreciate it if someone could take a minute to try this and let me know if I am crazy or not ;-) $ more Makefile TESTS=return1 return99 return0 return0throw all: $(TESTS) list='$(TESTS)'; \ if test -n "$$list"; then \ for tst in $$list; do \ if ./$$tst; then \ echo "PASS: $$tst $$?"; \ else \ echo "FAIL: $$tst $$?"; \ fi; \ done; \ fi; Simple test programs: $ more return1.cpp int main() { return 1; } $ more return0.cpp int main() { return 0; } $ more return99.cpp int main() { return 99; } $ more return0throw.cpp void throwSomething() { throw("hello"); } int main() { try { throwSomething(); } catch(...) { } return 0; } Now run make to see that it believes the last program is returning 134(!) instead of 0: $ make list='return1 return99 return0 return0throw'; \ if test -n "$list"; then \ for tst in $list; do \ if ./$tst; then \ echo "PASS: $tst $?"; \ else \ echo "FAIL: $tst $?"; \ fi; \ done; \ fi; FAIL: return1 1 FAIL: return99 99 PASS: return0 0 FAIL: return0throw 134 A similar bash script returns the results I expect: $ test.sh #!/bin/sh TST=return1 echo $TST ./$TST echo $? TST=return0 echo $TST ./$TST echo $? TST=return99 echo $TST ./$TST echo $? TST=return0throw echo $TST ./$TST echo $? $ ./test.sh return1 1 return0 0 return99 99 return0throw 0 Thanks, Steve Kde-cafe mailing list - [email protected] http://ofb.biz/lists/listinfo.cgi/kde-cafe DISCLAIMER: The views expressed on this mailinglist are the personal opinions of the author and do not represent OfB.biz: Open for Business, KDE or the author's employer.