diff options
author | Steve Bennett <steveb@workware.net.au> | 2013-12-12 17:40:58 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2016-08-17 16:43:08 +1000 |
commit | 278003ca94cf3d3e5f9619e6b2fd08ab590c0899 (patch) | |
tree | 700d26b33b809bc863ec00e0a9e95b31f3ef48b8 | |
parent | f2afd7b85c5a9b527bcbd4f66a5d65ed282d0012 (diff) | |
download | jimtcl-278003ca94cf3d3e5f9619e6b2fd08ab590c0899.zip jimtcl-278003ca94cf3d3e5f9619e6b2fd08ab590c0899.tar.gz jimtcl-278003ca94cf3d3e5f9619e6b2fd08ab590c0899.tar.bz2 |
Don't unconditionally define _GNU_SOURCE
Also, fix build if JIM_OPTIMIZATION is disabled
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r-- | Makefile.in | 4 | ||||
-rw-r--r-- | auto.def | 2 | ||||
-rw-r--r-- | jim-aio.c | 1 | ||||
-rw-r--r-- | jim-exec.c | 1 | ||||
-rw-r--r-- | jim.c | 13 | ||||
-rwxr-xr-x | make-bootstrap-jim | 8 | ||||
-rw-r--r-- | regtest.tcl | 8 |
7 files changed, 29 insertions, 8 deletions
diff --git a/Makefile.in b/Makefile.in index aa38da3..c43c6e9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -27,8 +27,8 @@ exec_prefix ?= @exec_prefix@ prefix ?= @prefix@ docdir = @docdir@ -CC += -D_GNU_SOURCE -Wall $(OPTIM) -I. -CXX += -D_GNU_SOURCE -Wall $(OPTIM) -I. +CC += -Wall $(OPTIM) -I. +CXX += -Wall $(OPTIM) -I. @if srcdir != . CFLAGS += -I@srcdir@ CXXFLAGS += -I@srcdir@ @@ -144,7 +144,7 @@ define tclsh [info nameofexecutable] if {![cc-check-functions _NSGetEnviron]} { msg-checking "Checking environ declared in unistd.h..." - if {[cctest -cflags -D_GNU_SOURCE -includes unistd.h -code {char **ep = environ;}]} { + if {[cctest -cflags {-D_GNU_SOURCE -D_POSIX_SOURCE} -includes unistd.h -code {char **ep = environ;}]} { define NO_ENVIRON_EXTERN msg-result "yes" } else { @@ -39,6 +39,7 @@ #include "jimautoconf.h" +#define _GNU_SOURCE #include <stdio.h> #include <string.h> #include <errno.h> @@ -20,6 +20,7 @@ * express or implied warranty. */ +#define _GNU_SOURCE #include <string.h> #include <ctype.h> @@ -41,6 +41,7 @@ * official policies, either expressed or implied, of the Jim Tcl Project. **/ #define JIM_OPTIMIZATION /* comment to avoid optimizations and reduce size */ +#define _GNU_SOURCE /* Mostly just for environ */ #include <stdio.h> #include <stdlib.h> @@ -115,6 +116,12 @@ static void JimPanicDump(int fail_condition, const char *fmt, ...); #define JimPanic(X) #endif +#ifdef JIM_OPTIMIZATION +#define JIM_IF_OPTIM(X) X +#else +#define JIM_IF_OPTIM(X) +#endif + /* ----------------------------------------------------------------------------- * Global variables * ---------------------------------------------------------------------------*/ @@ -11907,16 +11914,16 @@ static int Jim_ForCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv if (retval == JIM_OK || retval == JIM_CONTINUE) { /* increment */ - evalnext: +JIM_IF_OPTIM(evalnext:) retval = Jim_EvalObj(interp, argv[3]); if (retval == JIM_OK || retval == JIM_CONTINUE) { /* test */ - testcond: +JIM_IF_OPTIM(testcond:) retval = Jim_GetBoolFromExpr(interp, argv[2], &boolean); } } } - out: +JIM_IF_OPTIM(out:) if (stopVarNamePtr) { Jim_DecrRefCount(interp, stopVarNamePtr); } diff --git a/make-bootstrap-jim b/make-bootstrap-jim index ba3b2f8..d69380b 100755 --- a/make-bootstrap-jim +++ b/make-bootstrap-jim @@ -49,7 +49,7 @@ allexts="bootstrap aio readdir regexp file glob exec clock array stdlib tclcompa echo "/* This is single source file, bootstrap version of Jim Tcl. See http://jim.tcl.tk/ */" # define some core features -for i in _GNU_SOURCE JIM_TCL_COMPAT JIM_REFERENCES JIM_ANSIC JIM_REGEXP HAVE_NO_AUTOCONF _JIMAUTOCONF_H; do +for i in JIM_TCL_COMPAT JIM_REFERENCES JIM_ANSIC JIM_REGEXP HAVE_NO_AUTOCONF _JIMAUTOCONF_H; do echo "#define $i" done echo '#define TCL_LIBRARY "."' @@ -78,6 +78,12 @@ cat <<EOF #define TCL_PLATFORM_OS "unknown" #define TCL_PLATFORM_PLATFORM "unix" #define TCL_PLATFORM_PATH_SEPARATOR ":" +#ifdef _MINIX +#define vfork fork +#define _POSIX_SOURCE +#else +#define _GNU_SOURCE +#endif #define HAVE_VFORK #define HAVE_WAITPID #define HAVE_ISATTY diff --git a/regtest.tcl b/regtest.tcl index 8e25377..28bd43d 100644 --- a/regtest.tcl +++ b/regtest.tcl @@ -117,7 +117,13 @@ puts "TEST 17 PASSED" # REGTEST 18 # 12 Apr 2011 - crashes on unset for loop var catch { - for {set i 0} {$i < 5} {incr i} {unset i} + set j 0 + for {set i 0} {$i < 5} {incr i} { + unset i + if {[incr j] == 5} { + break + } + } } puts "TEST 18 PASSED" |