|
2018-05-25
| ||
| 08:45 | • Ticket [eeddb0693a] TIP #491 implementation has odd #ifdef usage status stil... artifact: 0773bce4ce user: jan.nijtmans | |
|
2018-05-23
| ||
| 13:34 | • Ticket [eeddb0693a]: 4 changes artifact: 9f1842e7c4 user: dgp | |
| 13:08 | • Ticket [eeddb0693a]: 4 changes artifact: e9a25b9397 user: dgp | |
| 12:41 | • Ticket [eeddb0693a]: 4 changes artifact: 7dfb4e261c user: dgp | |
| 12:39 | • Ticket [eeddb0693a]: 5 changes artifact: 973373e12a user: dgp | |
|
2018-05-22
| ||
| 20:54 | • Ticket [eeddb0693a]: 5 changes artifact: 0a61011117 user: jan.nijtmans | |
| 20:53 | Simplify usage of TCL_THREAD, along the lines of [eeddb0693a950be980a66de3811630a00c7bab54|eeddb0693... check-in: bf06e36b25 user: jan.nijtmans tags: core-8-branch | |
| 20:01 | • Ticket [eeddb0693a] TIP #491 implementation has odd #ifdef usage status stil... artifact: 774ac6666a user: jan.nijtmans | |
| 11:56 | • Ticket [eeddb0693a]: 5 changes artifact: a15f9208aa user: dgp | |
|
2018-05-21
| ||
| 10:08 | • Ticket [eeddb0693a]: 5 changes artifact: 2fb76d6e6f user: dkf | |
| 08:12 | Demonstrate how Tcl can build without TCL_THREADS defined at all (assuming TCL_THREADS=1 as default)... check-in: faac759bd9 user: jan.nijtmans tags: core-8-branch | |
| 08:11 | • Closed ticket [eeddb0693a]: TIP #491 implementation has odd #ifdef usage plu... artifact: d421fd4eaf user: jan.nijtmans | |
|
2018-05-20
| ||
| 14:58 | • Ticket [eeddb0693a]: 4 changes artifact: 7cfb503acd user: dkf | |
| 14:57 | • New ticket [eeddb0693a]. artifact: d6e9e69645 user: dkf | |
TIP #491 implementation has odd #ifdef usage
Closed / Fixedeeddb0693a950be980a66de3811630a00c7bab54Created 9 years agoUpdated 9 years ago
Descriptionhtml2018-05-20 14:57:52
Given that all our source code will pass this stanza early in tcl.h:
#ifndef TCL_THREADS # define TCL_THREADS 1 #endifWhy do we then write this in so many places?
#if !defined(TCL_THREADS) || TCL_THREADSSurely (given that we know TCL_THREADS is defined, and it is assumed to be numeric), it'd be enough to do this:
#if TCL_THREADSThat'd make the code more readable if nothing else.
Referenced by2
bf06e36b25Simplify usage of TCL_THREAD, along the lines of [eeddb0693a950be980a66de3811630a00c7bab54|eeddb0693a]. Suggested by DKF check-in2018-05-22 20:53:24faac759bd9Demonstrate how Tcl can build without TCL_THREADS defined at all (assuming TCL_THREADS=1 as default). Activated by -DTCL_NO_DEPRECATED=1. See also [eeddb0693a950be980a66de3811630a00c7bab54|eeddb0693a] check-in2018-05-21 08:12:51
dkf Ticket [eeddb0693a]: 4 changes
[History diff]2018-05-20 14:58:19
jan.nijtmansplain2018-05-21 08:11:00
This is on purpose. It makes Tcl build also without TCL_THREADS defined, as is done in Tcl 9. Otherwise all #ifdef's regarding TCL_THREADS would be different in core-8-branch and trunk, which only increases the possibility of future merge conflicts. Actually, I misplaced one #endif in tcl.h (fixed now), which demonstrates how Tcl can build WITHOUT TCL_THREADS defined. So, yes, it makes all #ifdefs somewhat more complicated. But that doesn't really matter because in Tcl 9 we should gradually remove all of them anyway. (I don't want to do it yet, not before Tcl 8.7 is finally released, because there might be protests regarding non-threaded builds. So - for now - I want to keep Tcl building with TCL_THREADS=0)
dkfhtml2018-05-21 10:08:50
I was approving the:
#ifndef TCL_THREADS # define TCL_THREADS 1 #endifIt was the fact that after that, we can just use:
#if TCL_THREADSsince we can know that TCL_THREADS is definitely defined. If it wasn't, the ifndef/define pair would have set it to 1. In other words, everything that includes tcl.h will define TCL_THREADS so
!defined(TCL_THREADS) is a constant (zero), and we assume that it is boolean (which I also approve of).
Basically, #if !defined(TCL_THREADS) || TCL_THREADS can now become just #if TCL_THREADS with no ill-effects that I can think of.
dgpplain2018-05-22 11:56:38
Consider this approach. On core-8-branch, put in place the simpler scheme dkf is suggesting. Then for the sake of clean merges, make trunk the same everywhere except in tcl.h have a single explicit line: #define TCL_THREADS 1 Then on the trunk we still have the known condition that every file that includes tcl.h has TCL_THREADS defined and we need not test for that. But we have also deleted all "easy" ways to call for a thread-disabled build. Over time, all tests for TCL_THREADS should disappear from trunk, and as soon as they are all gone, that line can go too. Any troubles with that?
jan.nijtmansplain2018-05-22 20:01:58
I'm spotting the possibility for a nice compromise: How about #defining TCL_THREADS in tclInt.h too? This makes the simplifications possible as dkf noted, but it doesn't affect the public API. I can very well live with that. Hang on .....
jan.nijtmansplain2018-05-22 20:54:36
So have a look at core-8-branch now ...
dgpplain2018-05-23 12:39:59
The idea sounds promising. At the moment though
the core-8-branch doesn't build.
... /home/dgp/fossil/tcl8.7/unix/tclSelectNotfy.c
In file included from /home/dgp/fossil/tcl8.7/unix/tclSelectNotfy.c:262:0:
/home/dgp/fossil/tcl8.7/unix/tclUnixNotfy.c: In function ‘Tcl_AlertNotifier’:
/home/dgp/fossil/tcl8.7/unix/tclUnixNotfy.c:126:18: error: ‘ThreadSpecificData’ has no member named ‘triggerEventFd’
if (write(tsdPtr->triggerEventFd, &eventFdVal,
^
/home/dgp/fossil/tcl8.7/unix/tclSelectNotfy.c: In function ‘Tcl_WaitForEvent’:
/home/dgp/fossil/tcl8.7/unix/tclSelectNotfy.c:703:2: warning: implicit declaration of function ‘StartNotifierThread’ [-Wimplicit-function-declaration]
StartNotifierThread("Tcl_WaitForEvent");
^
/home/dgp/fossil/tcl8.7/unix/tclSelectNotfy.c: In function ‘NotifierThreadProc’:
/home/dgp/fossil/tcl8.7/unix/tclSelectNotfy.c:1061:3: warning: implicit declaration of function ‘AlertSingleThread’ [-Wimplicit-function-declaration]
AlertSingleThread(tsdPtr);
^
/home/dgp/fossil/tcl8.7/unix/tclSelectNotfy.c: At top level:
/home/dgp/fossil/tcl8.7/unix/tclSelectNotfy.c:200:13: warning: ‘AtForkChild’ used but never defined [enabled by default]
static void AtForkChild(void);
dgpplain2018-05-23 12:41:41
Looks like a two part mystery. 1) Why build the select notifier? I'm expecting the epoll. 2) Once we decide to bulid the select notifier, why doesn't it?
dgpplain2018-05-23 13:08:18
It's only the last checkin [bf06e36b25] that broke things, so maybe we can look at it and figure out what went wrong.
dgpplain2018-05-23 13:34:52
Shifting the placement of the internal header includes seems to take care of it.
jan.nijtmansplain2018-05-25 08:45:34
Thanks, Don for your fixes! Still not all CFLAG handlings were correct, but everything should be corrected now. I hope the current implementation satisfies everyone.
Log in (anonymous is fine) to add a comment.