Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ce054a06146c3e603fc0916efaa979a8a393c56cc32b8ee860f5d8e492821bdd
Ticket: dc1db1588e4c6c36f12fb447ec77036cefdbaf18
warnings when building on macOS
User & Date: dkf on 2021-07-03 11:40:53
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/html"
  4. comment changed to:
    In the current <code>core-8-branch</code> there are lots of warnings when building the notifier. The following is from <code>tclKqueueNotfy.c</code>, but equivalent ones are also produced by <code>tclEpollNotfy.c</code>. 
    
    <pre style="overflow-x:scroll;">
    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)
          | ^~~~~~~~~~~~~~~~~~
    </pre>
    
    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 <code>-Wc++-compat</code> 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 <em>headers</em> 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.
    
  5. is_private changed to: "0"
  6. login: "dkf"
  7. priority changed to: "5 Medium"
  8. resolution changed to: "None"
  9. severity changed to: "Minor"
  10. status changed to: "Open"
  11. submitter changed to: "dkf"
  12. subsystem changed to: "01. Notifier"
  13. title changed to: "warnings when building on macOS"
  14. type changed to: "Bug"