Discussion:
[patch] vi enable -pedantic
Jonathan Gray
2016-02-09 00:18:51 UTC
Permalink
I don't think we should enable -pedantic anywhere in the tree. Different
versions of gcc are going to have different ideas of what pedantic is.

I'm not sold on the value of all these patches to nvi when it is possibly
hindering people who may be looking to add utf-8 support (via nvi2 or
otherwise).
And of course you find out way to late that format=flowed was still on...
Here's a new diff.
Any OKs for this?
This patch enables -pedantic and does the appropriate cleanup that comes
with it. It's mostly a CHAR_T->char conversion, which should be quite
harmless, but edge-cases can be missed.
I'd like to have multiple OKs for this one as well as testing on
multiple architectures, just to be sure.
The B1LEN, SKIP_PAST_NEWLINE, and PRIu32 are to silence clang with
-pedantic.
Build and tested on amd64 with gcc, egcc and clang.
This drops the places CHAR_t can be found from 224 to 93.
Index: build/Makefile
===================================================================
RCS file: /cvs/src/usr.bin/vi/build/Makefile,v
retrieving revision 1.23
diff -u -p -r1.23 Makefile
--- build/Makefile 6 Jan 2016 22:34:45 -0000 1.23
+++ build/Makefile 8 Feb 2016 21:35:59 -0000
@@ -4,7 +4,7 @@
PROG= vi
# Modern curses (ncurses)
-CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../include
+CFLAGS+=-pedantic -Werror -I${.CURDIR} -I${.CURDIR}/../include
LDADD+=-lcurses
DPADD+= ${LIBCURSES}
Index: cl/cl_term.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/cl/cl_term.c,v
retrieving revision 1.21
diff -u -p -r1.21 cl_term.c
--- cl/cl_term.c 6 Jan 2016 22:28:52 -0000 1.21
+++ cl/cl_term.c 8 Feb 2016 21:35:59 -0000
@@ -30,7 +30,7 @@
#include "../common/common.h"
#include "cl.h"
-static int cl_pfmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
+static int cl_pfmap(SCR *, seq_t, char *, size_t, char *, size_t);
/*
* XXX
@@ -170,10 +170,10 @@ cl_term_end(GS *gp)
* cl_fmap --
* Map a function key.
*
- * PUBLIC: int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
+ * PUBLIC: int cl_fmap(SCR *, seq_t, char *, size_t, char *, size_t);
*/
int
-cl_fmap(SCR *sp, seq_t stype, CHAR_T *from, size_t flen, CHAR_T *to,
+cl_fmap(SCR *sp, seq_t stype, char *from, size_t flen, char *to,
size_t tlen)
{
/* Ignore until the screen is running, do the real work then. */
@@ -190,7 +190,7 @@ cl_fmap(SCR *sp, seq_t stype, CHAR_T *fr
* Map a function key (private version).
*/
static int
-cl_pfmap(SCR *sp, seq_t stype, CHAR_T *from, size_t flen, CHAR_T *to,
+cl_pfmap(SCR *sp, seq_t stype, char *from, size_t flen, char *to,
size_t tlen)
{
size_t nlen;
Index: common/args.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/args.h,v
retrieving revision 1.3
diff -u -p -r1.3 args.h
--- common/args.h 29 Jan 2001 01:58:28 -0000 1.3
+++ common/args.h 8 Feb 2016 21:35:59 -0000
@@ -22,7 +22,7 @@
* is found.
*/
typedef struct _args {
- CHAR_T *bp; /* Argument. */
+ char *bp; /* Argument. */
size_t blen; /* Buffer length. */
size_t len; /* Argument length. */
Index: common/exf.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/exf.c,v
retrieving revision 1.41
diff -u -p -r1.41 exf.c
--- common/exf.c 6 Jan 2016 22:29:38 -0000 1.41
+++ common/exf.c 8 Feb 2016 21:35:59 -0000
@@ -54,10 +54,10 @@ static int file_spath(SCR *, FREF *, str
* vi now remembers the last location in any file that it has ever edited,
* not just the previously edited file.
*
- * PUBLIC: FREF *file_add(SCR *, CHAR_T *);
+ * PUBLIC: FREF *file_add(SCR *, char *);
*/
FREF *
-file_add(SCR *sp, CHAR_T *name)
+file_add(SCR *sp, char *name)
{
GS *gp;
FREF *frp, *tfrp;
@@ -922,7 +922,7 @@ file_write(SCR *sp, MARK *fm, MARK *tm,
msgstr = LF_ISSET(FS_APPEND) ?
- "%s: %lu lines, %lu characters", NULL;
+ "%s: %lu lines, %lu characters";
len = snprintf(buf, sizeof(buf), msgstr, p, nlno, nch);
if (len >= sizeof(buf))
len = sizeof(buf) - 1;
Index: common/gs.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/gs.h,v
retrieving revision 1.16
diff -u -p -r1.16 gs.h
--- common/gs.h 30 Jan 2016 21:23:50 -0000 1.16
+++ common/gs.h 8 Feb 2016 21:35:59 -0000
@@ -118,7 +118,7 @@ struct _gs {
(sp)->gp->cname[(unsigned char)(ch)].name : \
v_key_name((sp), (ch)))
struct {
- CHAR_T name[MAX_CHARACTER_COLUMNS + 1];
+ char name[MAX_CHARACTER_COLUMNS + 1];
u_int8_t len;
} cname[MAX_FAST_KEY + 1]; /* Fast lookup table. */
@@ -165,7 +165,7 @@ struct _gs {
/* Ex: screen adjustment routine. */
int (*scr_ex_adjust)(SCR *, exadj_t);
int (*scr_fmap) /* Set a function key. */
-(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
+(SCR *, seq_t, char *, size_t, char *, size_t);
/* Get terminal key value. */
int (*scr_keyval)(SCR *, scr_keyval_t, CHAR_T *, int *);
/* Insert a line. */
Index: common/key.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/key.c,v
retrieving revision 1.16
diff -u -p -r1.16 key.c
--- common/key.c 20 Jan 2016 08:43:27 -0000 1.16
+++ common/key.c 8 Feb 2016 21:35:59 -0000
@@ -128,8 +128,8 @@ v_key_init(SCR *sp)
for (gp->max_special = 0, kp = keylist, cnt = nkeylist; cnt--; ++kp) {
if (gp->max_special < kp->value)
gp->max_special = kp->value;
- if (kp->ch <= MAX_FAST_KEY)
- gp->special_key[kp->ch] = kp->value;
+ if ((unsigned char) kp->ch <= MAX_FAST_KEY)
+ gp->special_key[(unsigned char) kp->ch] = kp->value;
}
/* Find a non-printable character to use as a message separator. */
@@ -190,7 +190,8 @@ v_keyval(SCR *sp, int val, scr_keyval_t
void
v_key_ilookup(SCR *sp)
{
- CHAR_T ch, *p, *t;
+ char *p, *t;
+ unsigned char ch;
GS *gp;
size_t len;
@@ -205,10 +206,10 @@ v_key_ilookup(SCR *sp)
* Return the length of the string that will display the key.
* This routine is the backup for the KEY_LEN() macro.
*
- * PUBLIC: size_t v_key_len(SCR *, CHAR_T);
+ * PUBLIC: size_t v_key_len(SCR *, char);
*/
size_t
-v_key_len(SCR *sp, CHAR_T ch)
+v_key_len(SCR *sp, char ch)
{
(void)v_key_name(sp, ch);
return (sp->clen);
@@ -219,14 +220,14 @@ v_key_len(SCR *sp, CHAR_T ch)
* Return the string that will display the key. This routine
* is the backup for the KEY_NAME() macro.
*
- * PUBLIC: CHAR_T *v_key_name(SCR *, CHAR_T);
+ * PUBLIC: char *v_key_name(SCR *, char);
*/
-CHAR_T *
-v_key_name(SCR *sp, CHAR_T ch)
+char *
+v_key_name(SCR *sp, char ch)
{
static const CHAR_T hexdigit[] = "0123456789abcdef";
static const CHAR_T octdigit[] = "01234567";
- CHAR_T *chp, mask;
+ char *chp, mask;
size_t len;
int cnt, shift;
@@ -281,7 +282,7 @@ nopr: if (iscntrl(ch) && (ch < 0x20 || c
} else {
sp->cname[0] = '\\';
sp->cname[1] = 'x';
- for (len = 2, chp = (u_int8_t *)&ch,
+ for (len = 2, chp = &ch,
cnt = sizeof(CHAR_T); cnt-- > 0; ++chp) {
sp->cname[len++] = hexdigit[(*chp & 0xf0) >> 4];
sp->cname[len++] = hexdigit[*chp & 0x0f];
@@ -318,10 +319,10 @@ v_key_val(SCR *sp, CHAR_T ch)
* an associated flag value, which indicates if it has already been quoted,
* and if it is the result of a mapping or an abbreviation.
*
- * PUBLIC: int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int);
+ * PUBLIC: int v_event_push(SCR *, EVENT *, char *, size_t, u_int);
*/
int
-v_event_push(SCR *sp, EVENT *p_evp, CHAR_T *p_s, size_t nitems, u_int flags)
+v_event_push(SCR *sp, EVENT *p_evp, char *p_s, size_t nitems, u_int flags)
{
EVENT *evp;
GS *gp;
Index: common/key.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/key.h,v
retrieving revision 1.6
diff -u -p -r1.6 key.h
--- common/key.h 20 Jan 2016 08:43:27 -0000 1.6
+++ common/key.h 8 Feb 2016 21:35:59 -0000
@@ -121,7 +121,7 @@ struct _event {
typedef struct _keylist {
e_key_t value; /* Special value. */
- CHAR_T ch; /* Key. */
+ char ch; /* Key. */
} KEYLIST;
extern KEYLIST keylist[];
Index: common/log.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/log.c,v
retrieving revision 1.8
diff -u -p -r1.8 log.c
--- common/log.c 30 Jan 2016 21:31:08 -0000 1.8
+++ common/log.c 8 Feb 2016 21:35:59 -0000
@@ -353,7 +353,7 @@ log_backward(SCR *sp, MARK *rp)
MARK m;
recno_t lno;
int didop;
- u_char *p;
+ char *p;
ep = sp->ep;
if (F_ISSET(ep, F_NOLOG)) {
@@ -378,7 +378,7 @@ log_backward(SCR *sp, MARK *rp)
#if defined(DEBUG) && 0
log_trace(sp, "log_backward", ep->l_cur, data.data);
#endif
- switch (*(p = (u_char *)data.data)) {
+ switch (*(p = data.data)) {
if (didop) {
memmove(rp, p + sizeof(u_char), sizeof(MARK));
@@ -456,7 +456,7 @@ log_setline(SCR *sp)
LMARK lm;
MARK m;
recno_t lno;
- u_char *p;
+ char *p;
ep = sp->ep;
if (F_ISSET(ep, F_NOLOG)) {
@@ -480,7 +480,7 @@ log_setline(SCR *sp)
#if defined(DEBUG) && 0
log_trace(sp, "log_setline", ep->l_cur, data.data);
#endif
- switch (*(p = (u_char *)data.data)) {
+ switch (*(p = data.data)) {
memmove(&m, p + sizeof(u_char), sizeof(MARK));
if (m.lno != sp->lno || ep->l_cur == 1) {
@@ -543,7 +543,7 @@ log_forward(SCR *sp, MARK *rp)
MARK m;
recno_t lno;
int didop;
- u_char *p;
+ char *p;
ep = sp->ep;
if (F_ISSET(ep, F_NOLOG)) {
@@ -568,7 +568,7 @@ log_forward(SCR *sp, MARK *rp)
#if defined(DEBUG) && 0
log_trace(sp, "log_forward", ep->l_cur, data.data);
#endif
- switch (*(p = (u_char *)data.data)) {
+ switch (*(p = data.data)) {
if (didop) {
++ep->l_cur;
Index: common/main.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/main.c,v
retrieving revision 1.36
diff -u -p -r1.36 main.c
--- common/main.c 3 Feb 2016 01:47:25 -0000 1.36
+++ common/main.c 8 Feb 2016 21:35:59 -0000
@@ -275,7 +275,7 @@ editor(GS *gp, int argc, char *argv[])
if (wsizearg != NULL) {
ARGS *av[2], a, b;
(void)snprintf(path, sizeof(path), "window=%s", wsizearg);
- a.bp = (CHAR_T *)path;
+ a.bp = path;
a.len = strlen(path);
b.bp = NULL;
b.len = 0;
@@ -380,7 +380,7 @@ editor(GS *gp, int argc, char *argv[])
if ((frp = file_add(sp, NULL)) == NULL)
goto err;
} else {
- if ((frp = file_add(sp, (CHAR_T *)sp->argv[0])) == NULL)
+ if ((frp = file_add(sp, sp->argv[0])) == NULL)
goto err;
if (F_ISSET(sp, SC_ARGRECOVER))
F_SET(frp, FR_RECOVER);
Index: common/msg.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/msg.c,v
retrieving revision 1.26
diff -u -p -r1.26 msg.c
--- common/msg.c 6 Jan 2016 22:29:38 -0000 1.26
+++ common/msg.c 8 Feb 2016 21:35:59 -0000
@@ -19,6 +19,7 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
@@ -438,12 +439,12 @@ msgq_status(SCR *sp, recno_t lno, u_int
memcpy(p, "empty file", len);
p += len;
} else {
- (void)snprintf(p, ep - p, "line %lu of %lu [%ld%%]",
- lno, last, (lno * 100) / last);
+ (void)snprintf(p, ep - p, "line %"PRIu32" of %"PRIu32
+ " [%"PRIu32"%%]", lno, last, (lno * 100) / last);
p += strlen(p);
}
} else {
- (void)snprintf(p, ep - p, "line %lu", lno);
+ (void)snprintf(p, ep - p, "line %"PRIu32, lno);
p += strlen(p);
}
#ifdef DEBUG
Index: common/options.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/options.c,v
retrieving revision 1.21
diff -u -p -r1.21 options.c
--- common/options.c 6 Jan 2016 22:28:52 -0000 1.21
+++ common/options.c 8 Feb 2016 21:35:59 -0000
@@ -272,6 +272,7 @@ static OABBREV const abbrev[] = {
{NULL},
};
+#define B1LEN 1024
/*
* opts_init --
* Initialize some of the options.
@@ -285,7 +286,7 @@ opts_init(SCR *sp, int *oargs)
OPTLIST const *op;
u_long v;
int optindx;
- char *s, b1[1024];
+ char *s, b1[B1LEN];
a.bp = b1;
b.bp = NULL;
@@ -296,7 +297,7 @@ opts_init(SCR *sp, int *oargs)
/* Set numeric and string default values. */
#define OI(indx, str) { \
if ((str) != b1) /* GCC puts strings in text-space. */ \
- (void)strlcpy(b1, (str), sizeof(b1)); \
+ (void)strlcpy(b1, (str), B1LEN); \
a.len = strlen(b1); \
if (opts_set(sp, argv, NULL)) { \
optindx = indx; \
Index: common/recover.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/recover.c,v
retrieving revision 1.24
diff -u -p -r1.24 recover.c
--- common/recover.c 30 Jan 2016 21:23:50 -0000 1.24
+++ common/recover.c 8 Feb 2016 21:35:59 -0000
@@ -574,7 +574,7 @@ rcv_read(SCR *sp, FREF *frp)
DIR *dirp;
EXF *ep;
struct timespec rec_mtim;
- int fd, found, locked, requested, sv_fd;
+ int fd, found, locked = 0, requested, sv_fd;
char *name, *p, *t, *rp, *recp, *pathp;
char file[PATH_MAX], path[PATH_MAX], recpath[PATH_MAX];
@@ -620,7 +620,6 @@ rcv_read(SCR *sp, FREF *frp)
* and someone else is using the file, we're going to
* die horribly.
*/
- locked = 0;
break;
locked = 1;
Index: common/screen.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/screen.h,v
retrieving revision 1.8
diff -u -p -r1.8 screen.h
--- common/screen.h 19 Nov 2015 07:53:31 -0000 1.8
+++ common/screen.h 8 Feb 2016 21:35:59 -0000
@@ -82,7 +82,7 @@ struct _scr {
recno_t defscroll; /* Vi: ^D, ^U scroll information. */
/* Display character. */
- CHAR_T cname[MAX_CHARACTER_COLUMNS + 1];
+ char cname[MAX_CHARACTER_COLUMNS + 1];
size_t clen; /* Length of display character. */
enum { /* Vi editor mode. */
Index: common/seq.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/seq.c,v
retrieving revision 1.11
diff -u -p -r1.11 seq.c
--- common/seq.c 7 Dec 2015 20:39:19 -0000 1.11
+++ common/seq.c 8 Feb 2016 21:35:59 -0000
@@ -29,14 +29,14 @@
* seq_set --
* Internal version to enter a sequence.
*
- * PUBLIC: int seq_set(SCR *, CHAR_T *,
- * PUBLIC: size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int);
+ * PUBLIC: int seq_set(SCR *, char *,
+ * PUBLIC: size_t, char *, size_t, char *, size_t, seq_t, int);
*/
int
-seq_set(SCR *sp, CHAR_T *name, size_t nlen, CHAR_T *input, size_t ilen,
- CHAR_T *output, size_t olen, seq_t stype, int flags)
+seq_set(SCR *sp, char *name, size_t nlen, char *input, size_t ilen,
+ char *output, size_t olen, seq_t stype, int flags)
{
- CHAR_T *p;
+ char *p;
SEQ *lastqp, *qp;
int sv_errno;
@@ -116,7 +116,7 @@ mem1: errno = sv_errno;
}
/* Set the fast lookup bit. */
- if (qp->input[0] < MAX_BIT_SEQ)
+ if ((unsigned char) qp->input[0] < MAX_BIT_SEQ)
bit_set(sp->gp->seqb, qp->input[0]);
return (0);
@@ -126,10 +126,10 @@ mem1: errno = sv_errno;
* seq_delete --
* Delete a sequence.
*
- * PUBLIC: int seq_delete(SCR *, CHAR_T *, size_t, seq_t);
+ * PUBLIC: int seq_delete(SCR *, char *, size_t, seq_t);
*/
int
-seq_delete(SCR *sp, CHAR_T *input, size_t ilen, seq_t stype)
+seq_delete(SCR *sp, char *input, size_t ilen, seq_t stype)
{
SEQ *qp;
@@ -163,10 +163,10 @@ seq_mdel(SEQ *qp)
* isn't NULL, partial matches count.
*
* PUBLIC: SEQ *seq_find
- * PUBLIC:(SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *);
+ * PUBLIC:(SCR *, SEQ **, EVENT *, char *, size_t, seq_t, int *);
*/
SEQ *
-seq_find(SCR *sp, SEQ **lastqp, EVENT *e_input, CHAR_T *c_input, size_t ilen,
+seq_find(SCR *sp, SEQ **lastqp, EVENT *e_input, char *c_input, size_t ilen,
seq_t stype, int *ispartialp)
{
SEQ *lqp, *qp;
@@ -270,7 +270,7 @@ seq_close(GS *gp)
int
seq_dump(SCR *sp, seq_t stype, int isname)
{
- CHAR_T *p;
+ char *p;
GS *gp;
SEQ *qp;
int cnt, len, olen;
@@ -315,7 +315,7 @@ seq_dump(SCR *sp, seq_t stype, int isnam
int
seq_save(SCR *sp, FILE *fp, char *prefix, seq_t stype)
{
- CHAR_T *p;
+ char *p;
SEQ *qp;
size_t olen;
int ch;
@@ -350,12 +350,12 @@ seq_save(SCR *sp, FILE *fp, char *prefix
/*
* e_memcmp --
- * Compare a string of EVENT's to a string of CHAR_T's.
+ * Compare a string of EVENT's to a string characters.
*
- * PUBLIC: int e_memcmp(CHAR_T *, EVENT *, size_t);
+ * PUBLIC: int e_memcmp(char *, EVENT *, size_t);
*/
int
-e_memcmp(CHAR_T *p1, EVENT *ep, size_t n)
+e_memcmp(char *p1, EVENT *ep, size_t n)
{
if (n != 0) {
do {
Index: common/seq.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/seq.h,v
retrieving revision 1.3
diff -u -p -r1.3 seq.h
--- common/seq.h 29 Jan 2001 01:58:32 -0000 1.3
+++ common/seq.h 8 Feb 2016 21:35:59 -0000
@@ -31,11 +31,11 @@
struct _seq {
LIST_ENTRY(_seq) q; /* Linked list of all sequences. */
seq_t stype; /* Sequence type. */
- CHAR_T *name; /* Sequence name (if any). */
+ char *name; /* Sequence name (if any). */
size_t nlen; /* Name length. */
- CHAR_T *input; /* Sequence input keys. */
+ char *input; /* Sequence input keys. */
size_t ilen; /* Input keys length. */
- CHAR_T *output; /* Sequence output keys. */
+ char *output; /* Sequence output keys. */
size_t olen; /* Output keys length. */
#define SEQ_FUNCMAP 0x01 /* If unresolved function key.*/
Index: common/util.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/util.c,v
retrieving revision 1.13
diff -u -p -r1.13 util.c
--- common/util.c 30 Jan 2016 21:31:08 -0000 1.13
+++ common/util.c 8 Feb 2016 21:35:59 -0000
@@ -100,17 +100,17 @@ nonblank(SCR *sp, recno_t lno, size_t *c
* v_strdup --
* Strdup for wide character strings with an associated length.
*
- * PUBLIC: CHAR_T *v_strdup(SCR *, const CHAR_T *, size_t);
+ * PUBLIC: char *v_strdup(SCR *, const char *, size_t);
*/
-CHAR_T *
-v_strdup(SCR *sp, const CHAR_T *str, size_t len)
+char *
+v_strdup(SCR *sp, const char *str, size_t len)
{
- CHAR_T *copy;
+ char *copy;
MALLOC(sp, copy, len + 1);
if (copy == NULL)
return (NULL);
- memcpy(copy, str, len * sizeof(CHAR_T));
+ memcpy(copy, str, len * sizeof(*copy));
copy[len] = '\0';
return (copy);
}
Index: ex/ex.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex.h,v
retrieving revision 1.9
diff -u -p -r1.9 ex.h
--- ex/ex.h 19 Nov 2015 07:53:31 -0000 1.9
+++ ex/ex.h 8 Feb 2016 21:35:59 -0000
@@ -163,7 +163,7 @@ typedef struct _ex_private {
TAILQ_HEAD(_tagfh, _tagf) tagfq;/* Tag file list. */
char *tag_last; /* Saved last tag string. */
- CHAR_T *lastbcomm; /* Last bang command. */
+ char *lastbcomm; /* Last bang command. */
ARGS **args; /* Command: argument list. */
int argscnt; /* Command: argument list count. */
Index: ex/ex_abbrev.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_abbrev.c,v
retrieving revision 1.7
diff -u -p -r1.7 ex_abbrev.c
--- ex/ex_abbrev.c 6 Jan 2016 22:28:52 -0000 1.7
+++ ex/ex_abbrev.c 8 Feb 2016 21:35:59 -0000
@@ -34,7 +34,7 @@
int
ex_abbr(SCR *sp, EXCMD *cmdp)
{
- CHAR_T *p;
+ char *p;
size_t len;
switch (cmdp->argc) {
Index: ex/ex_append.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_append.c,v
retrieving revision 1.12
diff -u -p -r1.12 ex_append.c
--- ex/ex_append.c 6 Jan 2016 22:29:38 -0000 1.12
+++ ex/ex_append.c 8 Feb 2016 21:35:59 -0000
@@ -71,7 +71,7 @@ ex_insert(SCR *sp, EXCMD *cmdp)
static int
ex_aci(SCR *sp, EXCMD *cmdp, enum which cmd)
{
- CHAR_T *p, *t;
+ char *p, *t;
GS *gp;
TEXT *tp;
TEXTH tiq;
Index: ex/ex_argv.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_argv.c,v
retrieving revision 1.18
diff -u -p -r1.18 ex_argv.c
--- ex/ex_argv.c 6 Jan 2016 22:28:52 -0000 1.18
+++ ex/ex_argv.c 8 Feb 2016 21:35:59 -0000
@@ -425,7 +425,7 @@ argv_alloc(SCR *sp, size_t len)
ap->len = 0;
if (ap->blen < len + 1) {
ap->blen = len + 1;
- REALLOCARRAY(sp, ap->bp, ap->blen, sizeof(CHAR_T));
+ REALLOCARRAY(sp, ap->bp, ap->blen, sizeof(char));
if (ap->bp == NULL) {
ap->bp = NULL;
ap->blen = 0;
Index: ex/ex_display.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_display.c,v
retrieving revision 1.11
diff -u -p -r1.11 ex_display.c
--- ex/ex_display.c 6 Jan 2016 22:28:52 -0000 1.11
+++ ex/ex_display.c 8 Feb 2016 21:35:59 -0000
@@ -24,7 +24,7 @@
#include "tag.h"
static int bdisplay(SCR *);
-static void db(SCR *, CB *, CHAR_T *);
+static void db(SCR *, CB *, char *);
/*
* ex_display -- :display b[uffers] | s[creens] | t[ags]
@@ -107,9 +107,9 @@ bdisplay(SCR *sp)
* Display a buffer.
*/
static void
-db(SCR *sp, CB *cbp, CHAR_T *name)
+db(SCR *sp, CB *cbp, char *name)
{
- CHAR_T *p;
+ char *p;
TEXT *tp;
size_t len;
Index: ex/ex_file.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_file.c,v
retrieving revision 1.7
diff -u -p -r1.7 ex_file.c
--- ex/ex_file.c 12 Nov 2014 04:28:41 -0000 1.7
+++ ex/ex_file.c 8 Feb 2016 21:35:59 -0000
@@ -32,7 +32,7 @@
int
ex_file(SCR *sp, EXCMD *cmdp)
{
- CHAR_T *p;
+ char *p;
FREF *frp;
NEEDFILE(sp, cmdp);
Index: ex/ex_global.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_global.c,v
retrieving revision 1.15
diff -u -p -r1.15 ex_global.c
--- ex/ex_global.c 6 Jan 2016 22:28:52 -0000 1.15
+++ ex/ex_global.c 8 Feb 2016 21:35:59 -0000
@@ -61,7 +61,7 @@ ex_v(SCR *sp, EXCMD *cmdp)
static int
ex_g_setup(SCR *sp, EXCMD *cmdp, enum which cmd)
{
- CHAR_T *ptrn, *p, *t;
+ char *ptrn, *p, *t;
EXCMD *ecp;
MARK abs_mark;
RANGE *rp;
Index: ex/ex_map.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_map.c,v
retrieving revision 1.7
diff -u -p -r1.7 ex_map.c
--- ex/ex_map.c 6 Jan 2016 22:28:52 -0000 1.7
+++ ex/ex_map.c 8 Feb 2016 21:35:59 -0000
@@ -43,7 +43,7 @@ int
ex_map(SCR *sp, EXCMD *cmdp)
{
seq_t stype;
- CHAR_T *input, *p;
+ char *input, *p;
stype = FL_ISSET(cmdp->iflags, E_C_FORCE) ? SEQ_INPUT : SEQ_COMMAND;
Index: ex/ex_print.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_print.c,v
retrieving revision 1.11
diff -u -p -r1.11 ex_print.c
--- ex/ex_print.c 6 Jan 2016 22:29:38 -0000 1.11
+++ ex/ex_print.c 8 Feb 2016 21:35:59 -0000
@@ -196,7 +196,7 @@ static int
ex_prchars(SCR *sp, const char *p, size_t *colp, size_t len, u_int flags,
int repeatc)
{
- CHAR_T ch, *kp;
+ char ch, *kp;
size_t col, tlen, ts;
if (O_ISSET(sp, O_LIST))
Index: ex/ex_read.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_read.c,v
retrieving revision 1.11
diff -u -p -r1.11 ex_read.c
--- ex/ex_read.c 6 Jan 2016 22:28:52 -0000 1.11
+++ ex/ex_read.c 8 Feb 2016 21:35:59 -0000
@@ -42,7 +42,7 @@ ex_read(SCR *sp, EXCMD *cmdp)
{
enum { R_ARG, R_EXPANDARG, R_FILTER } which;
struct stat sb;
- CHAR_T *arg, *name;
+ char *arg, *name;
EX_PRIVATE *exp;
FILE *fp;
FREF *frp;
Index: ex/ex_script.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_script.c,v
retrieving revision 1.23
diff -u -p -r1.23 ex_script.c
--- ex/ex_script.c 6 Jan 2016 22:28:52 -0000 1.23
+++ ex/ex_script.c 8 Feb 2016 21:35:59 -0000
@@ -186,7 +186,7 @@ err: if (sc->sh_master != -1)
static int
sscr_getprompt(SCR *sp)
{
- CHAR_T *endp, *p, *t, buf[1024];
+ char *endp, *p, *t, buf[1024];
SCRIPT *sc;
struct pollfd pfd[1];
recno_t lline;
static int
sscr_insert(SCR *sp)
{
- CHAR_T *endp, *p, *t;
+ char *endp, *p, *t;
SCRIPT *sc;
struct pollfd pfd[1];
recno_t lno;
Index: ex/ex_tag.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_tag.c,v
retrieving revision 1.24
diff -u -p -r1.24 ex_tag.c
--- ex/ex_tag.c 6 Jan 2016 22:28:52 -0000 1.24
+++ ex/ex_tag.c 8 Feb 2016 21:35:59 -0000
@@ -1184,7 +1184,8 @@ ctag_file(SCR *sp, TAGF *tfp, char *name
#define GREATER 1
#define LESS (-1)
-#define SKIP_PAST_NEWLINE(p, back) while ((p) < (back) && *(p)++ != '\n');
+#define SKIP_PAST_NEWLINE(p, back) while ((p) < (back) && *(p)++ != '\n') \
+ ;
static char *
binary_search(char *string, char *front, char *back)
Index: include/cl_extern.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/include/cl_extern.h,v
retrieving revision 1.7
diff -u -p -r1.7 cl_extern.h
--- include/cl_extern.h 6 Nov 2014 10:48:52 -0000 1.7
+++ include/cl_extern.h 8 Feb 2016 21:35:59 -0000
@@ -22,7 +22,7 @@ int cl_quit(GS *);
int cl_getcap(SCR *, char *, char **);
int cl_term_init(SCR *);
int cl_term_end(GS *);
-int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
+int cl_fmap(SCR *, seq_t, char *, size_t, char *, size_t);
int cl_optchange(SCR *, int, char *, u_long *);
int cl_omesg(SCR *, CL_PRIVATE *, int);
int cl_ssize(SCR *, int, size_t *, size_t *, int *);
Index: include/com_extern.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/include/com_extern.h,v
retrieving revision 1.12
diff -u -p -r1.12 com_extern.h
--- include/com_extern.h 30 Jan 2016 21:31:08 -0000 1.12
+++ include/com_extern.h 8 Feb 2016 21:35:59 -0000
@@ -7,7 +7,7 @@ TEXT *text_init(SCR *, const char *, siz
void text_lfree(TEXTH *);
void text_free(TEXT *);
int del(SCR *, MARK *, MARK *, int);
-FREF *file_add(SCR *, CHAR_T *);
+FREF *file_add(SCR *, char *);
int file_init(SCR *, FREF *, char *, int);
int file_end(SCR *, EXF *, int);
int file_write(SCR *, MARK *, MARK *, char *, int);
@@ -19,10 +19,10 @@ void set_alt_name(SCR *, char *);
lockr_t file_lock(SCR *, char *, int *, int, int);
int v_key_init(SCR *);
void v_key_ilookup(SCR *);
-size_t v_key_len(SCR *, CHAR_T);
-CHAR_T *v_key_name(SCR *, CHAR_T);
+size_t v_key_len(SCR *, char);
+char *v_key_name(SCR *, char);
int v_key_val(SCR *, CHAR_T);
-int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int);
+int v_event_push(SCR *, EVENT *, char *, size_t, u_int);
int v_event_get(SCR *, EVENT *, int, u_int32_t);
void v_event_err(SCR *, EVENT *);
int v_event_flush(SCR *, u_int);
@@ -93,19 +93,19 @@ SCR *screen_next(SCR *);
int f_search(SCR *, MARK *, MARK *, char *, size_t, char **, u_int);
int b_search(SCR *, MARK *, MARK *, char *, size_t, char **, u_int);
void search_busy(SCR *, busy_t);
-int seq_set(SCR *, CHAR_T *,
- size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int);
-int seq_delete(SCR *, CHAR_T *, size_t, seq_t);
+int seq_set(SCR *, char *,
+ size_t, char *, size_t, char *, size_t, seq_t, int);
+int seq_delete(SCR *, char *, size_t, seq_t);
int seq_mdel(SEQ *);
SEQ *seq_find
-(SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *);
+(SCR *, SEQ **, EVENT *, char *, size_t, seq_t, int *);
void seq_close(GS *);
int seq_dump(SCR *, seq_t, int);
int seq_save(SCR *, FILE *, char *, seq_t);
-int e_memcmp(CHAR_T *, EVENT *, size_t);
+int e_memcmp(char *, EVENT *, size_t);
void *binc(SCR *, void *, size_t *, size_t);
int nonblank(SCR *, recno_t, size_t *);
-CHAR_T *v_strdup(SCR *, const CHAR_T *, size_t);
+char *v_strdup(SCR *, const char *, size_t);
enum nresult nget_uslong(u_long *, const char *, char **, int);
enum nresult nget_slong(long *, const char *, char **, int);
void TRACE(SCR *, const char *, ...);
Index: include/vi_extern.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/include/vi_extern.h,v
retrieving revision 1.9
diff -u -p -r1.9 vi_extern.h
--- include/vi_extern.h 20 Jan 2016 08:43:27 -0000 1.9
+++ include/vi_extern.h 8 Feb 2016 21:35:59 -0000
@@ -138,7 +138,7 @@ int vs_sm_position(SCR *, MARK *, u_long
recno_t vs_sm_nlines(SCR *, SMAP *, recno_t, size_t);
int vs_split(SCR *, SCR *, int);
int vs_discard(SCR *, SCR **);
-int vs_fg(SCR *, SCR **, CHAR_T *, int);
+int vs_fg(SCR *, SCR **, char *, int);
int vs_bg(SCR *);
int vs_swap(SCR *, SCR **, char *);
int vs_resize(SCR *, long, adj_t);
Index: vi/v_txt.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/vi/v_txt.c,v
retrieving revision 1.31
diff -u -p -r1.31 v_txt.c
--- vi/v_txt.c 20 Jan 2016 08:43:27 -0000 1.31
+++ vi/v_txt.c 8 Feb 2016 21:35:59 -0000
@@ -1434,7 +1434,7 @@ static int
txt_abbrev(SCR *sp, TEXT *tp, CHAR_T *pushcp, int isinfoline, int *didsubp,
int *turnoffp)
{
- CHAR_T ch, *p;
+ char ch, *p;
SEQ *qp;
size_t len, off;
@@ -2103,7 +2103,7 @@ static int
txt_fc_col(SCR *sp, int argc, ARGS **argv)
{
ARGS **av;
- CHAR_T *p;
+ char *p;
GS *gp;
size_t base, cnt, col, colwidth, numrows, numcols, prefix, row;
int ac, nf, reset;
@@ -2211,7 +2211,7 @@ intr: F_CLR(gp, G_INTERRUPTED);
static int
txt_emark(SCR *sp, TEXT *tp, size_t cno)
{
- CHAR_T ch, *kp;
+ char ch, *kp;
size_t chlen, nlen, olen;
char *p;
@@ -2372,7 +2372,7 @@ nothex: tp->lb[tp->cno] = savec;
static int
txt_insch(SCR *sp, TEXT *tp, CHAR_T *chp, u_int flags)
{
- CHAR_T *kp, savech;
+ char *kp, savech;
size_t chlen, cno, copydown, olen, nlen;
char *p;
Index: vi/v_ulcase.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/vi/v_ulcase.c,v
retrieving revision 1.8
diff -u -p -r1.8 v_ulcase.c
--- vi/v_ulcase.c 12 Nov 2014 04:28:41 -0000 1.8
+++ vi/v_ulcase.c 8 Feb 2016 21:35:59 -0000
@@ -26,7 +26,7 @@
#include "../common/common.h"
#include "vi.h"
-static int ulcase(SCR *, recno_t, CHAR_T *, size_t, size_t, size_t);
+static int ulcase(SCR *, recno_t, char *, size_t, size_t, size_t);
/*
* v_ulcase -- [count]~
@@ -105,7 +105,7 @@ v_ulcase(SCR *sp, VICMD *vp)
int
v_mulcase(SCR *sp, VICMD *vp)
{
- CHAR_T *p;
+ char *p;
size_t len;
recno_t lno;
@@ -139,11 +139,11 @@ v_mulcase(SCR *sp, VICMD *vp)
* Change part of a line's case.
*/
static int
-ulcase(SCR *sp, recno_t lno, CHAR_T *lp, size_t len, size_t scno, size_t ecno)
+ulcase(SCR *sp, recno_t lno, char *lp, size_t len, size_t scno, size_t ecno)
{
size_t blen;
int change, rval;
- CHAR_T ch, *p, *t;
+ char ch, *p, *t;
char *bp;
GET_SPACE_RET(sp, bp, blen, len);
Index: vi/vi.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/vi/vi.c,v
retrieving revision 1.18
diff -u -p -r1.18 vi.c
--- vi/vi.c 20 Jan 2016 08:43:27 -0000 1.18
+++ vi/vi.c 8 Feb 2016 21:35:59 -0000
@@ -1085,7 +1085,7 @@ v_keyword(SCR *sp)
static VIKEYS const *
v_alias(SCR *sp, VICMD *vp, VIKEYS const *kp)
{
- CHAR_T push;
+ char push;
switch (vp->key) {
case 'C': /* C -> c$ */
Index: vi/vi.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/vi/vi.h,v
retrieving revision 1.9
diff -u -p -r1.9 vi.h
--- vi/vi.h 3 Dec 2015 08:13:15 -0000 1.9
+++ vi/vi.h 8 Feb 2016 21:35:59 -0000
@@ -153,9 +153,9 @@ extern VIKEYS const tmotion; /* XXX Hac
typedef struct _vcs {
recno_t cs_lno; /* Line. */
size_t cs_cno; /* Column. */
- CHAR_T *cs_bp; /* Buffer. */
+ char *cs_bp; /* Buffer. */
size_t cs_len; /* Length. */
- CHAR_T cs_ch; /* Character. */
+ char cs_ch; /* Character. */
#define CS_EMP 1 /* Empty line. */
#define CS_EOF 2 /* End-of-file. */
#define CS_EOL 3 /* End-of-line. */
@@ -233,7 +233,7 @@ typedef struct _vi_private {
VICMD sdot; /* Saved dot, motion command. */
VICMD sdotmotion;
- CHAR_T *keyw; /* Keyword buffer. */
+ char *keyw; /* Keyword buffer. */
size_t klen; /* Keyword length. */
size_t keywlen; /* Keyword buffer length. */
Index: vi/vs_line.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/vi/vs_line.c,v
retrieving revision 1.14
diff -u -p -r1.14 vs_line.c
--- vi/vs_line.c 12 Nov 2014 04:28:41 -0000 1.14
+++ vi/vs_line.c 8 Feb 2016 21:36:00 -0000
@@ -38,7 +38,7 @@
int
vs_line(SCR *sp, SMAP *smp, size_t *yp, size_t *xp)
{
- CHAR_T *kp;
+ char *kp;
GS *gp;
SMAP *tsmp;
size_t chlen = 0, cno_cnt, cols_per_screen, len, nlen;
Index: vi/vs_msg.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/vi/vs_msg.c,v
retrieving revision 1.16
diff -u -p -r1.16 vs_msg.c
--- vi/vs_msg.c 6 Jan 2016 22:29:38 -0000 1.16
+++ vi/vs_msg.c 8 Feb 2016 21:36:00 -0000
@@ -393,7 +393,7 @@ ret: (void)gp->scr_move(sp, oldy, oldx);
static void
vs_output(SCR *sp, mtype_t mtype, const char *line, int llen)
{
- CHAR_T *kp;
+ char *kp;
GS *gp;
VI_PRIVATE *vip;
size_t chlen, notused;
Index: vi/vs_split.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/vi/vs_split.c,v
retrieving revision 1.14
diff -u -p -r1.14 vs_split.c
--- vi/vs_split.c 6 Jan 2016 22:28:52 -0000 1.14
+++ vi/vs_split.c 8 Feb 2016 21:36:00 -0000
@@ -278,10 +278,10 @@ vs_discard(SCR *sp, SCR **spp)
* vs_fg --
* Background the current screen, and foreground a new one.
*
- * PUBLIC: int vs_fg(SCR *, SCR **, CHAR_T *, int);
+ * PUBLIC: int vs_fg(SCR *, SCR **, char *, int);
*/
int
-vs_fg(SCR *sp, SCR **nspp, CHAR_T *name, int newscreen)
+vs_fg(SCR *sp, SCR **nspp, char *name, int newscreen)
{
GS *gp;
SCR *nsp;
Michael McConville
2016-02-09 00:43:23 UTC
Permalink
Post by Jonathan Gray
I don't think we should enable -pedantic anywhere in the tree.
Different versions of gcc are going to have different ideas of what
pedantic is.
This was my reaction too. I like the approach of keeping few to no
warnings in default builds. It's easy to "env CFLAGS='-Wextra -pedantic'
make" when you're auditing.
Post by Jonathan Gray
I'm not sold on the value of all these patches to nvi when it is
possibly hindering people who may be looking to add utf-8 support (via
nvi2 or otherwise).
I think that vi is enough of a mess to warrant this. Most of these
patches are getting accepted upstream, too. I'm no longer actively
upstreaming, but I think Martijn and Michael Reed are.

Loading...