Description: |
(text/x-fossil-wiki)
Current versions of two Aqua modules, <b>macosx/tkMacOSXClipboard.c</b> and <b>macosx/tkMacOSXDraw.c</b>, get compile warnings when compiled with <b>gcc</b> and compile errors when attempting to compile with Apple <b>clang</b>. Both errors are due to misplaced <b>return Success</b> statements. From comparing the 8.5.14 and 8.5.15rc1 sources with the 8.6.0 and 8.6.1.rc0 sources, my guess is that the problems are due to an incorrect merge at some point of the Aqua code from 8.6 into 8.5, since the 8.6 code is correct.
Here are the results of compiling 8.5.15rc1 on OS X 10.8.5 with the current Xcode 4.6.3 command line tools installed. (8.5.14 results are similar.)
<verbatim>
$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
$ cd tk8.5.15/unix && ./configure --prefix=/tmp/a/root --enable-shared --enable-threads --enable-aqua && make
[...]
/tmp/a/tk8.5.15/unix/../macosx/tkMacOSXClipboard.c: In function ‘XSetSelectionOwner’:
/tmp/a/tk8.5.15/unix/../macosx/tkMacOSXClipboard.c:171: warning: no return statement in function returning non-void
/tmp/a/tk8.5.15/unix/../macosx/tkMacOSXClipboard.c: In function ‘TkMacOSXSelDeadWindow’:
/tmp/a/tk8.5.15/unix/../macosx/tkMacOSXClipboard.c:197: warning: ‘return’ with a value, in function returning void
[...]
/tmp/a/tk8.5.15/unix/../macosx/tkMacOSXDraw.c: In function ‘DrawCGImage’:
/tmp/a/tk8.5.15/unix/../macosx/tkMacOSXDraw.c:747: warning: ‘return’ with a value, in function returning void
/tmp/a/tk8.5.15/unix/../macosx/tkMacOSXDraw.c: In function ‘TkPutImage’:
/tmp/a/tk8.5.15/unix/../macosx/tkMacOSXDraw.c:350: warning: control reaches end of non-void function
/tmp/a/tk8.5.15/unix/../macosx/tkMacOSXClipboard.c:171:1: warning: control reaches end of
non-void function [-Wreturn-type]
$ cc --version
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
$ cd tk8.5.15/unix && ./configure --prefix=/tmp/a/root --enable-shared --enable-threads --enable-aqua CC=cc && make
[...]
/tmp/a/tk8.5.15/unix/../macosx/tkMacOSXClipboard.c:171:1: warning: control reaches end of
non-void function [-Wreturn-type]
}
^
/tmp/a/tk8.5.15/unix/../macosx/tkMacOSXClipboard.c:197:5: error: void function
'TkMacOSXSelDeadWindow' should not return a value [-Wreturn-type]
return Success;
^ ~~~~~~~
1 warning and 1 error generated.
[...]
tmp/a/tk8.5.15/unix/../macosx/tkMacOSXDraw.c:350:1: warning: control may reach end of
non-void function [-Wreturn-type]
}
^
/tmp/a/tk8.5.15/unix/../macosx/tkMacOSXDraw.c:747:5: error: void function 'DrawCGImage'
should not return a value [-Wreturn-type]
return Success;
^ ~~~~~~~
1 warning and 1 error generated.
</verbatim>
Note that, with the next release of Apple's Xcode development tools, expected with the upcoming OS X 10.9 (Mavericks) release, Apple will no longer ship any gcc-based compilers, just clang, so it is important that Tk builds correctly with clang.
The attached patch fixes the problems.
|