Tcl package Thread source code

Check-in [23a8390cd1]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge thread-2-8-branch
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 23a8390cd1d8ce89727b7814e25c207553d6445ca6baf68cf45b37c968f2992f
User & Date: jan.nijtmans 2018-02-26 22:17:00
Context
2018-03-21
22:52
Merge thread-2-8-branch check-in: 381dbfb4a4 user: jan.nijtmans tags: trunk
2018-03-19
17:24
Pulling changes from trunk check-in: 03912025a6 user: seandeelywoods tags: practcl
2018-02-26
22:59
Merge trunk check-in: 7b198e45f6 user: jan.nijtmans tags: novem
22:38
Merge trunk Leaf check-in: b4950f8596 user: jan.nijtmans tags: novem-support
22:17
Merge thread-2-8-branch check-in: 23a8390cd1 user: jan.nijtmans tags: trunk
21:56
Make Thread run on Tcl 8.7 with -DTCL_NO_DEPRECATED, even if compiled against Tcl 8.6 headers. Clean up some #ifdef-ery, adding more comments. check-in: 1049b1d136 user: jan.nijtmans tags: thread-2-8-branch
14:42
Renumber to 2.9a1. Make it loadable on both Tcl 8.x and 9.0 on 32-bit platforms, provided Thread is compiled with -DTCL_NO_DEPRECATED=1 (experimental) check-in: 65f646f33a user: jan.nijtmans tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to configure.

  1667   1667     # left behind by Apple's compiler.  We do this before executing the actions.
  1668   1668     rm -rf conftest.dSYM conftest_ipa8_conftest.oo
  1669   1669     eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  1670   1670     as_fn_set_status $ac_retval
  1671   1671   
  1672   1672   } # ac_fn_c_try_link
  1673   1673   
  1674         -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
  1675         -# -------------------------------------------------------
  1676         -# Tests whether HEADER exists, giving a warning if it cannot be compiled using
  1677         -# the include files in INCLUDES and setting the cache variable VAR
  1678         -# accordingly.
  1679         -ac_fn_c_check_header_mongrel ()
  1680         -{
  1681         -  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  1682         -  if eval \${$3+:} false; then :
  1683         -  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
  1684         -$as_echo_n "checking for $2... " >&6; }
  1685         -if eval \${$3+:} false; then :
  1686         -  $as_echo_n "(cached) " >&6
  1687         -fi
  1688         -eval ac_res=\$$3
  1689         -	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
  1690         -$as_echo "$ac_res" >&6; }
  1691         -else
  1692         -  # Is the header compilable?
  1693         -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
  1694         -$as_echo_n "checking $2 usability... " >&6; }
  1695         -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  1696         -/* end confdefs.h.  */
  1697         -$4
  1698         -#include <$2>
  1699         -_ACEOF
  1700         -if ac_fn_c_try_compile "$LINENO"; then :
  1701         -  ac_header_compiler=yes
  1702         -else
  1703         -  ac_header_compiler=no
  1704         -fi
  1705         -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  1706         -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
  1707         -$as_echo "$ac_header_compiler" >&6; }
  1708         -
  1709         -# Is the header present?
  1710         -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
  1711         -$as_echo_n "checking $2 presence... " >&6; }
  1712         -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  1713         -/* end confdefs.h.  */
  1714         -#include <$2>
  1715         -_ACEOF
  1716         -if ac_fn_c_try_cpp "$LINENO"; then :
  1717         -  ac_header_preproc=yes
  1718         -else
  1719         -  ac_header_preproc=no
  1720         -fi
  1721         -rm -f conftest.err conftest.i conftest.$ac_ext
  1722         -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
  1723         -$as_echo "$ac_header_preproc" >&6; }
  1724         -
  1725         -# So?  What about this header?
  1726         -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
  1727         -  yes:no: )
  1728         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
  1729         -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
  1730         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
  1731         -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
  1732         -    ;;
  1733         -  no:yes:* )
  1734         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
  1735         -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
  1736         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
  1737         -$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
  1738         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
  1739         -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
  1740         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
  1741         -$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
  1742         -    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
  1743         -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
  1744         -    ;;
  1745         -esac
  1746         -  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
  1747         -$as_echo_n "checking for $2... " >&6; }
  1748         -if eval \${$3+:} false; then :
  1749         -  $as_echo_n "(cached) " >&6
  1750         -else
  1751         -  eval "$3=\$ac_header_compiler"
  1752         -fi
  1753         -eval ac_res=\$$3
  1754         -	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
  1755         -$as_echo "$ac_res" >&6; }
  1756         -fi
  1757         -  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  1758         -
  1759         -} # ac_fn_c_check_header_mongrel
  1760         -
  1761   1674   # ac_fn_c_check_func LINENO FUNC VAR
  1762   1675   # ----------------------------------
  1763   1676   # Tests whether FUNC exists, setting the cache variable VAR accordingly
  1764   1677   ac_fn_c_check_func ()
  1765   1678   {
  1766   1679     as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  1767   1680     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
................................................................................
  4881   4794   
  4882   4795        ;; #(
  4883   4796      *)
  4884   4797        as_fn_error $? "unknown endianness
  4885   4798    presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
  4886   4799    esac
  4887   4800   
  4888         -    if test "${TEA_PLATFORM}" = "unix" ; then
  4889         -	TEA_TCL_LINK_LIBS
  4890         -
  4891         -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dirent.h" >&5
  4892         -$as_echo_n "checking dirent.h... " >&6; }
  4893         -if ${tcl_cv_dirent_h+:} false; then :
  4894         -  $as_echo_n "(cached) " >&6
  4895         -else
  4896         -
  4897         -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  4898         -/* end confdefs.h.  */
  4899         -#include <sys/types.h>
  4900         -#include <dirent.h>
  4901         -int
  4902         -main ()
  4903         -{
  4904         -
  4905         -#ifndef _POSIX_SOURCE
  4906         -#   ifdef __Lynx__
  4907         -	/*
  4908         -	 * Generate compilation error to make the test fail:  Lynx headers
  4909         -	 * are only valid if really in the POSIX environment.
  4910         -	 */
  4911         -
  4912         -	missing_procedure();
  4913         -#   endif
  4914         -#endif
  4915         -DIR *d;
  4916         -struct dirent *entryPtr;
  4917         -char *p;
  4918         -d = opendir("foobar");
  4919         -entryPtr = readdir(d);
  4920         -p = entryPtr->d_name;
  4921         -closedir(d);
  4922         -
  4923         -  ;
  4924         -  return 0;
  4925         -}
  4926         -_ACEOF
  4927         -if ac_fn_c_try_link "$LINENO"; then :
  4928         -  tcl_cv_dirent_h=yes
  4929         -else
  4930         -  tcl_cv_dirent_h=no
  4931         -fi
  4932         -rm -f core conftest.err conftest.$ac_objext \
  4933         -    conftest$ac_exeext conftest.$ac_ext
  4934         -fi
  4935         -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_dirent_h" >&5
  4936         -$as_echo "$tcl_cv_dirent_h" >&6; }
  4937         -
  4938         -    if test $tcl_cv_dirent_h = no; then
  4939         -
  4940         -$as_echo "#define NO_DIRENT_H 1" >>confdefs.h
  4941         -
  4942         -    fi
  4943         -
  4944         -    # TEA specific:
  4945         -    ac_fn_c_check_header_mongrel "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default"
  4946         -if test "x$ac_cv_header_errno_h" = xyes; then :
  4947         -
  4948         -else
  4949         -
  4950         -$as_echo "#define NO_ERRNO_H 1" >>confdefs.h
  4951         -
  4952         -fi
  4953         -
  4954         -
  4955         -    ac_fn_c_check_header_mongrel "$LINENO" "values.h" "ac_cv_header_values_h" "$ac_includes_default"
  4956         -if test "x$ac_cv_header_values_h" = xyes; then :
  4957         -
  4958         -else
  4959         -
  4960         -$as_echo "#define NO_VALUES_H 1" >>confdefs.h
  4961         -
  4962         -fi
  4963         -
  4964         -
  4965         -    ac_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default"
  4966         -if test "x$ac_cv_header_limits_h" = xyes; then :
  4967         -
  4968         -$as_echo "#define HAVE_LIMITS_H 1" >>confdefs.h
  4969         -
  4970         -else
  4971         -
  4972         -$as_echo "#define NO_LIMITS_H 1" >>confdefs.h
  4973         -
  4974         -fi
  4975         -
  4976         -
  4977         -    ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
  4978         -if test "x$ac_cv_header_stdlib_h" = xyes; then :
  4979         -  tcl_ok=1
  4980         -else
  4981         -  tcl_ok=0
  4982         -fi
  4983         -
  4984         -
  4985         -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  4986         -/* end confdefs.h.  */
  4987         -#include <stdlib.h>
  4988         -
  4989         -_ACEOF
  4990         -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  4991         -  $EGREP "strtol" >/dev/null 2>&1; then :
  4992         -
  4993         -else
  4994         -  tcl_ok=0
  4995         -fi
  4996         -rm -f conftest*
  4997         -
  4998         -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  4999         -/* end confdefs.h.  */
  5000         -#include <stdlib.h>
  5001         -
  5002         -_ACEOF
  5003         -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  5004         -  $EGREP "strtoul" >/dev/null 2>&1; then :
  5005         -
  5006         -else
  5007         -  tcl_ok=0
  5008         -fi
  5009         -rm -f conftest*
  5010         -
  5011         -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  5012         -/* end confdefs.h.  */
  5013         -#include <stdlib.h>
  5014         -
  5015         -_ACEOF
  5016         -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  5017         -  $EGREP "strtod" >/dev/null 2>&1; then :
  5018         -
  5019         -else
  5020         -  tcl_ok=0
  5021         -fi
  5022         -rm -f conftest*
  5023         -
  5024         -    if test $tcl_ok = 0; then
  5025         -
  5026         -$as_echo "#define NO_STDLIB_H 1" >>confdefs.h
  5027         -
  5028         -    fi
  5029         -    ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default"
  5030         -if test "x$ac_cv_header_string_h" = xyes; then :
  5031         -  tcl_ok=1
  5032         -else
  5033         -  tcl_ok=0
  5034         -fi
  5035         -
  5036         -
  5037         -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  5038         -/* end confdefs.h.  */
  5039         -#include <string.h>
  5040         -
  5041         -_ACEOF
  5042         -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  5043         -  $EGREP "strstr" >/dev/null 2>&1; then :
  5044         -
  5045         -else
  5046         -  tcl_ok=0
  5047         -fi
  5048         -rm -f conftest*
  5049         -
  5050         -    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  5051         -/* end confdefs.h.  */
  5052         -#include <string.h>
  5053         -
  5054         -_ACEOF
  5055         -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  5056         -  $EGREP "strerror" >/dev/null 2>&1; then :
  5057         -
  5058         -else
  5059         -  tcl_ok=0
  5060         -fi
  5061         -rm -f conftest*
  5062         -
  5063         -
  5064         -    # See also memmove check below for a place where NO_STRING_H can be
  5065         -    # set and why.
  5066         -
  5067         -    if test $tcl_ok = 0; then
  5068         -
  5069         -$as_echo "#define NO_STRING_H 1" >>confdefs.h
  5070         -
  5071         -    fi
  5072         -
  5073         -    ac_fn_c_check_header_mongrel "$LINENO" "sys/wait.h" "ac_cv_header_sys_wait_h" "$ac_includes_default"
  5074         -if test "x$ac_cv_header_sys_wait_h" = xyes; then :
  5075         -
  5076         -else
  5077         -
  5078         -$as_echo "#define NO_SYS_WAIT_H 1" >>confdefs.h
  5079         -
  5080         -fi
  5081         -
  5082         -
  5083         -    ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default"
  5084         -if test "x$ac_cv_header_dlfcn_h" = xyes; then :
  5085         -
  5086         -else
  5087         -
  5088         -$as_echo "#define NO_DLFCN_H 1" >>confdefs.h
  5089         -
  5090         -fi
  5091         -
  5092         -
  5093         -
  5094         -    # OS/390 lacks sys/param.h (and doesn't need it, by chance).
  5095         -    for ac_header in sys/param.h
  5096         -do :
  5097         -  ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default"
  5098         -if test "x$ac_cv_header_sys_param_h" = xyes; then :
  5099         -  cat >>confdefs.h <<_ACEOF
  5100         -#define HAVE_SYS_PARAM_H 1
  5101         -_ACEOF
  5102         -
  5103         -fi
  5104         -
  5105         -done
  5106         -
  5107         -
  5108         -	# Let the user call this, because if it triggers, they will
  5109         -	# need a compat/strtod.c that is correct.  Users can also
  5110         -	# use Tcl_GetDouble(FromObj) instead.
  5111         -	#TEA_BUGGY_STRTOD
  5112         -    fi
  5113   4801   
  5114   4802   
  5115   4803   #--------------------------------------------------------------------
  5116   4804   # Check if building with optional Gdbm package. This will declare
  5117   4805   # GDBM_CFLAGS and GDBM_LIBS variables.
  5118   4806   #--------------------------------------------------------------------
  5119   4807   

