gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] gawk branch, feature/cpp-compile, updated. gawk-4.1.0-4166-g15ab04


From: Arnold Robbins
Subject: [SCM] gawk branch, feature/cpp-compile, updated. gawk-4.1.0-4166-g15ab046
Date: Tue, 27 Oct 2020 04:40:37 -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  15ab0462057ceaedd50f7e3ac0b57991ea38e046 (commit)
      from  e7be40155683842d66c34b4de47328c2d7ba62a8 (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=15ab0462057ceaedd50f7e3ac0b57991ea38e046

commit 15ab0462057ceaedd50f7e3ac0b57991ea38e046
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Oct 27 10:40:16 2020 +0200

    Fix some warnings, enable real enums for flags in C.

diff --git a/awk.h b/awk.h
index 26ed17e..a0e17c6 100644
--- a/awk.h
+++ b/awk.h
@@ -178,6 +178,13 @@ extern void *memset_ulong(void *dest, int val, unsigned 
long l);
 /* same thing for warning */
 #define warning (*(set_loc(__FILE__, __LINE__),r_warning))
 
+// This macro lets GDB print the bits in bit flag enums when compiled with C.
+#ifdef __cplusplus
+#define ENUM(enumtag) int
+#else
+#define ENUM(enumtag) enum enumtag
+#endif /* __cplusplus */
+
 #ifdef HAVE_MPFR
 #include <gmp.h>
 #include <mpfr.h>
@@ -441,7 +448,7 @@ typedef struct exp_node {
                        size_t reserved;
                        struct exp_node *rn;
                        unsigned long cnt;
-                       int reflags;
+                       ENUM(reflagvals) reflags;
                } nodep;
 
                struct {
@@ -465,7 +472,7 @@ typedef struct exp_node {
                } val;
        } sub;
        NODETYPE type;
-       int flags;
+       ENUM(flagvals) flags;
        long valref;
 } NODE;
 
@@ -954,7 +961,7 @@ typedef struct iobuf {
        bool valid;
        int errcode;
 
-       int flag;
+       ENUM(iobuf_flags) flag;
 } IOBUF;
 
 typedef void (*Func_ptr)(void);
@@ -978,7 +985,7 @@ enum redirect_flags {
 typedef enum redirect_flags redirect_flags_t;
 
 struct redirect {
-       int flag;
+       ENUM(redirect_flags) flag;
        char *value;
        FILE *ifp;      /* input fp, needed for PIPES_SIMULATED */
        IOBUF *iop;
@@ -1226,10 +1233,10 @@ extern bool do_ieee_fmt;        /* emulate IEEE 754 
floating-point format */
 extern const char *myname;
 extern const char def_strftime_format[];
 
-extern char quote;
-extern char *defpath;
-extern char *deflibpath;
-extern char envsep;
+extern const char quote;
+extern const char *defpath;
+extern const char *deflibpath;
+extern const char envsep;
 
 extern char casetable[];       /* for case-independent regexp matching */
 
diff --git a/io.c b/io.c
index 0fa5314..311b38b 100644
--- a/io.c
+++ b/io.c
@@ -2961,8 +2961,8 @@ do_getline(int into_variable, IOBUF *iop)
 
 typedef struct {
        const char *envname;
-       char **dfltp;           /* pointer to address of default path */
-       char **awkpath;         /* array containing library search paths */
+       const char **dfltp;     /* pointer to address of default path */
+       const char **awkpath;   /* array containing library search paths */
        int max_pathlen;        /* length of the longest item in awkpath */
 } path_info;
 
@@ -2981,8 +2981,9 @@ static path_info pi_awklibpath = {
 static void
 init_awkpath(path_info *pi)
 {
-       char *path;
-       char *start, *end, *p;
+       const char *path;
+       const char *start, *end;
+       char *p;
        int len, i;
        int max_path;           /* (# of allocated paths)-1 */
 
@@ -2991,12 +2992,12 @@ init_awkpath(path_info *pi)
                path = pi->dfltp[0];
 
        /* count number of separators */
-       for (max_path = 0, p = path; *p; p++)
+       for (max_path = 0, p = (char *) path; *p; p++)
                if (*p == envsep)
                        max_path++;
 
        // +3 --> 2 for null entries at front and end of path, 1 for NULL end 
of list
-       ezalloc(pi->awkpath, char **, (max_path + 3) * sizeof(char *), 
"init_awkpath");
+       ezalloc(pi->awkpath, const char **, (max_path + 3) * sizeof(char *), 
"init_awkpath");
 
        start = path;
        i = 0;
diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc
index b366303..4e58b0a 100644
--- a/pc/gawkmisc.pc
+++ b/pc/gawkmisc.pc
@@ -22,19 +22,19 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
-char quote = '\'';
-char envsep = ';';
+const char quote = '\'';
+const char envsep = ';';
 
 # ifdef DEFPATH
-char *defpath = DEFPATH;
+const char *defpath = DEFPATH;
 # else
-char *defpath = ".;c:\\lib\\awk;c:\\gnu\\lib\\awk";
+const char *defpath = ".;c:\\lib\\awk;c:\\gnu\\lib\\awk";
 # endif
 /* the Makefile should define DEFLIBPATH */
-char *deflibpath = DEFLIBPATH;
+const char *deflibpath = DEFLIBPATH;
 
 #ifdef __EMX__
-#include<io.h>
+#include <io.h>
 
 static int _os2_is_abs_path(const char *dirname);
 static char* _os2_unixroot(const char *path);
diff --git a/posix/gawkmisc.c b/posix/gawkmisc.c
index 378c263..d2e33f4 100644
--- a/posix/gawkmisc.c
+++ b/posix/gawkmisc.c
@@ -24,10 +24,10 @@
 #include <io.h>
 #endif
 
-char quote = '\'';
-char *defpath = DEFPATH;
-char *deflibpath = DEFLIBPATH;
-char envsep = ':';
+const char quote = '\'';
+const char *defpath = DEFPATH;
+const char *deflibpath = DEFLIBPATH;
+const char envsep = ':';
 
 #ifndef INVALID_HANDLE
 /* FIXME: is this value for INVALID_HANDLE correct? */
diff --git a/vms/gawkmisc.vms b/vms/gawkmisc.vms
index edee431..ff5805b 100644
--- a/vms/gawkmisc.vms
+++ b/vms/gawkmisc.vms
@@ -79,10 +79,10 @@ int   SYS$TRNLNM(
         const unsigned char * acmode,
         const struct item_list_3 * item_list);
 
-char quote = '\'';
-char *defpath = DEFPATH;
-char *deflibpath = DEFLIBPATH;
-char envsep  = ',';
+const char quote = '\'';
+const char *defpath = DEFPATH;
+const char *deflibpath = DEFLIBPATH;
+const char envsep  = ',';
 #define VMS_NAME_LEN 255
 static char vms_name[VMS_NAME_LEN+1];
 

-----------------------------------------------------------------------

Summary of changes:
 awk.h            | 23 +++++++++++++++--------
 io.c             | 13 +++++++------
 pc/gawkmisc.pc   | 12 ++++++------
 posix/gawkmisc.c |  8 ++++----
 vms/gawkmisc.vms |  8 ++++----
 5 files changed, 36 insertions(+), 28 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]