aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-12-19 17:00:26 +0200
committerArnold D. Robbins <arnold@skeeve.com>2012-12-19 17:00:26 +0200
commited17f7f9d71310c6418ba10a81bb35792f46cb08 (patch)
tree5b94aeebe6fe18634e09f1b90225b7b8172b67ce
parent45eced1c2512d48a392c7b9f761137d7601fa5b8 (diff)
downloadegawk-ed17f7f9d71310c6418ba10a81bb35792f46cb08.tar.gz
egawk-ed17f7f9d71310c6418ba10a81bb35792f46cb08.tar.bz2
egawk-ed17f7f9d71310c6418ba10a81bb35792f46cb08.zip
Restore building with tcc.
-rw-r--r--ChangeLog8
-rw-r--r--array.c3
-rw-r--r--awk.h14
-rwxr-xr-xconfigure4
-rw-r--r--configure.ac4
5 files changed, 28 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 72339533..cb0e2d9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,14 @@
* awkgram.y (isnoeffect): Add ifdefs around declaration, use,
and function body.
+ Unrelated: Restore building with tcc.
+
+ * awk.h (AFUNC): Move to array.c which is the only place its used.
+ (ainit_ind, atypeof_ind, etc.): New macros for use in array.c
+ * array.c (AFUNC): Change to use F##_ind. Works with tcc and other
+ compilers.
+ * configure.ac: Only add -export-dynamic flag if compiling with gcc.
+
2012-12-18 Andrew J. Schorr <aschorr@telemetry-investments.com>
* gawkapi.c (sym_update_real): If setting a scalar variable that exists
diff --git a/array.c b/array.c
index f968edd9..1953bfe0 100644
--- a/array.c
+++ b/array.c
@@ -53,6 +53,9 @@ static afunc_t null_array_func[] = {
static afunc_t *array_types[MAX_ATYPE];
static int num_array_types = 0;
+/* array func to index mapping */
+#define AFUNC(F) (F ## _ind)
+
/* register_array_func --- add routines to handle arrays */
int
diff --git a/awk.h b/awk.h
index 60a0db71..0f9b2ec1 100644
--- a/awk.h
+++ b/awk.h
@@ -508,21 +508,29 @@ typedef struct exp_node {
#define parent_array sub.nodep.x.extra
#define ainit array_funcs[0]
+#define ainit_ind 0
#define atypeof array_funcs[1]
+#define atypeof_ind 1
#define alength array_funcs[2]
+#define alength_ind 2
#define alookup array_funcs[3]
+#define alookup_ind 3
#define aexists array_funcs[4]
+#define aexists_ind 4
#define aclear array_funcs[5]
+#define aclear_ind 5
#define aremove array_funcs[6]
+#define aremove_ind 6
#define alist array_funcs[7]
+#define alist_ind 7
#define acopy array_funcs[8]
+#define acopy_ind 8
#define adump array_funcs[9]
+#define adump_ind 9
#define astore array_funcs[10]
+#define astore_ind 10
#define NUM_AFUNCS 11 /* # of entries in array_funcs */
-/* array func to index mapping */
-#define AFUNC(F) (& ((NODE *) 0)->F - ((NODE *) 0)->array_funcs)
-
/* Node_array_ref: */
#define orig_array lnode
#define prev_array rnode
diff --git a/configure b/configure
index 47d5f18d..fb1ad69c 100755
--- a/configure
+++ b/configure
@@ -10086,7 +10086,9 @@ fi
$as_echo "#define DYNAMIC 1" >>confdefs.h
- if uname | $EGREP -i 'linux|freebsd' > /dev/null
+ # Add -export-dynamic for old extensions. Only works for GCC
+ if test "$GCC" = yes &&
+ uname | $EGREP -i 'linux|freebsd' > /dev/null
then
LDFLAGS="$LDFLAGS -export-dynamic"
fi
diff --git a/configure.ac b/configure.ac
index bccd2351..fef29e06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -295,7 +295,9 @@ AC_CHECK_HEADER(dlfcn.h,
if test "$gawk_have_dlopen" = yes
then
AC_DEFINE([DYNAMIC], 1, [dynamic loading is possible])
- if uname | $EGREP -i 'linux|freebsd' > /dev/null
+ # Add -export-dynamic for old extensions. Only works for GCC
+ if test "$GCC" = yes &&
+ uname | $EGREP -i 'linux|freebsd' > /dev/null
then
LDFLAGS="$LDFLAGS -export-dynamic"
fi