Changes to generic/tclThreadInt.h.

   133    133   
   134    134   typedef struct {
   135    135       void *unused1;
   136    136       void *unused2;
   137    137       int errorLine;
   138    138   } tclInterpType;
   139    139   
   140         -#if defined(TCL_TIP285)
          140  +#if defined(TCL_TIP285) && defined(USE_TCL_STUBS)
   141    141   # undef Tcl_GetErrorLine
   142         -# if defined(USE_TCL_STUBS)
   143         -#   define Tcl_GetErrorLine(interp) ((threadTclVersion>85)? \
          142  +# define Tcl_GetErrorLine(interp) ((threadTclVersion>85)? \
   144    143       ((int (*)(Tcl_Interp *))((&(tclStubsPtr->tcl_PkgProvideEx))[605]))(interp): \
   145    144       (((tclInterpType *)(interp))->errorLine))
   146         -#   undef Tcl_AddErrorInfo
   147         -#   define Tcl_AddErrorInfo(interp, msg) ((threadTclVersion>85)? \
          145  +/* TIP #270 */
          146  +# undef Tcl_AddErrorInfo
          147  +# define Tcl_AddErrorInfo(interp, msg) ((threadTclVersion>85)? \
   148    148       ((void (*)(Tcl_Interp *, Tcl_Obj *))((&(tclStubsPtr->tcl_PkgProvideEx))[574]))(interp, Tcl_NewStringObj(msg, -1)): \
   149    149       ((void (*)(Tcl_Interp *, const char *))((&(tclStubsPtr->tcl_PkgProvideEx))[66]))(interp, msg))
   150         -#   undef Tcl_BackgroundError
   151         -#   define Tcl_BackgroundError(interp) ((threadTclVersion>85)? \
          150  +/* TIP #337 */
          151  +# undef Tcl_BackgroundError
          152  +# define Tcl_BackgroundError(interp) ((threadTclVersion>85)? \
   152    153       ((void (*)(Tcl_Interp *, int))((&(tclStubsPtr->tcl_PkgProvideEx))[609]))(interp, TCL_ERROR): \
   153    154       ((void (*)(Tcl_Interp *))((&(tclStubsPtr->tcl_PkgProvideEx))[76]))(interp))
   154         -# else
   155         -#   define Tcl_GetErrorLine(interp) (((tclInterpType *)(interp))->errorLine)
   156         -# endif
          155  +#elif !TCL_MINIMUM_VERSION(8,6)
          156  +  /* 8.5, 8.4, or less - Emulate access to the error-line information */
          157  +# define Tcl_GetErrorLine(interp) (((tclInterpType *)(interp))->errorLine)
   157    158   #endif
   158    159   
   159         -
   160         -/* 8.5, 8.4, or less - Emulate access to the error-line information
   161         - * This is TIP 336, unrelated to 285 (async cancellation).  When doing
   162         - * a static link of the thread package (use case: basekits, tclkits,
   163         - * ...)  and the core Tcl is < 8.6 we cannot use TCL_TIP285 to get
   164         - * things done, because USE_TCL_STUBS is not set for static builds,
   165         - * causing the check in threadCmd.c to bomb.
          160  +/* When running on Tcl >= 8.7, make sure that Thread still runs when Tcl is compiled
          161  + * with -DTCL_NO_DEPRECATED=1. Stub entries for Tcl_SetIntObj/Tcl_NewIntObj are NULL then.
          162  + * Just use Tcl_SetWideIntObj/Tcl_NewWideIntObj in stead. We don't simply want to use
          163  + * Tcl_SetWideIntObj/Tcl_NewWideIntObj always, since extensions might not expect to
          164  + * get an actual "wideInt".
   166    165    */
   167         -
   168         -#ifndef TCL_TIP285
   169         -# if !TCL_MINIMUM_VERSION(8,6)
   170         -#   define Tcl_GetErrorLine(interp) (((tclInterpType *)(interp))->errorLine)
   171         -# endif
          166  +#if defined(USE_TCL_STUBS)
          167  +# undef Tcl_SetIntObj
          168  +# define Tcl_SetIntObj(objPtr, value) ((threadTclVersion>86)? \
          169  +  ((void (*)(Tcl_Obj *, Tcl_WideInt))((&(tclStubsPtr->tcl_PkgProvideEx))[489]))(objPtr, (int)(value)): \
          170  +  ((void (*)(Tcl_Obj *, int))((&(tclStubsPtr->tcl_PkgProvideEx))[61]))(objPtr, value))
          171  +# undef Tcl_NewIntObj
          172  +# define Tcl_NewIntObj(value) ((threadTclVersion>86)? \
          173  +  ((Tcl_Obj * (*)(Tcl_WideInt))((&(tclStubsPtr->tcl_PkgProvideEx))[488]))((int)(value)): \
          174  +  ((Tcl_Obj * (*)(int))((&(tclStubsPtr->tcl_PkgProvideEx))[52]))(value))
   172    175   #endif
   173    176   
   174    177   #endif /* _TCL_THREAD_INT_H_ */