[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, feature/cpp-compile, updated. gawk-4.1.0-4162-g5b4116
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, feature/cpp-compile, updated. gawk-4.1.0-4162-g5b4116f |
Date: |
Thu, 22 Oct 2020 03:33:49 -0400 (EDT) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, feature/cpp-compile has been updated
via 5b4116f120efdf104187af43e85ea6e2f34c4bdb (commit)
via ec21741c91dba8c431d483f204f7fe895f50d3ff (commit)
from d10a1a22e58c63fcc137eabb33c245db1b87e9a6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=5b4116f120efdf104187af43e85ea6e2f34c4bdb
commit 5b4116f120efdf104187af43e85ea6e2f34c4bdb
Merge: ec21741 d10a1a2
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Oct 22 10:33:40 2020 +0300
Merge branch 'feature/cpp-compile' of ssh://git.sv.gnu.org/srv/git/gawk
into feature/cpp-compile
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=ec21741c91dba8c431d483f204f7fe895f50d3ff
commit ec21741c91dba8c431d483f204f7fe895f50d3ff
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Oct 22 10:33:07 2020 +0300
Compiles with g++ and passes the test suite. Still lots of warnings.
diff --git a/awk.h b/awk.h
index 6c9342f..26ed17e 100644
--- a/awk.h
+++ b/awk.h
@@ -409,7 +409,7 @@ enum flagvals {
XARRAY = 0x10000,
NUMCONSTSTR = 0x20000, /* have string value for numeric
constant */
REGEX = 0x40000, /* this is a typed regex */
-} flags;
+};
/*
* NOTE - this struct is a rather kludgey -- it is packed to minimize
* space usage, at the expense of cleanliness. Alter at own risk.
@@ -1039,13 +1039,14 @@ typedef struct srcfile {
} SRCFILE;
// structure for INSTRUCTION pool, needed mainly for debugger
+struct instruction_mem_pool {
+ struct instruction_block *block_list;
+ INSTRUCTION *free_space; // free location in active block
+ INSTRUCTION *free_list;
+};
typedef struct instruction_pool {
#define MAX_INSTRUCTION_ALLOC 4 // we don't call bcalloc with more than
this
- struct instruction_mem_pool {
- struct instruction_block *block_list;
- INSTRUCTION *free_space; // free location in active block
- INSTRUCTION *free_list;
- } pool[MAX_INSTRUCTION_ALLOC];
+ struct instruction_mem_pool pool[MAX_INSTRUCTION_ALLOC];
} INSTRUCTION_POOL;
/* structure for execution context */
@@ -1693,7 +1694,11 @@ extern void msg (const char *mesg, ...)
ATTRIBUTE_PRINTF_1;
extern void error (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
extern void r_warning (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
extern void set_loc (const char *file, int line);
-extern void r_fatal (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
+extern
+#ifdef __cplusplus
+"C"
+#endif /* __cplusplus */
+void r_fatal (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
extern void (*lintfunc)(const char *mesg, ...) ATTRIBUTE_PRINTF_1;
#else
diff --git a/awkgram.c b/awkgram.c
index 62ff87f..3b3928b 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -75,6 +75,8 @@
#include "awk.h"
+#include <math.h>
+
#if defined(__STDC__) && __STDC__ < 1 /* VMS weirdness, maybe elsewhere */
#define signed /**/
#endif
@@ -228,8 +230,6 @@ static inline INSTRUCTION *list_append(INSTRUCTION *l,
INSTRUCTION *x);
static inline INSTRUCTION *list_prepend(INSTRUCTION *l, INSTRUCTION *x);
static inline INSTRUCTION *list_merge(INSTRUCTION *l1, INSTRUCTION *l2);
-extern double fmod(double x, double y);
-
#define YYSTYPE INSTRUCTION *
#line 236 "awkgram.c"
diff --git a/awkgram.y b/awkgram.y
index 0987bd0..09bdbf6 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -30,6 +30,8 @@
#include "awk.h"
+#include <math.h>
+
#if defined(__STDC__) && __STDC__ < 1 /* VMS weirdness, maybe elsewhere */
#define signed /**/
#endif
@@ -183,8 +185,6 @@ static inline INSTRUCTION *list_append(INSTRUCTION *l,
INSTRUCTION *x);
static inline INSTRUCTION *list_prepend(INSTRUCTION *l, INSTRUCTION *x);
static inline INSTRUCTION *list_merge(INSTRUCTION *l1, INSTRUCTION *l2);
-extern double fmod(double x, double y);
-
#define YYSTYPE INSTRUCTION *
%}
diff --git a/builtin.c b/builtin.c
index b672d97..e22e5e3 100644
--- a/builtin.c
+++ b/builtin.c
@@ -68,12 +68,6 @@
static size_t mbc_byte_count(const char *ptr, size_t numchars);
static size_t mbc_char_count(const char *ptr, size_t numbytes);
-/* Can declare these, since we always use the random shipped with gawk */
-extern char *initstate(unsigned long seed, char *state, long n);
-extern char *setstate(char *state);
-extern long random(void);
-extern void srandom(unsigned long seed);
-
extern NODE **args_array;
extern int max_args;
extern NODE **fields_arr;
diff --git a/debug.c b/debug.c
index 67df3d7..174d18e 100644
--- a/debug.c
+++ b/debug.c
@@ -3051,7 +3051,7 @@ next_step(CMDARG *arg, int cmd)
stop.repeat_count = arg->a_int;
else
stop.repeat_count = 1;
- stop.command = (argtype) cmd;
+ stop.command = (enum argtype) cmd;
return true;
}
@@ -3231,7 +3231,7 @@ do_finish(CMDARG *arg ATTRIBUTE_UNUSED, int cmd)
fprintf(out_fp, _("Run until return from "));
print_numbered_frame(cur_frame);
stop.check_func = check_finish;
- stop.command = (argtype) cmd;
+ stop.command = (enum argtype) cmd;
stop.print_ret = true;
return true;
}
@@ -3279,7 +3279,7 @@ do_return(CMDARG *arg, int cmd)
assert(stop.fcall_count >= 0);
stop.pc = (func->code_ptr + 1)->lasti;
assert(stop.pc->opcode == Op_K_return);
- stop.command = (argtype) cmd;
+ stop.command = (enum argtype) cmd;
stop.check_func = check_return;
@@ -3342,7 +3342,7 @@ do_until(CMDARG *arg, int cmd)
stop.sourceline = sourceline;
stop.fcall_count = fcall_count - cur_frame;
stop.check_func = check_until;
- stop.command = (argtype) cmd;
+ stop.command = (enum argtype) cmd;
return true;
}
@@ -3381,7 +3381,7 @@ func:
stop.pc = ip;
stop.fcall_count = fcall_count - cur_frame;
stop.check_func = check_until;
- stop.command = (argtype) cmd;
+ stop.command = (enum argtype) cmd;
return true;
}
}
@@ -3402,7 +3402,7 @@ func:
stop.pc = ip;
stop.fcall_count = fcall_count - cur_frame;
stop.check_func = check_until;
- stop.command = (argtype) cmd;
+ stop.command = (enum argtype) cmd;
return true;
}
if (ip == (rp + 1)->lasti)
diff --git a/eval.c b/eval.c
index c052b2c..b8dff61 100644
--- a/eval.c
+++ b/eval.c
@@ -25,9 +25,8 @@
#include "awk.h"
-extern double pow(double x, double y);
-extern double modf(double x, double *yp);
-extern double fmod(double x, double y);
+#include <math.h>
+
NODE **fcall_list = NULL;
long fcall_count = 0;
int currule = 0;
diff --git a/mpfr.c b/mpfr.c
index 38f38a3..8a58188 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -596,7 +596,7 @@ get_rnd_mode(const char rmode)
default:
break;
}
- return -1;
+ return (mpfr_rnd_t) -1;
}
/*
@@ -608,7 +608,7 @@ void
set_ROUNDMODE()
{
if (do_mpfr) {
- mpfr_rnd_t rndm = -1;
+ mpfr_rnd_t rndm = (mpfr_rnd_t) -1;
NODE *n;
n = force_string(ROUNDMODE_node->var_value);
if (n->stlen == 1)
@@ -705,7 +705,7 @@ do_mpfr_atan2(int nargs)
static inline NODE *
do_mpfr_func(const char *name,
- int (*mpfr_func)(), /* putting argument types just gets the
compiler confused */
+ int (*mpfr_func)(mpfr_ptr, mpfr_srcptr, mpfr_rnd_t), /*
putting argument types just gets the compiler confused */
int nargs)
{
NODE *t1, *res;
diff --git a/msg.c b/msg.c
index 0dc3f71..7bc5b99 100644
--- a/msg.c
+++ b/msg.c
@@ -156,6 +156,9 @@ set_loc(const char *file, int line)
/* r_fatal --- print a fatal error message */
+#ifdef __cplusplus
+extern "C"
+#endif /* __cplusplus */
void
r_fatal(const char *mesg, ...)
{
diff --git a/node.c b/node.c
index 707d106..9ff935d 100644
--- a/node.c
+++ b/node.c
@@ -62,7 +62,6 @@ r_force_number(NODE *n)
char *cpend;
char save;
char *ptr;
- extern double strtod();
if ((n->flags & NUMCUR) != 0)
return n;
diff --git a/profile.c b/profile.c
index 44e171f..4a676ae 100644
--- a/profile.c
+++ b/profile.c
@@ -179,7 +179,7 @@ pp_push(int type, char *s, int flag, INSTRUCTION *comment)
n->pp_str = s;
n->pp_len = strlen(s);
n->flags = flag;
- n->type = type;
+ n->type = (NODETYPE) type;
n->pp_next = pp_stack;
n->pp_comment = comment;
pp_stack = n;
diff --git a/re.c b/re.c
index fb28c56..ace989a 100644
--- a/re.c
+++ b/re.c
@@ -613,7 +613,7 @@ check_bracket_exp(char *s, size_t length)
sp = s;
again:
- sp = sp2 = memchr(sp, '[', (end - sp));
+ sp = sp2 = (char *) memchr(sp, '[', (end - sp));
if (sp == NULL)
goto done;
diff --git a/str_array.c b/str_array.c
index 84bd2f0..5951537 100644
--- a/str_array.c
+++ b/str_array.c
@@ -322,7 +322,7 @@ str_remove(NODE *symbol, NODE *subs)
static NODE **
str_copy(NODE *symbol, NODE *newsymb)
{
- BUCKET **old, **new, **pnew;
+ BUCKET **old, **newtab, **pnew;
BUCKET *chain, *newchain;
unsigned long cursize, i;
@@ -332,12 +332,12 @@ str_copy(NODE *symbol, NODE *newsymb)
cursize = symbol->array_size;
/* allocate new table */
- ezalloc(new, BUCKET **, cursize * sizeof(BUCKET *), "str_copy");
+ ezalloc(newtab, BUCKET **, cursize * sizeof(BUCKET *), "str_copy");
old = symbol->buckets;
for (i = 0; i < cursize; i++) {
- for (chain = old[i], pnew = & new[i]; chain != NULL;
+ for (chain = old[i], pnew = & newtab[i]; chain != NULL;
chain = chain->ahnext
) {
NODE *oldval, *newsubs;
@@ -373,7 +373,7 @@ str_copy(NODE *symbol, NODE *newsymb)
}
newsymb->table_size = symbol->table_size;
- newsymb->buckets = new;
+ newsymb->buckets = newtab;
newsymb->array_size = cursize;
newsymb->flags = symbol->flags;
return NULL;
@@ -633,7 +633,7 @@ str_find(NODE *symbol, NODE *s1, size_t code1, unsigned
long hash1)
static void
grow_table(NODE *symbol)
{
- BUCKET **old, **new;
+ BUCKET **old, **newtab;
BUCKET *chain, *next;
int i, j;
unsigned long oldsize, newsize, k;
@@ -672,10 +672,10 @@ grow_table(NODE *symbol)
}
/* allocate new table */
- ezalloc(new, BUCKET **, newsize * sizeof(BUCKET *), "grow_table");
+ ezalloc(newtab, BUCKET **, newsize * sizeof(BUCKET *), "grow_table");
old = symbol->buckets;
- symbol->buckets = new;
+ symbol->buckets = newtab;
symbol->array_size = newsize;
/* brand new hash table, set things up and return */
@@ -697,8 +697,8 @@ grow_table(NODE *symbol)
hash1 = chain->ahcode % newsize;
/* remove from old list, add to new */
- chain->ahnext = new[hash1];
- new[hash1] = chain;
+ chain->ahnext = newtab[hash1];
+ newtab[hash1] = chain;
}
}
efree(old);
diff --git a/support/dfa.h b/support/dfa.h
index 2f77f26..d371cc9 100644
--- a/support/dfa.h
+++ b/support/dfa.h
@@ -24,6 +24,11 @@
struct localeinfo; /* See localeinfo.h. */
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+
/* Element of a list of strings, at least one of which is known to
appear in any R.E. matching the DFA. */
struct dfamust
@@ -131,3 +136,6 @@ extern void dfawarn (const char *);
takes a single argument, a NUL-terminated string describing the error.
The user must supply a dfaerror. */
extern _Noreturn void dfaerror (const char *);
+#ifdef __cplusplus
+}
+#endif // __cplusplus
diff --git a/support/localeinfo.h b/support/localeinfo.h
index 16f5129..032093f 100644
--- a/support/localeinfo.h
+++ b/support/localeinfo.h
@@ -50,6 +50,10 @@ struct localeinfo
wint_t sbctowc[UCHAR_MAX + 1];
};
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
extern void init_localeinfo (struct localeinfo *);
/* Maximum number of characters that can be the case-folded
@@ -58,3 +62,7 @@ extern void init_localeinfo (struct localeinfo *);
enum { CASE_FOLDED_BUFSIZE = 32 };
extern int case_folded_counterparts (wint_t, wchar_t[CASE_FOLDED_BUFSIZE]);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
diff --git a/support/random.h b/support/random.h
index 84b3141..2bbc43f 100644
--- a/support/random.h
+++ b/support/random.h
@@ -40,4 +40,13 @@ typedef long gawk_int32_t;
#define uint32_t gawk_uint32_t
#define int32_t gawk_int32_t
-extern long random (void);
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+extern char *initstate(unsigned long seed, char *state, long n);
+extern char *setstate(char *state);
+extern long random(void);
+extern void srandom(unsigned long seed);
+#ifdef __cplusplus
+}
+#endif // __cplusplus
-----------------------------------------------------------------------
Summary of changes:
awk.h | 19 ++++++++++++-------
awkgram.c | 4 ++--
awkgram.y | 4 ++--
builtin.c | 6 ------
debug.c | 12 ++++++------
eval.c | 5 ++---
mpfr.c | 6 +++---
msg.c | 3 +++
node.c | 1 -
profile.c | 2 +-
re.c | 2 +-
str_array.c | 18 +++++++++---------
support/dfa.h | 8 ++++++++
support/localeinfo.h | 8 ++++++++
support/random.h | 11 ++++++++++-
15 files changed, 67 insertions(+), 42 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, feature/cpp-compile, updated. gawk-4.1.0-4162-g5b4116f,
Arnold Robbins <=