aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2013-12-12 17:40:58 +1000
committerSteve Bennett <steveb@workware.net.au>2016-08-17 16:43:08 +1000
commit278003ca94cf3d3e5f9619e6b2fd08ab590c0899 (patch)
tree700d26b33b809bc863ec00e0a9e95b31f3ef48b8
parentf2afd7b85c5a9b527bcbd4f66a5d65ed282d0012 (diff)
downloadjimtcl-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.in4
-rw-r--r--auto.def2
-rw-r--r--jim-aio.c1
-rw-r--r--jim-exec.c1
-rw-r--r--jim.c13
-rwxr-xr-xmake-bootstrap-jim8
-rw-r--r--regtest.tcl8
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@
diff --git a/auto.def b/auto.def
index 18d8a9f..fcf4a80 100644
--- a/auto.def
+++ b/auto.def
@@ -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 {
diff --git a/jim-aio.c b/jim-aio.c
index 8a96f27..4663afb 100644
--- a/jim-aio.c
+++ b/jim-aio.c
@@ -39,6 +39,7 @@
#include "jimautoconf.h"
+#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <errno.h>
diff --git a/jim-exec.c b/jim-exec.c
index e25eb2e..985a588 100644
--- a/jim-exec.c
+++ b/jim-exec.c
@@ -20,6 +20,7 @@
* express or implied warranty.
*/
+#define _GNU_SOURCE
#include <string.h>
#include <ctype.h>
diff --git a/jim.c b/jim.c
index 1532c1c..d7d5f0e 100644
--- a/jim.c
+++ b/jim.c
@@ -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"