warnings when building on macOS
Closed / Fixeddc1db1588e4c6c36f12fb447ec77036cefdbaf18Created 5 years agoUpdated 5 years ago
Descriptionhtml2021-07-03 11:40:53
In the current core-8-branch there are lots of warnings when building the notifier. The following is from tclKqueueNotfy.c, but equivalent ones are also produced by tclEpollNotfy.c.
In file included from /Users/dkf/tcl/unix/tclKqueueNotfy.c:1:
/Users/dkf/tcl/generic/tclInt.h:5208:52: warning: uninitialized 'const TclUnusedFile_unix_tclKqueueNotfy_c' is invalid in C++ [-Wc++-compat]
5208 | static __attribute__((used)) const void *const TclUnusedFile_ ## name; \
| ^~~~~~~~~~~~~~
/Users/dkf/tcl/unix/tclKqueueNotfy.c:766:1: note: in expansion of macro 'TCL_MAC_EMPTY_FILE'
766 | TCL_MAC_EMPTY_FILE(unix_tclKqueueNotfy_c)
| ^~~~~~~~~~~~~~~~~~
/Users/dkf/tcl/generic/tclInt.h:5209:30: warning: duplicate declaration of 'TclUnusedFile_unix_tclKqueueNotfy_c' is invalid in C++ [-Wc++-compat]
5209 | static const void *const TclUnusedFile_ ## name = NULL;
| ^~~~~~~~~~~~~~
/Users/dkf/tcl/unix/tclKqueueNotfy.c:766:1: note: in expansion of macro 'TCL_MAC_EMPTY_FILE'
766 | TCL_MAC_EMPTY_FILE(unix_tclKqueueNotfy_c)
| ^~~~~~~~~~~~~~~~~~
/Users/dkf/tcl/generic/tclInt.h:5208:52: note: previous declaration of 'TclUnusedFile_unix_tclKqueueNotfy_c' was here
5208 | static __attribute__((used)) const void *const TclUnusedFile_ ## name; \
| ^~~~~~~~~~~~~~
/Users/dkf/tcl/unix/tclKqueueNotfy.c:766:1: note: in expansion of macro 'TCL_MAC_EMPTY_FILE'
766 | TCL_MAC_EMPTY_FILE(unix_tclKqueueNotfy_c)
| ^~~~~~~~~~~~~~~~~~
The problem is that deleting the symbol makes the macOS linker complain about an empty file. My preferred fix is simple: don't use the -Wc++-compat flag as these files simply do not ever need to build as C++. Alternatively, we could find some other way of making a symbol that exists so that file is non-empty but gets elided during linking, but frankly I'd just drop TIP 557 support in these implementation files as it has proved to not be a win (but supporting it for our headers is fine). It's equivalent (in my mind) to how some of Tk's implementation on some platforms is in Objective C, but Tk's API is not.
jan.nijtmanswiki2021-09-22 08:27:18
Fixed [here]
jan.nijtmans Ticket [dc1db1588e]: 4 changes
[History diff]2021-09-22 08:27:36
Log in (anonymous is fine) to add a comment.