CVS commit: src/usr.bin/xlint/common

2024-01-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 20 10:25:57 UTC 2024

Modified Files:
src/usr.bin/xlint/common: externs.h inittyp.c lint.h mem.c tyname.c

Log Message:
lint: unclutter conditional compilation


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.32 src/usr.bin/xlint/common/externs.h:1.33
--- src/usr.bin/xlint/common/externs.h:1.32	Sat Jan 20 10:21:35 2024
+++ src/usr.bin/xlint/common/externs.h	Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.32 2024/01/20 10:21:35 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.33 2024/01/20 10:25:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -34,7 +34,7 @@
 /*
  * tyname.c
  */
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
 const char *type_name(const type_t *);
 const char *tspec_name(tspec_t);
 #endif
@@ -43,7 +43,7 @@ const char *tspec_name(tspec_t);
  * mem.c
  */
 void *xmalloc(size_t);
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
 void *xcalloc(size_t, size_t);
 #endif
 void *xrealloc(void *, size_t);
@@ -53,7 +53,7 @@ char *xasprintf(const char *, ...) __pri
 /*
  * emit.c
  */
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
 void outopen(const char *);
 void outclose(void);
 void outchar(char);

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.41 src/usr.bin/xlint/common/inittyp.c:1.42
--- src/usr.bin/xlint/common/inittyp.c:1.41	Sun Dec  3 18:17:41 2023
+++ src/usr.bin/xlint/common/inittyp.c	Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.41 2023/12/03 18:17:41 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.42 2024/01/20 10:25:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,10 +37,10 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: inittyp.c,v 1.41 2023/12/03 18:17:41 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.42 2024/01/20 10:25:57 rillig Exp $");
 #endif
 
-#if defined(IS_LINT1)
+#if IS_LINT1
 #include "lint1.h"
 #else
 #include "lint2.h"
@@ -48,7 +48,7 @@ __RCSID("$NetBSD: inittyp.c,v 1.41 2023/
 
 #define INT_RANK	(/*CONSTCOND*/INTPTR_TSPEC == LONG ? 4 : 5)
 
-#ifdef IS_LINT1
+#if IS_LINT1
 #define typeinfo(name, signed_type, unsigned_type, size_in_bits, rv, c) \
 	{ /*CONSTCOND*/ \
 		size_in_bits, \

Index: src/usr.bin/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.46 src/usr.bin/xlint/common/lint.h:1.47
--- src/usr.bin/xlint/common/lint.h:1.46	Sun Dec  3 18:17:41 2023
+++ src/usr.bin/xlint/common/lint.h	Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.46 2023/12/03 18:17:41 rillig Exp $	*/
+/*	$NetBSD: lint.h,v 1.47 2024/01/20 10:25:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -47,7 +47,7 @@
 
 #include "param.h"
 
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
 /*
  * Type specifiers, used in type structures (type_t) and elsewhere.
  */
@@ -93,7 +93,7 @@ typedef enum {
  * size of types, name and classification
  */
 typedef struct {
-#ifdef IS_LINT1
+#if IS_LINT1
 	unsigned int tt_size_in_bits;
 	enum rank_kind {
 		RK_NONE,
@@ -107,7 +107,7 @@ typedef struct {
 	tspec_t	tt_signed_counterpart;
 	tspec_t	tt_unsigned_counterpart;
 	bool	tt_is_integer:1;	/* integer type */
-#ifdef IS_LINT1
+#if IS_LINT1
 	bool	tt_is_uinteger:1;	/* unsigned integer type */
 	bool	tt_is_floating:1;	/* floating point type */
 	bool	tt_is_arithmetic:1;	/* arithmetic type */
@@ -145,7 +145,7 @@ typedef enum {
 	DEF			/* defined */
 } def_t;
 
-#if defined(IS_LINT1)
+#if IS_LINT1
 typedef struct lint1_type type_t;
 #else
 typedef struct lint2_type type_t;

Index: src/usr.bin/xlint/common/mem.c
diff -u src/usr.bin/xlint/common/mem.c:1.23 src/usr.bin/xlint/common/mem.c:1.24
--- src/usr.bin/xlint/common/mem.c:1.23	Sat Jan 20 10:21:35 2024
+++ src/usr.bin/xlint/common/mem.c	Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.23 2024/01/20 10:21:35 rillig Exp $	*/
+/*	$NetBSD: mem.c,v 1.24 2024/01/20 10:25:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: mem.c,v 1.23 2024/01/20 10:21:35 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.24 2024/01/20 10:25:57 rillig Exp $");
 #endif
 
 #include 
@@ -62,7 +62,7 @@ xmalloc(size_t s)
 	return not_null(malloc(s));
 }
 
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
 void *
 xcalloc(size_t n, size_t s)
 {

Index: 

CVS commit: src/usr.bin/xlint/common

2024-01-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 20 10:25:57 UTC 2024

Modified Files:
src/usr.bin/xlint/common: externs.h inittyp.c lint.h mem.c tyname.c

Log Message:
lint: unclutter conditional compilation


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2024-01-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 20 10:21:35 UTC 2024

Modified Files:
src/usr.bin/xlint/common: externs.h mem.c

Log Message:
lint: only define xcalloc if actually used


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/mem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.31 src/usr.bin/xlint/common/externs.h:1.32
--- src/usr.bin/xlint/common/externs.h:1.31	Sun Dec  3 18:17:41 2023
+++ src/usr.bin/xlint/common/externs.h	Sat Jan 20 10:21:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.31 2023/12/03 18:17:41 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.32 2024/01/20 10:21:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -43,7 +43,9 @@ const char *tspec_name(tspec_t);
  * mem.c
  */
 void *xmalloc(size_t);
+#if defined(IS_LINT1) || defined(IS_LINT2)
 void *xcalloc(size_t, size_t);
+#endif
 void *xrealloc(void *, size_t);
 char *xstrdup(const char *);
 char *xasprintf(const char *, ...) __printflike(1, 2);

Index: src/usr.bin/xlint/common/mem.c
diff -u src/usr.bin/xlint/common/mem.c:1.22 src/usr.bin/xlint/common/mem.c:1.23
--- src/usr.bin/xlint/common/mem.c:1.22	Thu Jul 13 08:40:38 2023
+++ src/usr.bin/xlint/common/mem.c	Sat Jan 20 10:21:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.22 2023/07/13 08:40:38 rillig Exp $	*/
+/*	$NetBSD: mem.c,v 1.23 2024/01/20 10:21:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: mem.c,v 1.22 2023/07/13 08:40:38 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.23 2024/01/20 10:21:35 rillig Exp $");
 #endif
 
 #include 
@@ -62,12 +62,14 @@ xmalloc(size_t s)
 	return not_null(malloc(s));
 }
 
+#if defined(IS_LINT1) || defined(IS_LINT2)
 void *
 xcalloc(size_t n, size_t s)
 {
 
 	return not_null(calloc(n, s));
 }
+#endif
 
 void *
 xrealloc(void *p, size_t s)



CVS commit: src/usr.bin/xlint/common

2024-01-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 20 10:21:35 UTC 2024

Modified Files:
src/usr.bin/xlint/common: externs.h mem.c

Log Message:
lint: only define xcalloc if actually used


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/mem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2023-08-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 12 17:13:28 UTC 2023

Modified Files:
src/usr.bin/xlint/common: emit.c

Log Message:
lint: remove unnecessary double-buffering for output files


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/emit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2023-08-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 12 17:13:28 UTC 2023

Modified Files:
src/usr.bin/xlint/common: emit.c

Log Message:
lint: remove unnecessary double-buffering for output files


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/emit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/emit.c
diff -u src/usr.bin/xlint/common/emit.c:1.22 src/usr.bin/xlint/common/emit.c:1.23
--- src/usr.bin/xlint/common/emit.c:1.22	Thu Jul 13 08:40:38 2023
+++ src/usr.bin/xlint/common/emit.c	Sat Aug 12 17:13:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: emit.c,v 1.22 2023/07/13 08:40:38 rillig Exp $	*/
+/*	$NetBSD: emit.c,v 1.23 2023/08/12 17:13:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: emit.c,v 1.22 2023/07/13 08:40:38 rillig Exp $");
+__RCSID("$NetBSD: emit.c,v 1.23 2023/08/12 17:13:27 rillig Exp $");
 #endif
 
 #include 
@@ -45,121 +45,71 @@ __RCSID("$NetBSD: emit.c,v 1.22 2023/07/
 
 #include "lint.h"
 
-/* name and handle of output file */
-static	const	char *loname;
-static	FILE	*lout;
+static const char *output_name;
+static FILE *output_file;
+static bool in_line;
 
-/* output buffer data */
-static	ob_t	ob;
-
-static	void	outxbuf(void);
-
-
-/*
- * initialize output
- */
 void
 outopen(const char *name)
 {
 
-	loname = name;
-
-	/* Open output file */
-	if ((lout = fopen(name, "w")) == NULL)
+	output_name = name;
+	if ((output_file = fopen(name, "w")) == NULL)
 		err(1, "cannot open '%s'", name);
-
-	/* Create output buffer */
-	ob.o_len = 1024;
-	ob.o_end = (ob.o_buf = ob.o_next = xmalloc(ob.o_len)) + ob.o_len;
 }
 
-/*
- * flush output buffer and close file
- */
 void
 outclose(void)
 {
 
 	outclr();
-	if (fclose(lout) == EOF)
-		err(1, "cannot close '%s'", loname);
-}
-
-/*
- * resize output buffer
- */
-static void
-outxbuf(void)
-{
-
-	size_t next = (size_t)(ob.o_next - ob.o_buf);
-	ob.o_len *= 2;
-	ob.o_buf = xrealloc(ob.o_buf, ob.o_len);
-	ob.o_end = ob.o_buf + ob.o_len;
-	ob.o_next = ob.o_buf + next;
+	if (fclose(output_file) == EOF)
+		err(1, "cannot close '%s'", output_name);
 }
 
-/*
- * reset output buffer
- * if it is not empty, it is flushed
- */
 void
 outclr(void)
 {
 
-	if (ob.o_buf != ob.o_next) {
+	if (in_line)
 		outchar('\n');
-		size_t sz = (size_t)(ob.o_next - ob.o_buf);
-		if (sz > ob.o_len)
-			errx(1, "internal error: outclr");
-		if (fwrite(ob.o_buf, sz, 1, lout) != 1)
-			err(1, "cannot write to %s", loname);
-		ob.o_next = ob.o_buf;
-	}
 }
 
-/*
- * write a character to the output buffer
- */
 void
 outchar(char c)
 {
 
-	if (ob.o_next == ob.o_end)
-		outxbuf();
-	*ob.o_next++ = c;
+	fputc(c, output_file);
+	in_line = c != '\n';
 }
 
 /*
- * write a string to the output buffer
- * the string must not contain any characters which
- * should be quoted
+ * write a string to the output file
+ * the string must not contain any characters which should be quoted
  */
 void
 outstrg(const char *s)
 {
 
-	while (*s != '\0') {
-		if (ob.o_next == ob.o_end)
-			outxbuf();
-		*ob.o_next++ = *s++;
-	}
+	while (*s != '\0')
+		outchar(*s++);
 }
 
-/* write an integer value to the output buffer */
+/* write an integer value to the output file */
 void
 outint(int i)
 {
+	char buf[1 + 3 * sizeof(int)];
 
-	if ((size_t)(ob.o_end - ob.o_next) < 3 * sizeof(int))
-		outxbuf();
-	ob.o_next += snprintf(ob.o_next, ob.o_end - ob.o_next, "%d", i);
+	snprintf(buf, sizeof(buf), "%d", i);
+	outstrg(buf);
 }
 
-/* write a name to the output buffer, preceded by its length */
+/* write a name to the output file, preceded by its length */
 void
 outname(const char *name)
 {
+
 	outint((int)strlen(name));
 	outstrg(name);
 }



CVS commit: src/usr.bin/xlint/common

2023-07-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul  6 07:59:00 UTC 2023

Modified Files:
src/usr.bin/xlint/common: externs.h lint.h

Log Message:
lint: add type safety for accessing properties of basic types

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/xlint/common/lint.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.27 src/usr.bin/xlint/common/externs.h:1.28
--- src/usr.bin/xlint/common/externs.h:1.27	Thu Jun 29 10:31:32 2023
+++ src/usr.bin/xlint/common/externs.h	Thu Jul  6 07:59:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.27 2023/06/29 10:31:32 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.28 2023/07/06 07:59:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -34,8 +34,10 @@
 /*
  * tyname.c
  */
+#if defined(IS_LINT1) || defined(IS_LINT2)
 const char *type_name(const type_t *);
-const	char *tspec_name(tspec_t);
+const char *tspec_name(tspec_t);
+#endif
 
 /*
  * mem.c

Index: src/usr.bin/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.38 src/usr.bin/xlint/common/lint.h:1.39
--- src/usr.bin/xlint/common/lint.h:1.38	Mon Jul  3 07:03:19 2023
+++ src/usr.bin/xlint/common/lint.h	Thu Jul  6 07:59:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.38 2023/07/03 07:03:19 rillig Exp $	*/
+/*	$NetBSD: lint.h,v 1.39 2023/07/06 07:59:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -47,6 +47,7 @@
 
 #include "param.h"
 
+#if defined(IS_LINT1) || defined(IS_LINT2)
 /*
  * Type specifiers, used in type structures (type_t) and elsewhere.
  */
@@ -110,20 +111,23 @@ typedef	struct {
 	const char *tt_name;		/* name of the type */
 } ttab_t;
 
-#define size_in_bits(t)		(ttab[t].tt_size_in_bits)
-#define portable_size_in_bits(t) (ttab[t].tt_portable_size_in_bits)
-#define signed_type(t)		(ttab[t].tt_signed_counterpart)
-#define unsigned_type(t)	(ttab[t].tt_unsigned_counterpart)
-#define is_integer(t)		(ttab[t].tt_is_integer)
-#define is_uinteger(t)		(ttab[t].tt_is_uinteger)
-#define is_floating(t)		(ttab[t].tt_is_floating)
-#define is_arithmetic(t)	(ttab[t].tt_is_arithmetic)
-#define is_complex(t)		(ttab[t].tt_is_complex)
-#define is_scalar(t)		(ttab[t].tt_is_scalar)
-
-#if defined(IS_LINT1) || defined(IS_LINT2)
 extern	ttab_t	ttab[];
-#endif
+
+static inline const ttab_t *
+type_properties(tspec_t t) {
+	return ttab + t;
+}
+
+#define size_in_bits(t)		(type_properties(t)->tt_size_in_bits)
+#define portable_size_in_bits(t) (type_properties(t)->tt_portable_size_in_bits)
+#define signed_type(t)		(type_properties(t)->tt_signed_counterpart)
+#define unsigned_type(t)	(type_properties(t)->tt_unsigned_counterpart)
+#define is_integer(t)		(type_properties(t)->tt_is_integer)
+#define is_uinteger(t)		(type_properties(t)->tt_is_uinteger)
+#define is_floating(t)		(type_properties(t)->tt_is_floating)
+#define is_arithmetic(t)	(type_properties(t)->tt_is_arithmetic)
+#define is_complex(t)		(type_properties(t)->tt_is_complex)
+#define is_scalar(t)		(type_properties(t)->tt_is_scalar)
 
 
 typedef	enum {
@@ -146,6 +150,7 @@ typedef struct lint1_type type_t;
 #else
 typedef struct lint2_type type_t;
 #endif
+#endif
 
 #include "externs.h"
 



CVS commit: src/usr.bin/xlint/common

2023-07-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul  6 07:59:00 UTC 2023

Modified Files:
src/usr.bin/xlint/common: externs.h lint.h

Log Message:
lint: add type safety for accessing properties of basic types

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/xlint/common/lint.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2022-11-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Nov 30 20:50:22 UTC 2022

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: make definitions of basic types simpler

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/common/inittyp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.32 src/usr.bin/xlint/common/inittyp.c:1.33
--- src/usr.bin/xlint/common/inittyp.c:1.32	Fri Jul  8 21:19:06 2022
+++ src/usr.bin/xlint/common/inittyp.c	Wed Nov 30 20:50:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.32 2022/07/08 21:19:06 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.33 2022/11/30 20:50:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: inittyp.c,v 1.32 2022/07/08 21:19:06 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.33 2022/11/30 20:50:22 rillig Exp $");
 #endif
 
 #if defined(IS_LINT1)
@@ -52,89 +52,75 @@ __RCSID("$NetBSD: inittyp.c,v 1.32 2022/
 #define typeinfo( \
 	name, signed_type, unsigned_type, \
 	size_in_bits, portable_size_in_bits, \
-	is_integer, is_unsigned, is_floating, is_arithmetic, \
-	is_scalar, is_complex) \
-	{ \
+	c) \
+	{ /*CONSTCOND*/ \
 		size_in_bits, portable_size_in_bits, \
 		signed_type, unsigned_type, \
-		(is_integer) > 0, (is_unsigned) > 0, (is_floating) > 0, \
-		(is_arithmetic) > 0, (is_scalar) > 0, (is_complex) > 0, \
+		(c) == 's' || (c) == 'u', \
+		(c) == 'u' || (c) == 'p', \
+		(c) == 'f' || (c) == 'c', \
+		(c) == 's' || (c) == 'u' || (c) == 'f' || \
+		(c) == 'c', \
+		(c) == 's' || (c) == 'u' || (c) == 'f' || \
+		(c) == 'c' || (c) == 'p', \
+		(c) == 'c', \
 		name, \
 	}
 #else
 #define typeinfo( \
 	name, signed_type, unsigned_type, \
 	size_in_bits, portable_size_in_bits, \
-	is_integer, is_unsigned, is_floating, is_arithmetic, \
-	is_scalar, is_complex) \
-	{ \
+	c) \
+	{ /*CONSTCOND*/ \
 		signed_type, unsigned_type, \
-		(is_integer) > 0, \
+		(c) == 's' || (c) == 'u', \
 		name, \
 	}
 #endif
 
 /* various type information */
 ttab_t	ttab[NTSPEC] = {
-	typeinfo(NULL, NOTSPEC, NOTSPEC, 0, 0, 0, 0, 0, 0, 0, 0),
-	typeinfo("signed", SIGNED, UNSIGN, 0, 0, 0, 0, 0, 0, 0, 0),
-	typeinfo("unsigned", SIGNED, UNSIGN, 0, 0, 0, 0, 0, 0, 0, 0),
-	typeinfo("_Bool", BOOL, BOOL, CHAR_SIZE,
-	1, 1, 1, 0, 1, 1, 0),
+	typeinfo(NULL, NOTSPEC, NOTSPEC, 0, 0, ' '),
+	typeinfo("signed", SIGNED, UNSIGN, 0, 0, ' '),
+	typeinfo("unsigned", SIGNED, UNSIGN, 0, 0, ' '),
+	typeinfo("_Bool", BOOL, BOOL, CHAR_SIZE, 1, 'u'),
 	typeinfo("char", SCHAR, UCHAR, CHAR_SIZE, 8,
-	1, /*CONSTCOND*/ TARG_CHAR_MIN == 0 ? 1 : 0, 0, 1, 1, 0),
-	typeinfo("signed char", SCHAR, UCHAR, CHAR_SIZE, 8,
-	1, 0, 0, 1, 1, 0),
-	typeinfo("unsigned char", SCHAR, UCHAR, CHAR_SIZE, 8,
-	1, 1, 0, 1, 1, 0),
-	typeinfo("short", SHORT, USHORT, SHORT_SIZE, 16,
-	1, 0, 0, 1, 1, 0),
-	typeinfo("unsigned short", SHORT, USHORT, SHORT_SIZE, 16,
-	1, 1, 0, 1, 1, 0),
-	typeinfo("int", INT, UINT, INT_SIZE, INT_RSIZE * 8,
-	1, 0, 0, 1, 1, 0),
-	typeinfo("unsigned int", INT, UINT, INT_SIZE, INT_RSIZE * 8,
-	1, 1, 0, 1, 1, 0),
-	typeinfo("long", LONG, ULONG, LONG_SIZE, 32,
-	1, 0, 0, 1, 1, 0),
-	typeinfo("unsigned long", LONG, ULONG, LONG_SIZE, 32,
-	1, 1, 0, 1, 1, 0),
-	typeinfo("long long", QUAD, UQUAD, QUAD_SIZE, 64,
-	1, 0, 0, 1, 1, 0),
-	typeinfo("unsigned long long", QUAD, UQUAD, QUAD_SIZE, 64,
-	1, 1, 0, 1, 1, 0),
+	TARG_CHAR_MIN == 0 ? 'u' : 's'),
+	typeinfo("signed char", SCHAR, UCHAR, CHAR_SIZE, 8, 's'),
+	typeinfo("unsigned char", SCHAR, UCHAR, CHAR_SIZE, 8, 'u'),
+	typeinfo("short", SHORT, USHORT, SHORT_SIZE, 16, 's'),
+	typeinfo("unsigned short", SHORT, USHORT, SHORT_SIZE, 16, 'u'),
+	typeinfo("int", INT, UINT, INT_SIZE, INT_RSIZE * 8, 's'),
+	typeinfo("unsigned int", INT, UINT, INT_SIZE, INT_RSIZE * 8, 'u'),
+	typeinfo("long", LONG, ULONG, LONG_SIZE, 32, 's'),
+	typeinfo("unsigned long", LONG, ULONG, LONG_SIZE, 32, 'u'),
+	typeinfo("long long", QUAD, UQUAD, QUAD_SIZE, 64, 's'),
+	typeinfo("unsigned long long", QUAD, UQUAD, QUAD_SIZE, 64, 'u'),
 #ifdef INT128_SIZE
-	typeinfo("__int128_t", INT128, UINT128, INT128_SIZE, 128,
-	1, 0, 0, 1, 1, 0),
-	typeinfo("__uint128_t", INT128, UINT128, INT128_SIZE, 128,
-	1, 1, 0, 1, 1, 0),
-#endif
-	typeinfo("float", FLOAT, FLOAT, FLOAT_SIZE, 32,
-	0, 0, 1, 1, 1, 0),
-	typeinfo("double", DOUBLE, DOUBLE, DOUBLE_SIZE, 64,
-	0, 0, 1, 1, 1, 0),
-	typeinfo("long double", LDOUBLE, LDOUBLE, LDOUBLE_SIZE, 80,
-	0, 0, 1, 1, 1, 0),
-	typeinfo("void", VOID, VOID, 0, 0, 0, 0, 0, 0, 0, 0),
-	typeinfo("struct", STRUCT, STRUCT, 0, 0, 0, 0, 0, 0, 0, 0),
-	typeinfo("union", UNION, UNION, 0, 0, 0, 0, 0, 0, 0, 0),
-	typeinfo("enum", ENUM, 

CVS commit: src/usr.bin/xlint/common

2022-11-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Nov 30 20:50:22 UTC 2022

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: make definitions of basic types simpler

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/common/inittyp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-09-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep  4 15:39:41 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: make initialization of the basic types table simpler

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/xlint/common/inittyp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.28 src/usr.bin/xlint/common/inittyp.c:1.29
--- src/usr.bin/xlint/common/inittyp.c:1.28	Sat Sep  4 14:07:51 2021
+++ src/usr.bin/xlint/common/inittyp.c	Sat Sep  4 15:39:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.28 2021/09/04 14:07:51 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.29 2021/09/04 15:39:41 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.28 2021/09/04 14:07:51 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.29 2021/09/04 15:39:41 rillig Exp $");
 #endif
 
 #if defined(IS_LINT1)
@@ -46,103 +46,92 @@ __RCSID("$NetBSD: inittyp.c,v 1.28 2021/
 #include "lint2.h"
 #endif
 
-/* various type information */
-ttab_t	ttab[NTSPEC];
-
 #define INT_RSIZE	(/*CONSTCOND*/INTPTR_TSPEC == LONG ? 3 : 4)
 
-void
-inittyp(void)
-{
-	size_t	i;
-	static const struct {
-		tspec_t	it_tspec;
-		ttab_t	it_ttab;
-	} ittab[NTSPEC] = {
 #define typeinfo( \
-	tspec, signed_type, unsigned_type, \
+	name, signed_type, unsigned_type, \
 	size_in_bits, portable_size_in_bits, \
-	in, un, fl, ar, sc, co, name) \
+	is_integer, is_unsigned, is_floating, is_arithmetic, \
+	is_scalar, is_complex) \
 	{ \
-	tspec, { \
 		size_in_bits, portable_size_in_bits, \
 		signed_type, unsigned_type, \
-		(in) > 0, (un) > 0, (fl) > 0, (ar) > 0, (sc) > 0, (co) > 0, \
+		(is_integer) > 0, (is_unsigned) > 0, (is_floating) > 0, \
+		(is_arithmetic) > 0, (is_scalar) > 0, (is_complex) > 0, \
 		name, \
-	} \
 	}
-		typeinfo(SIGNED, SIGNED, UNSIGN, 0, 0,
-		0, 0, 0, 0, 0, 0, "signed"),
-		typeinfo(UNSIGN, SIGNED, UNSIGN, 0, 0,
-		0, 0, 0, 0, 0, 0, "unsigned"),
-		typeinfo(BOOL, BOOL, BOOL, CHAR_SIZE, 1,
-		1, 1, 0, 1, 1, 0, "_Bool"),
-		typeinfo(CHAR, SCHAR, UCHAR, CHAR_SIZE, 8,
-		1, /*CONSTCOND*/ TARG_CHAR_MIN == 0 ? 1 : 0,
-		/* */ 0, 1, 1, 0, "char"),
-		typeinfo(SCHAR, SCHAR, UCHAR, CHAR_SIZE, 8,
-		1, 0, 0, 1, 1, 0, "signed char"),
-		typeinfo(UCHAR, SCHAR, UCHAR, CHAR_SIZE, 8,
-		1, 1, 0, 1, 1, 0, "unsigned char"),
-		typeinfo(SHORT, SHORT, USHORT, SHORT_SIZE, 16,
-		1, 0, 0, 1, 1, 0, "short"),
-		typeinfo(USHORT, SHORT, USHORT, SHORT_SIZE, 16,
-		1, 1, 0, 1, 1, 0, "unsigned short"),
-		typeinfo(INT, INT, UINT, INT_SIZE, INT_RSIZE * 8,
-		1, 0, 0, 1, 1, 0, "int"),
-		typeinfo(UINT, INT, UINT, INT_SIZE, INT_RSIZE * 8,
-		1, 1, 0, 1, 1, 0, "unsigned int"),
-		typeinfo(LONG, LONG, ULONG, LONG_SIZE, 32,
-		1, 0, 0, 1, 1, 0, "long"),
-		typeinfo(ULONG, LONG, ULONG, LONG_SIZE, 32,
-		1, 1, 0, 1, 1, 0, "unsigned long"),
-		typeinfo(QUAD, QUAD, UQUAD, QUAD_SIZE, 64,
-		1, 0, 0, 1, 1, 0, "long long"),
-		typeinfo(UQUAD, QUAD, UQUAD, QUAD_SIZE, 64,
-		1, 1, 0, 1, 1, 0, "unsigned long long"),
+
+/* various type information */
+ttab_t	ttab[NTSPEC] = {
+	typeinfo(NULL, NOTSPEC, NOTSPEC, 0, 0, 0, 0, 0, 0, 0, 0),
+	typeinfo("signed", SIGNED, UNSIGN, 0, 0, 0, 0, 0, 0, 0, 0),
+	typeinfo("unsigned", SIGNED, UNSIGN, 0, 0, 0, 0, 0, 0, 0, 0),
+	typeinfo("_Bool", BOOL, BOOL, CHAR_SIZE,
+	1, 1, 1, 0, 1, 1, 0),
+	typeinfo("char", SCHAR, UCHAR, CHAR_SIZE, 8,
+	1, /*CONSTCOND*/ TARG_CHAR_MIN == 0 ? 1 : 0, 0, 1, 1, 0),
+	typeinfo("signed char", SCHAR, UCHAR, CHAR_SIZE, 8,
+	1, 0, 0, 1, 1, 0),
+	typeinfo("unsigned char", SCHAR, UCHAR, CHAR_SIZE, 8,
+	1, 1, 0, 1, 1, 0),
+	typeinfo("short", SHORT, USHORT, SHORT_SIZE, 16,
+	1, 0, 0, 1, 1, 0),
+	typeinfo("unsigned short", SHORT, USHORT, SHORT_SIZE, 16,
+	1, 1, 0, 1, 1, 0),
+	typeinfo("int", INT, UINT, INT_SIZE, INT_RSIZE * 8,
+	1, 0, 0, 1, 1, 0),
+	typeinfo("unsigned int", INT, UINT, INT_SIZE, INT_RSIZE * 8,
+	1, 1, 0, 1, 1, 0),
+	typeinfo("long", LONG, ULONG, LONG_SIZE, 32,
+	1, 0, 0, 1, 1, 0),
+	typeinfo("unsigned long", LONG, ULONG, LONG_SIZE, 32,
+	1, 1, 0, 1, 1, 0),
+	typeinfo("long long", QUAD, UQUAD, QUAD_SIZE, 64,
+	1, 0, 0, 1, 1, 0),
+	typeinfo("unsigned long long", QUAD, UQUAD, QUAD_SIZE, 64,
+	1, 1, 0, 1, 1, 0),
 #ifdef INT128_SIZE
-		typeinfo(INT128, INT128, UINT128, INT128_SIZE, 128,
-		1, 0, 0, 1, 1, 0, "__int128_t"),
-		typeinfo(UINT128, INT128, UINT128, INT128_SIZE, 128,
-		1, 1, 0, 1, 1, 0, "__uint128_t"),
+	typeinfo("__int128_t", INT128, UINT128, INT128_SIZE, 128,
+	1, 0, 0, 1, 1, 0),
+	typeinfo("__uint128_t", INT128, UINT128, INT128_SIZE, 128,
+	1, 1, 0, 1, 1, 0),
 #endif
-		

CVS commit: src/usr.bin/xlint/common

2021-09-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep  4 15:39:41 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: make initialization of the basic types table simpler

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/xlint/common/inittyp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-09-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep  4 14:42:30 UTC 2021

Modified Files:
src/usr.bin/xlint/common: emit.c externs.h

Log Message:
lint: trim down the code for writing the output files

The output buffer is only needed in a single file, so unexport it.

When calling outname, the chances for the name being null are close to
zero, therefore omit the caller information.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/common/emit.c
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/externs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/emit.c
diff -u src/usr.bin/xlint/common/emit.c:1.14 src/usr.bin/xlint/common/emit.c:1.15
--- src/usr.bin/xlint/common/emit.c:1.14	Sat Sep  4 14:26:32 2021
+++ src/usr.bin/xlint/common/emit.c	Sat Sep  4 14:42:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: emit.c,v 1.14 2021/09/04 14:26:32 rillig Exp $	*/
+/*	$NetBSD: emit.c,v 1.15 2021/09/04 14:42:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit.c,v 1.14 2021/09/04 14:26:32 rillig Exp $");
+__RCSID("$NetBSD: emit.c,v 1.15 2021/09/04 14:42:30 rillig Exp $");
 #endif
 
 #include 
@@ -50,7 +50,7 @@ static	const	char *loname;
 static	FILE	*lout;
 
 /* output buffer data */
-ob_t	ob;
+static	ob_t	ob;
 
 static	void	outxbuf(void);
 
@@ -132,9 +132,7 @@ outchar(char c)
 }
 
 #if defined(IS_LINT1)
-/*
- * write a character to the output buffer, quoted if necessary
- */
+/* write a character to the output buffer, quoted if necessary */
 void
 outqchar(char c)
 {
@@ -200,9 +198,7 @@ outstrg(const char *s)
 	}
 }
 
-/*
- * write an integer value to the output buffer
- */
+/* write an integer value to the output buffer */
 void
 outint(int i)
 {
@@ -212,23 +208,15 @@ outint(int i)
 	ob.o_next += sprintf(ob.o_next, "%d", i);
 }
 
-/*
- * write the name of a symbol to the output buffer
- * the name is preceded by its length
- */
+/* write a name to the output buffer, preceded by its length */
 void
-outname1(const char *file, size_t line, const char *name)
+outname(const char *name)
 {
-
-	if (name == NULL)
-		errx(1, "%s, %zu: internal error: outname(NULL)", file, line);
 	outint((int)strlen(name));
 	outstrg(name);
 }
 
-/*
- * write the name of the .c source
- */
+/* write the name of the .c source */
 void
 outsrc(const char *name)
 {

Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.22 src/usr.bin/xlint/common/externs.h:1.23
--- src/usr.bin/xlint/common/externs.h:1.22	Sat Sep  4 14:26:32 2021
+++ src/usr.bin/xlint/common/externs.h	Sat Sep  4 14:42:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.22 2021/09/04 14:26:32 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.23 2021/09/04 14:42:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -56,8 +56,6 @@ extern  char	*xasprintf(const char *, ..
  * emit.c
  */
 #if defined(IS_LINT1) || defined(IS_LINT2)
-extern	ob_t	ob;
-
 extern	void	outopen(const char *);
 extern	void	outclose(void);
 extern	void	outclr(void);
@@ -65,7 +63,6 @@ extern	void	outchar(char);
 extern	void	outqchar(char);
 extern	void	outstrg(const char *);
 extern	void	outint(int);
-#define outname(a)	outname1(__FILE__, __LINE__, a);
-extern	void	outname1(const char *, size_t, const char *);
+extern	void	outname(const char *);
 extern	void	outsrc(const char *);
 #endif



CVS commit: src/usr.bin/xlint/common

2021-09-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep  4 14:42:30 UTC 2021

Modified Files:
src/usr.bin/xlint/common: emit.c externs.h

Log Message:
lint: trim down the code for writing the output files

The output buffer is only needed in a single file, so unexport it.

When calling outname, the chances for the name being null are close to
zero, therefore omit the caller information.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/common/emit.c
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/externs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-09-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep  4 14:07:51 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c tyname.c

Log Message:
lint: remove _Complex from tspec_name

That type is only used in the parser; the expression trees use FCOMPLEX,
DCOMPLEX or LCOMPLEX instead.

Sort the typeinfo definitions according to their order in tspec_t.  Do
not add _Complex there since it is not needed.  This means that NOTSPEC
and COMPLEX would both trigger an internal error.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.27 src/usr.bin/xlint/common/inittyp.c:1.28
--- src/usr.bin/xlint/common/inittyp.c:1.27	Sat Sep  4 10:26:44 2021
+++ src/usr.bin/xlint/common/inittyp.c	Sat Sep  4 14:07:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.27 2021/09/04 10:26:44 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.28 2021/09/04 14:07:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.27 2021/09/04 10:26:44 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.28 2021/09/04 14:07:51 rillig Exp $");
 #endif
 
 #if defined(IS_LINT1)
@@ -112,13 +112,6 @@ inittyp(void)
 		0, 0, 1, 1, 1, 0, "double"),
 		typeinfo(LDOUBLE, LDOUBLE, LDOUBLE, LDOUBLE_SIZE, 80,
 		0, 0, 1, 1, 1, 0, "long double"),
-		typeinfo(FCOMPLEX, FCOMPLEX, FCOMPLEX, FLOAT_SIZE * 2, 32 * 2,
-		0, 0, 1, 1, 1, 1, "float _Complex"),
-		typeinfo(DCOMPLEX, DCOMPLEX, DCOMPLEX, DOUBLE_SIZE * 2, 64 * 2,
-		0, 0, 1, 1, 1, 1, "double _Complex"),
-		typeinfo(LCOMPLEX, LCOMPLEX, LCOMPLEX,
-		LDOUBLE_SIZE * 2, 80 * 2,
-		0, 0, 1, 1, 1, 1, "long double _Complex"),
 		typeinfo(VOID, VOID, VOID, 0, 0,
 		0, 0, 0, 0, 0, 0, "void"),
 		typeinfo(STRUCT, STRUCT, STRUCT, 0, 0,
@@ -133,6 +126,13 @@ inittyp(void)
 		0, 0, 0, 0, 0, 0, "array"),
 		typeinfo(FUNC, FUNC, FUNC, 0, 0,
 		0, 0, 0, 0, 0, 0, "function"),
+		typeinfo(FCOMPLEX, FCOMPLEX, FCOMPLEX, FLOAT_SIZE * 2, 32 * 2,
+		0, 0, 1, 1, 1, 1, "float _Complex"),
+		typeinfo(DCOMPLEX, DCOMPLEX, DCOMPLEX, DOUBLE_SIZE * 2, 64 * 2,
+		0, 0, 1, 1, 1, 1, "double _Complex"),
+		typeinfo(LCOMPLEX, LCOMPLEX, LCOMPLEX,
+		LDOUBLE_SIZE * 2, 80 * 2,
+		0, 0, 1, 1, 1, 1, "long double _Complex"),
 #undef typeinfo
 	};
 

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.48 src/usr.bin/xlint/common/tyname.c:1.49
--- src/usr.bin/xlint/common/tyname.c:1.48	Sat Sep  4 13:53:20 2021
+++ src/usr.bin/xlint/common/tyname.c	Sat Sep  4 14:07:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.48 2021/09/04 13:53:20 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.49 2021/09/04 14:07:51 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.48 2021/09/04 13:53:20 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.49 2021/09/04 14:07:51 rillig Exp $");
 #endif
 
 #include 
@@ -150,7 +150,7 @@ buf_add_int(buffer *buf, int n)
 const char *
 tspec_name(tspec_t t)
 {
-	const char *name = t == COMPLEX ? "_Complex" : ttab[t].tt_name;
+	const char *name = ttab[t].tt_name;
 	if (name == NULL)
 		INTERNAL_ERROR("tspec_name(%d)", t);
 	return name;



CVS commit: src/usr.bin/xlint/common

2021-09-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep  4 14:07:51 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c tyname.c

Log Message:
lint: remove _Complex from tspec_name

That type is only used in the parser; the expression trees use FCOMPLEX,
DCOMPLEX or LCOMPLEX instead.

Sort the typeinfo definitions according to their order in tspec_t.  Do
not add _Complex there since it is not needed.  This means that NOTSPEC
and COMPLEX would both trigger an internal error.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-09-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep  4 13:53:20 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: remove duplicate code in tspec_name

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.47 src/usr.bin/xlint/common/tyname.c:1.48
--- src/usr.bin/xlint/common/tyname.c:1.47	Sat Sep  4 13:45:36 2021
+++ src/usr.bin/xlint/common/tyname.c	Sat Sep  4 13:53:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.47 2021/09/04 13:45:36 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.48 2021/09/04 13:53:20 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.47 2021/09/04 13:45:36 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.48 2021/09/04 13:53:20 rillig Exp $");
 #endif
 
 #include 
@@ -147,47 +147,13 @@ buf_add_int(buffer *buf, int n)
 	buf_add(buf, num);
 }
 
-/* XXX: at least partly redundant with ttab[t].tt_name */
 const char *
 tspec_name(tspec_t t)
 {
-	switch (t) {
-	case SIGNED:	return "signed";
-	case UNSIGN:	return "unsigned";
-	case BOOL:	return "_Bool";
-	case CHAR:	return "char";
-	case SCHAR:	return "signed char";
-	case UCHAR:	return "unsigned char";
-	case SHORT:	return "short";
-	case USHORT:	return "unsigned short";
-	case INT:	return "int";
-	case UINT:	return "unsigned int";
-	case LONG:	return "long";
-	case ULONG:	return "unsigned long";
-	case QUAD:	return "long long";
-	case UQUAD:	return "unsigned long long";
-#ifdef INT128_SIZE
-	case INT128:	return "__int128_t";
-	case UINT128:	return "__uint128_t";
-#endif
-	case FLOAT:	return "float";
-	case DOUBLE:	return "double";
-	case LDOUBLE:	return "long double";
-	case VOID:	return "void";
-	case STRUCT:	return "struct";
-	case UNION:	return "union";
-	case ENUM:	return "enum";
-	case PTR:	return "pointer";
-	case ARRAY:	return "array";
-	case FUNC:	return "function";
-	case COMPLEX:	return "_Complex";
-	case FCOMPLEX:	return "float _Complex";
-	case DCOMPLEX:	return "double _Complex";
-	case LCOMPLEX:	return "long double _Complex";
-	default:
+	const char *name = t == COMPLEX ? "_Complex" : ttab[t].tt_name;
+	if (name == NULL)
 		INTERNAL_ERROR("tspec_name(%d)", t);
-		return NULL;
-	}
+	return name;
 }
 
 static void



CVS commit: src/usr.bin/xlint/common

2021-09-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep  4 13:53:20 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: remove duplicate code in tspec_name

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-09-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep  4 10:26:44 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: remove unnecessary includes

The type definitions used to depend on the host's platform
characteristics once, which required .


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/xlint/common/inittyp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.26 src/usr.bin/xlint/common/inittyp.c:1.27
--- src/usr.bin/xlint/common/inittyp.c:1.26	Sat Aug 28 13:02:25 2021
+++ src/usr.bin/xlint/common/inittyp.c	Sat Sep  4 10:26:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.26 2021/08/28 13:02:25 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.27 2021/09/04 10:26:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,12 +37,9 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.26 2021/08/28 13:02:25 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.27 2021/09/04 10:26:44 rillig Exp $");
 #endif
 
-#include 
-#include 
-
 #if defined(IS_LINT1)
 #include "lint1.h"
 #else



CVS commit: src/usr.bin/xlint/common

2021-09-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep  4 10:26:44 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: remove unnecessary includes

The type definitions used to depend on the host's platform
characteristics once, which required .


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/xlint/common/inittyp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 23:49:22 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: remove unnecessary switch statement

The switch statement covers only the few structural types, there is no
need to list all integer types as well.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.45 src/usr.bin/xlint/common/tyname.c:1.46
--- src/usr.bin/xlint/common/tyname.c:1.45	Sat Aug 28 13:29:26 2021
+++ src/usr.bin/xlint/common/tyname.c	Tue Aug 31 23:49:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.45 2021/08/28 13:29:26 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.46 2021/08/31 23:49:21 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.45 2021/08/28 13:29:26 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.46 2021/08/31 23:49:21 rillig Exp $");
 #endif
 
 #include 
@@ -303,33 +303,6 @@ type_name(const type_t *tp)
 	buf_add(, tspec_name(t));
 
 	switch (t) {
-	case BOOL:
-	case CHAR:
-	case UCHAR:
-	case SCHAR:
-	case SHORT:
-	case USHORT:
-	case INT:
-	case UINT:
-	case LONG:
-	case ULONG:
-	case QUAD:
-	case UQUAD:
-#ifdef INT128_SIZE
-	case INT128:
-	case UINT128:
-#endif
-	case FLOAT:
-	case DOUBLE:
-	case LDOUBLE:
-	case VOID:
-	case COMPLEX:
-	case FCOMPLEX:
-	case DCOMPLEX:
-	case LCOMPLEX:
-	case SIGNED:
-	case UNSIGN:
-		break;
 	case PTR:
 		buf_add(, " to ");
 		buf_add(, type_name(tp->t_subt));
@@ -348,7 +321,7 @@ type_name(const type_t *tp)
 		type_name_of_function(, tp);
 		break;
 	default:
-		INTERNAL_ERROR("type_name(%d)", t);
+		break;
 	}
 
 	name = intern(buf.data);



CVS commit: src/usr.bin/xlint/common

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 23:49:22 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: remove unnecessary switch statement

The switch statement covers only the few structural types, there is no
need to list all integer types as well.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 13:02:26 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: fix lint warning about initializing with negative number

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/common/inittyp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.25 src/usr.bin/xlint/common/inittyp.c:1.26
--- src/usr.bin/xlint/common/inittyp.c:1.25	Sun Aug 22 14:50:06 2021
+++ src/usr.bin/xlint/common/inittyp.c	Sat Aug 28 13:02:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.25 2021/08/22 14:50:06 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.26 2021/08/28 13:02:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.25 2021/08/22 14:50:06 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.26 2021/08/28 13:02:25 rillig Exp $");
 #endif
 
 #include 
@@ -122,19 +122,19 @@ inittyp(void)
 		typeinfo(LCOMPLEX, LCOMPLEX, LCOMPLEX,
 		LDOUBLE_SIZE * 2, 80 * 2,
 		0, 0, 1, 1, 1, 1, "long double _Complex"),
-		typeinfo(VOID, VOID, VOID, -1, -1,
+		typeinfo(VOID, VOID, VOID, 0, 0,
 		0, 0, 0, 0, 0, 0, "void"),
-		typeinfo(STRUCT, STRUCT, STRUCT, -1, -1,
+		typeinfo(STRUCT, STRUCT, STRUCT, 0, 0,
 		0, 0, 0, 0, 0, 0, "struct"),
-		typeinfo(UNION, UNION, UNION, -1, -1,
+		typeinfo(UNION, UNION, UNION, 0, 0,
 		0, 0, 0, 0, 0, 0, "union"),
 		typeinfo(ENUM, ENUM, ENUM, ENUM_SIZE, 24,
 		1, 0, 0, 1, 1, 0, "enum"),
 		typeinfo(PTR, PTR, PTR, PTR_SIZE, 32,
 		0, 1, 0, 0, 1, 0, "pointer"),
-		typeinfo(ARRAY, ARRAY, ARRAY, -1, -1,
+		typeinfo(ARRAY, ARRAY, ARRAY, 0, 0,
 		0, 0, 0, 0, 0, 0, "array"),
-		typeinfo(FUNC, FUNC, FUNC, -1, -1,
+		typeinfo(FUNC, FUNC, FUNC, 0, 0,
 		0, 0, 0, 0, 0, 0, "function"),
 #undef typeinfo
 	};



CVS commit: src/usr.bin/xlint/common

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 13:02:26 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: fix lint warning about initializing with negative number

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/common/inittyp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-08-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug  3 17:27:48 UTC 2021

Modified Files:
src/usr.bin/xlint/common: param.h

Log Message:
lint: reduce number of negations in preprocessor condition

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/common/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-08-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug  3 17:27:48 UTC 2021

Modified Files:
src/usr.bin/xlint/common: param.h

Log Message:
lint: reduce number of negations in preprocessor condition

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/common/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/param.h
diff -u src/usr.bin/xlint/common/param.h:1.8 src/usr.bin/xlint/common/param.h:1.9
--- src/usr.bin/xlint/common/param.h:1.8	Wed Dec 30 11:43:13 2020
+++ src/usr.bin/xlint/common/param.h	Tue Aug  3 17:27:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.8 2020/12/30 11:43:13 rillig Exp $	*/
+/*	$NetBSD: param.h,v 1.9 2021/08/03 17:27:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -63,7 +63,7 @@
 /*
  * The sparc64 long double code generation is broken in old gcc.
  */
-#if !defined(__sparc64__) || !defined(__GNUC__) || __GNUC__ > 2
+#if !(defined(__sparc64__) && defined(__GNUC__) && __GNUC__ <= 2)
 typedef	long double ldbl_t;
 #else
 typedef	double	ldbl_t;



CVS commit: src/usr.bin/xlint/common

2021-08-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug  3 17:20:02 UTC 2021

Modified Files:
src/usr.bin/xlint/common: mem.c

Log Message:
lint: make memory management code easier to read

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/xlint/common/mem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/mem.c
diff -u src/usr.bin/xlint/common/mem.c:1.15 src/usr.bin/xlint/common/mem.c:1.16
--- src/usr.bin/xlint/common/mem.c:1.15	Sun Aug  1 18:13:53 2021
+++ src/usr.bin/xlint/common/mem.c	Tue Aug  3 17:20:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.15 2021/08/01 18:13:53 rillig Exp $	*/
+/*	$NetBSD: mem.c,v 1.16 2021/08/03 17:20:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem.c,v 1.15 2021/08/01 18:13:53 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.16 2021/08/03 17:20:02 rillig Exp $");
 #endif
 
 #include 
@@ -46,53 +46,41 @@ __RCSID("$NetBSD: mem.c,v 1.15 2021/08/0
 
 #include "lint.h"
 
-static void __attribute__((noreturn))
-nomem(void)
+static void *
+not_null(void *ptr)
 {
 
-	errx(1, "virtual memory exhausted");
+	if (ptr == NULL)
+		errx(1, "virtual memory exhausted");
+	return ptr;
 }
 
 void *
 xmalloc(size_t s)
 {
-	void	*p;
 
-	if ((p = malloc(s)) == NULL)
-		nomem();
-	return p;
+	return not_null(malloc(s));
 }
 
 void *
 xcalloc(size_t n, size_t s)
 {
-	void	*p;
 
-	if ((p = calloc(n, s)) == NULL)
-		nomem();
-	return p;
+	return not_null(calloc(n, s));
 }
 
 void *
 xrealloc(void *p, size_t s)
 {
-	void *n;
 
-	if ((n = realloc(p, s)) == NULL) {
-		free(p);
-		nomem();
-	}
-	return n;
+	return not_null(realloc(p, s));
 }
 
 char *
 xstrdup(const char *s)
 {
-	char	*s2;
 
-	if ((s2 = strdup(s)) == NULL)
-		nomem();
-	return s2;
+	return not_null(strdup(s));
 }
 
 char *
@@ -106,6 +94,6 @@ xasprintf(const char *fmt, ...)
 	e = vasprintf(, fmt, ap);
 	va_end(ap);
 	if (e < 0)
-		nomem();
+		not_null(NULL);
 	return str;
 }



CVS commit: src/usr.bin/xlint/common

2021-08-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug  3 17:20:02 UTC 2021

Modified Files:
src/usr.bin/xlint/common: mem.c

Log Message:
lint: make memory management code easier to read

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/xlint/common/mem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 10:56:24 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: fix bit-size of long double _Complex in portable mode

C99 6.2.5p13 says that LCOMPLEX has the same representation and
alignment requirements as an array type containing exactly two LDOUBLE.

When support for _Complex was added to lint in inittyp.c 1.10 from
2008-09-27, there was no explanation for making the bit-size of LCOMPLEX
different from what C99 says, so it was probably a mistake that went
unnoticed for more than 12 years.  It's an edge case anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/common/inittyp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.23 src/usr.bin/xlint/common/inittyp.c:1.24
--- src/usr.bin/xlint/common/inittyp.c:1.23	Tue Jun 29 21:33:09 2021
+++ src/usr.bin/xlint/common/inittyp.c	Wed Jun 30 10:56:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.23 2021/06/29 21:33:09 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.24 2021/06/30 10:56:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.23 2021/06/29 21:33:09 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.24 2021/06/30 10:56:24 rillig Exp $");
 #endif
 
 #include 
@@ -115,13 +115,8 @@ inittyp(void)
 		0, 0, 1, 1, 1, 1, "float _Complex"),
 		typeinfo(DCOMPLEX, DCOMPLEX, DCOMPLEX, DOUBLE_SIZE * 2, 64 * 2,
 		0, 0, 1, 1, 1, 1, "double _Complex"),
-		/*
-		* XXX: with -p, LCOMPLEX.tt_portable_size_in_bits !=
-		*  2 * LDOUBLE.tt_portable_size_in_bits.
-		*  This may or may not have been intentional.
-		*/
 		typeinfo(LCOMPLEX, LCOMPLEX, LCOMPLEX,
-		LDOUBLE_SIZE * 2, 64 * 2,
+		LDOUBLE_SIZE * 2, 80 * 2,
 		0, 0, 1, 1, 1, 1, "long double _Complex"),
 		typeinfo(VOID, VOID, VOID, -1, -1,
 		0, 0, 0, 0, 0, 0, "void"),



CVS commit: src/usr.bin/xlint/common

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 10:56:24 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: fix bit-size of long double _Complex in portable mode

C99 6.2.5p13 says that LCOMPLEX has the same representation and
alignment requirements as an array type containing exactly two LDOUBLE.

When support for _Complex was added to lint in inittyp.c 1.10 from
2008-09-27, there was no explanation for making the bit-size of LCOMPLEX
different from what C99 says, so it was probably a mistake that went
unnoticed for more than 12 years.  It's an edge case anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/common/inittyp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-06-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jun  4 20:54:18 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-06-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jun  4 20:54:18 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.40 src/usr.bin/xlint/common/tyname.c:1.41
--- src/usr.bin/xlint/common/tyname.c:1.40	Sun Apr 18 17:47:32 2021
+++ src/usr.bin/xlint/common/tyname.c	Fri Jun  4 20:54:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.40 2021/04/18 17:47:32 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.41 2021/06/04 20:54:18 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.40 2021/04/18 17:47:32 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.41 2021/06/04 20:54:18 rillig Exp $");
 #endif
 
 #include 
@@ -197,7 +197,7 @@ sametype(const type_t *t1, const type_t 
 	if (t1->t_tspec != t2->t_tspec)
 		return false;
 
-	/* Ignore const/void */
+	/* Ignore const/volatile */
 
 	switch (t = t1->t_tspec) {
 	case BOOL:



CVS commit: src/usr.bin/xlint/common

2021-03-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Mar 20 18:59:00 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: use macro for encoding type information

In lint's strict bool mode, initialization must be of the correct type.
This affects the bool fields in ttab_t, which are initialized with int.
To keep the code brief, preserve these ints and let a macro do the
actual work of converting them to bool.

No change to the generated binary.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/common/inittyp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-03-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Mar 20 18:59:00 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: use macro for encoding type information

In lint's strict bool mode, initialization must be of the correct type.
This affects the bool fields in ttab_t, which are initialized with int.
To keep the code brief, preserve these ints and let a macro do the
actual work of converting them to bool.

No change to the generated binary.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/common/inittyp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.20 src/usr.bin/xlint/common/inittyp.c:1.21
--- src/usr.bin/xlint/common/inittyp.c:1.20	Sun Feb 28 18:51:51 2021
+++ src/usr.bin/xlint/common/inittyp.c	Sat Mar 20 18:59:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.20 2021/02/28 18:51:51 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.21 2021/03/20 18:59:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.20 2021/02/28 18:51:51 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.21 2021/03/20 18:59:00 rillig Exp $");
 #endif
 
 #include 
@@ -58,101 +58,85 @@ inittyp(void)
 		tspec_t	it_tspec;
 		ttab_t	it_ttab;
 	} ittab[NTSPEC] = {
-		{ SIGNED,   { 0, 0,
-  SIGNED, UNSIGN,
-  0, 0, 0, 0, 0, 0, "signed" } },
-		{ UNSIGN,   { 0, 0,
-  SIGNED, UNSIGN,
-  0, 0, 0, 0, 0, 0, "unsigned" } },
-		{ BOOL,	{ CHAR_SIZE, 1,
-  BOOL, BOOL,
-  1, 1, 0, 1, 1, 0, "_Bool" } },
-		{ CHAR,	{ CHAR_SIZE, 8,
-  SCHAR, UCHAR,
-  1, 0, 0, 1, 1, 0, "char" } },
-		{ SCHAR,{ CHAR_SIZE, 8,
-  SCHAR, UCHAR,
-  1, 0, 0, 1, 1, 0, "signed char" } },
-		{ UCHAR,{ CHAR_SIZE, 8,
-  SCHAR, UCHAR,
-  1, 1, 0, 1, 1, 0, "unsigned char" } },
-		{ SHORT,{ SHORT_SIZE, 16,
-  SHORT, USHORT,
-  1, 0, 0, 1, 1, 0, "short" } },
-		{ USHORT,   { SHORT_SIZE, 16,
-  SHORT, USHORT,
-  1, 1, 0, 1, 1, 0, "unsigned short" } },
-		{ INT,  { INT_SIZE, INT_RSIZE * 8,
-  INT, UINT,
-  1, 0, 0, 1, 1, 0, "int" } },
-		{ UINT, { INT_SIZE, INT_RSIZE * 8,
-  INT, UINT,
-  1, 1, 0, 1, 1, 0, "unsigned int" } },
-		{ LONG, { LONG_SIZE, 32,
-  LONG, ULONG,
-  1, 0, 0, 1, 1, 0, "long" } },
-		{ ULONG,{ LONG_SIZE, 32,
-  LONG, ULONG,
-  1, 1, 0, 1, 1, 0, "unsigned long" } },
-		{ QUAD, { QUAD_SIZE, 64,
-  QUAD, UQUAD,
-  1, 0, 0, 1, 1, 0, "long long" } },
-		{ UQUAD,{ QUAD_SIZE, 64,
-  QUAD, UQUAD,
-  1, 1, 0, 1, 1, 0, "unsigned long long" } },
+#define typeinfo( \
+	tspec, signed_type, unsigned_type, \
+	size_in_bits, portable_size_in_bits, \
+	in, un, fl, ar, sc, co, name) \
+	{ \
+	tspec, { \
+		size_in_bits, portable_size_in_bits, \
+		signed_type, unsigned_type, \
+		(in) > 0, (un) > 0, (fl) > 0, (ar) > 0, (sc) > 0, (co) > 0, \
+		name, \
+	} \
+	}
+		typeinfo(SIGNED, SIGNED, UNSIGN, 0, 0,
+		0, 0, 0, 0, 0, 0, "signed"),
+		typeinfo(UNSIGN, SIGNED, UNSIGN, 0, 0,
+		0, 0, 0, 0, 0, 0, "unsigned"),
+		typeinfo(BOOL, BOOL, BOOL, CHAR_SIZE, 1,
+		1, 1, 0, 1, 1, 0, "_Bool"),
+		typeinfo(CHAR, SCHAR, UCHAR, CHAR_SIZE, 8,
+		1, 0, 0, 1, 1, 0, "char"),
+		typeinfo(SCHAR, SCHAR, UCHAR, CHAR_SIZE, 8,
+		1, 0, 0, 1, 1, 0, "signed char"),
+		typeinfo(UCHAR, SCHAR, UCHAR, CHAR_SIZE, 8,
+		1, 1, 0, 1, 1, 0, "unsigned char"),
+		typeinfo(SHORT, SHORT, USHORT, SHORT_SIZE, 16,
+		1, 0, 0, 1, 1, 0, "short"),
+		typeinfo(USHORT, SHORT, USHORT, SHORT_SIZE, 16,
+		1, 1, 0, 1, 1, 0, "unsigned short"),
+		typeinfo(INT, INT, UINT, INT_SIZE, INT_RSIZE * 8,
+		1, 0, 0, 1, 1, 0, "int"),
+		typeinfo(UINT, INT, UINT, INT_SIZE, INT_RSIZE * 8,
+		1, 1, 0, 1, 1, 0, "unsigned int"),
+		typeinfo(LONG, LONG, ULONG, LONG_SIZE, 32,
+		1, 0, 0, 1, 1, 0, "long"),
+		typeinfo(ULONG, LONG, ULONG, LONG_SIZE, 32,
+		1, 1, 0, 1, 1, 0, "unsigned long"),
+		typeinfo(QUAD, QUAD, UQUAD, QUAD_SIZE, 64,
+		1, 0, 0, 1, 1, 0, "long long"),
+		typeinfo(UQUAD, QUAD, UQUAD, QUAD_SIZE, 64,
+		1, 1, 0, 1, 1, 0, "unsigned long long"),
 #ifdef INT128_SIZE
-		{ INT128,   { INT128_SIZE, 128,
-  INT128, UINT128,
-  1, 0, 0, 1, 1, 0, "__int128_t" } },
-		{ UINT128,  { INT128_SIZE, 128,
-  INT128, UINT128,
-  1, 1, 0, 1, 1, 0, "__uint128_t" } },
+		typeinfo(INT128, INT128, UINT128, INT128_SIZE, 128,
+		1, 0, 0, 1, 1, 0, "__int128_t"),
+		typeinfo(UINT128, INT128, UINT128, INT128_SIZE, 128,
+		1, 1, 0, 1, 1, 0, "__uint128_t"),
 #endif
-
-		{ FLOAT,{ FLOAT_SIZE, 32,
-  FLOAT, FLOAT,
-			

CVS commit: src/usr.bin/xlint/common

2021-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 28 02:37:04 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: extract type_name_of_array from type_name

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 28 02:37:04 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: extract type_name_of_array from type_name

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.32 src/usr.bin/xlint/common/tyname.c:1.33
--- src/usr.bin/xlint/common/tyname.c:1.32	Sun Feb 28 02:29:28 2021
+++ src/usr.bin/xlint/common/tyname.c	Sun Feb 28 02:37:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.32 2021/02/28 02:29:28 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.33 2021/02/28 02:37:04 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.32 2021/02/28 02:29:28 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.33 2021/02/28 02:37:04 rillig Exp $");
 #endif
 
 #include 
@@ -314,6 +314,23 @@ type_name_of_enum(buffer *buf, const typ
 #endif
 }
 
+static void
+type_name_of_array(buffer *buf, const type_t *tp)
+{
+	buf_add(buf, " of ");
+	buf_add(buf, type_name(tp->t_subt));
+	buf_add(buf, "[");
+#ifdef t_str /* lint1 */
+	if (tp->t_incomplete_array)
+		buf_add(buf, "unknown_size");
+	else
+		buf_add_int(buf, tp->t_dim);
+#else
+	buf_add_int(buf, tp->t_dim);
+#endif
+	buf_add(buf, "]");
+}
+
 const char *
 type_name(const type_t *tp)
 {
@@ -379,23 +396,11 @@ type_name(const type_t *tp)
 		type_name_of_struct_or_union(, tp);
 		break;
 	case ARRAY:
-		buf_add(, " of ");
-		buf_add(, type_name(tp->t_subt));
-		buf_add(, "[");
-#ifdef t_str /* lint1 */
-		if (tp->t_incomplete_array)
-			buf_add(, "unknown_size");
-		else
-			buf_add_int(, tp->t_dim);
-#else
-		buf_add_int(, tp->t_dim);
-#endif
-		buf_add(, "]");
+		type_name_of_array(, tp);
 		break;
 	case FUNC:
 		type_name_of_function(, tp);
 		break;
-
 	default:
 		LERROR("type_name(%d)", t);
 	}



CVS commit: src/usr.bin/xlint/common

2021-01-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jan 26 18:38:58 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: remove __noinline attribute from string interning function

I had committed this accidentally while ensuring that the generated code
is still efficient even though the source code looks heavy with the
double pointer indirection.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.25 src/usr.bin/xlint/common/tyname.c:1.26
--- src/usr.bin/xlint/common/tyname.c:1.25	Sun Jan 24 11:55:57 2021
+++ src/usr.bin/xlint/common/tyname.c	Tue Jan 26 18:38:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.25 2021/01/24 11:55:57 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.26 2021/01/26 18:38:57 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.25 2021/01/24 11:55:57 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.26 2021/01/26 18:38:57 rillig Exp $");
 #endif
 
 #include 
@@ -82,7 +82,7 @@ new_name_tree_node(const char *name)
 }
 
 /* Return the canonical instance of the string, with unlimited life time. */
-static const char * __noinline
+static const char *
 intern(const char *name)
 {
 	name_tree_node *n = type_names, **next;



CVS commit: src/usr.bin/xlint/common

2021-01-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jan 26 18:38:58 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: remove __noinline attribute from string interning function

I had committed this accidentally while ensuring that the generated code
is still efficient even though the source code looks heavy with the
double pointer indirection.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-01-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jan 24 11:55:57 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: merge duplicate code for interning type names


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.24 src/usr.bin/xlint/common/tyname.c:1.25
--- src/usr.bin/xlint/common/tyname.c:1.24	Sat Jan 16 16:53:23 2021
+++ src/usr.bin/xlint/common/tyname.c	Sun Jan 24 11:55:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.24 2021/01/16 16:53:23 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.25 2021/01/24 11:55:57 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.24 2021/01/16 16:53:23 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.25 2021/01/24 11:55:57 rillig Exp $");
 #endif
 
 #include 
@@ -82,10 +82,10 @@ new_name_tree_node(const char *name)
 }
 
 /* Return the canonical instance of the string, with unlimited life time. */
-static const char *
+static const char * __noinline
 intern(const char *name)
 {
-	name_tree_node *n = type_names;
+	name_tree_node *n = type_names, **next;
 	int cmp;
 
 	if (n == NULL) {
@@ -95,19 +95,12 @@ intern(const char *name)
 	}
 
 	while ((cmp = strcmp(name, n->ntn_name)) != 0) {
-		if (cmp < 0) {
-			if (n->ntn_less == NULL) {
-n->ntn_less = new_name_tree_node(name);
-return n->ntn_less->ntn_name;
-			}
-			n = n->ntn_less;
-		} else {
-			if (n->ntn_greater == NULL) {
-n->ntn_greater = new_name_tree_node(name);
-return n->ntn_greater->ntn_name;
-			}
-			n = n->ntn_greater;
+		next = cmp < 0 ? >ntn_less : >ntn_greater;
+		if (*next == NULL) {
+			*next = new_name_tree_node(name);
+			return (*next)->ntn_name;
 		}
+		n = *next;
 	}
 	return n->ntn_name;
 }



CVS commit: src/usr.bin/xlint/common

2021-01-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jan 24 11:55:57 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: merge duplicate code for interning type names


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-01-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan  4 01:12:20 UTC 2021

Modified Files:
src/usr.bin/xlint/common: externs.h inittyp.c lint.h lp64.h

Log Message:
lint: revert previous commit, except for the typo


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/common/lp64.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.11 src/usr.bin/xlint/common/externs.h:1.12
--- src/usr.bin/xlint/common/externs.h:1.11	Mon Jan  4 01:11:01 2021
+++ src/usr.bin/xlint/common/externs.h	Mon Jan  4 01:12:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.11 2021/01/04 01:11:01 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.12 2021/01/04 01:12:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -74,8 +74,3 @@ extern	void	outint(int);
 #define outname(a)	outname1(__FILE__, __LINE__, a);
 extern	void	outname1(const char *, size_t, const char *);
 extern	void	outsrc(const char *);
-
-/*
- * platforms.c
- */
-extern	const target_platform *platform(void);

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.14 src/usr.bin/xlint/common/inittyp.c:1.15
--- src/usr.bin/xlint/common/inittyp.c:1.14	Mon Jan  4 01:11:01 2021
+++ src/usr.bin/xlint/common/inittyp.c	Mon Jan  4 01:12:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.14 2021/01/04 01:11:01 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.15 2021/01/04 01:12:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.14 2021/01/04 01:11:01 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.15 2021/01/04 01:12:20 rillig Exp $");
 #endif
 
 #include 
@@ -113,10 +113,10 @@ inittyp(void)
   1, 1, 0, 1, 1, 0, "__uint128_t" } },
 #endif
 
-		{ FLOAT,{ 32, 4 * CHAR_BIT,
+		{ FLOAT,{ FLOAT_SIZE, 4 * CHAR_BIT,
   FLOAT, FLOAT,
   0, 0, 1, 1, 1, 0, "float" } },
-		{ DOUBLE,   { 64, 8 * CHAR_BIT,
+		{ DOUBLE,   { DOUBLE_SIZE, 8 * CHAR_BIT,
   DOUBLE, DOUBLE,
   0, 0, 1, 1, 1, 0, "double" } },
 		{ LDOUBLE,  { LDOUBLE_SIZE, 10 * CHAR_BIT,

Index: src/usr.bin/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.22 src/usr.bin/xlint/common/lint.h:1.23
--- src/usr.bin/xlint/common/lint.h:1.22	Mon Jan  4 01:11:01 2021
+++ src/usr.bin/xlint/common/lint.h	Mon Jan  4 01:12:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.22 2021/01/04 01:11:01 rillig Exp $	*/
+/*	$NetBSD: lint.h,v 1.23 2021/01/04 01:12:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -136,12 +136,4 @@ typedef	struct	ob {
 
 typedef struct type type_t;
 
-typedef struct target_platform {
-	const char *pl_name;
-	tspec_t pl_char_type;
-	size_t pl_long_pointer_size;
-	tspec_t pl_intptr_type;		/* either INT or LONG */
-	size_t pl_sizeof_long_double;	/* either 8, 12 or 16 */
-} target_platform;
-
 #include "externs.h"

Index: src/usr.bin/xlint/common/lp64.h
diff -u src/usr.bin/xlint/common/lp64.h:1.8 src/usr.bin/xlint/common/lp64.h:1.9
--- src/usr.bin/xlint/common/lp64.h:1.8	Mon Jan  4 01:11:01 2021
+++ src/usr.bin/xlint/common/lp64.h	Mon Jan  4 01:12:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lp64.h,v 1.8 2021/01/04 01:11:01 rillig Exp $	*/
+/*	$NetBSD: lp64.h,v 1.9 2021/01/04 01:12:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -53,11 +53,11 @@
 #define	TARG_SCHAR_MIN	((-TARG_CHAR_MAX) - 1)
 #define	TARG_UCHAR_MAX	((unsigned char) -1)
 
-#define	TARG_SHRT_MAX	32767
-#define	TARG_SHRT_MIN	(-32768)
-#define	TARG_USHRT_MAX	65535
+#define	TARG_SHRT_MAX	((int16_t) (((uint16_t) -1) >> 1))
+#define	TARG_SHRT_MIN	((-TARG_SHRT_MAX) - 1)
+#define	TARG_USHRT_MAX	((uint16_t) -1)
 
-#define	TARG_INT_MAX	(2147483647)
+#define	TARG_INT_MAX	((int32_t) (((uint32_t) -1) >> 1))
 #define	TARG_INT_MIN	((-TARG_INT_MAX) - 1)
 #define	TARG_UINT_MAX	((uint32_t) -1)
 



CVS commit: src/usr.bin/xlint/common

2021-01-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan  4 01:12:20 UTC 2021

Modified Files:
src/usr.bin/xlint/common: externs.h inittyp.c lint.h lp64.h

Log Message:
lint: revert previous commit, except for the typo


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/common/lp64.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-01-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan  4 01:11:01 UTC 2021

Modified Files:
src/usr.bin/xlint/common: externs.h ilp32.h inittyp.c lint.h lp64.h

Log Message:
lint: fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/xlint/common/ilp32.h
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/common/lp64.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.10 src/usr.bin/xlint/common/externs.h:1.11
--- src/usr.bin/xlint/common/externs.h:1.10	Sat Jan  2 03:49:25 2021
+++ src/usr.bin/xlint/common/externs.h	Mon Jan  4 01:11:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.10 2021/01/02 03:49:25 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.11 2021/01/04 01:11:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -74,3 +74,8 @@ extern	void	outint(int);
 #define outname(a)	outname1(__FILE__, __LINE__, a);
 extern	void	outname1(const char *, size_t, const char *);
 extern	void	outsrc(const char *);
+
+/*
+ * platforms.c
+ */
+extern	const target_platform *platform(void);

Index: src/usr.bin/xlint/common/ilp32.h
diff -u src/usr.bin/xlint/common/ilp32.h:1.3 src/usr.bin/xlint/common/ilp32.h:1.4
--- src/usr.bin/xlint/common/ilp32.h:1.3	Tue Mar 27 19:24:03 2012
+++ src/usr.bin/xlint/common/ilp32.h	Mon Jan  4 01:11:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ilp32.h,v 1.3 2012/03/27 19:24:03 christos Exp $	*/
+/*	$NetBSD: ilp32.h,v 1.4 2021/01/04 01:11:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 /*
- * Type sizes for IPL32 platforms (int, long, pointer: 32-bit)
+ * Type sizes for ILP32 platforms (int, long, pointer: 32-bit)
  */
 
 #define	CHAR_SIZE	(CHAR_BIT)

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.13 src/usr.bin/xlint/common/inittyp.c:1.14
--- src/usr.bin/xlint/common/inittyp.c:1.13	Wed Dec 30 11:39:55 2020
+++ src/usr.bin/xlint/common/inittyp.c	Mon Jan  4 01:11:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.13 2020/12/30 11:39:55 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.14 2021/01/04 01:11:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.13 2020/12/30 11:39:55 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.14 2021/01/04 01:11:01 rillig Exp $");
 #endif
 
 #include 
@@ -113,10 +113,10 @@ inittyp(void)
   1, 1, 0, 1, 1, 0, "__uint128_t" } },
 #endif
 
-		{ FLOAT,{ FLOAT_SIZE, 4 * CHAR_BIT,
+		{ FLOAT,{ 32, 4 * CHAR_BIT,
   FLOAT, FLOAT,
   0, 0, 1, 1, 1, 0, "float" } },
-		{ DOUBLE,   { DOUBLE_SIZE, 8 * CHAR_BIT,
+		{ DOUBLE,   { 64, 8 * CHAR_BIT,
   DOUBLE, DOUBLE,
   0, 0, 1, 1, 1, 0, "double" } },
 		{ LDOUBLE,  { LDOUBLE_SIZE, 10 * CHAR_BIT,

Index: src/usr.bin/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.21 src/usr.bin/xlint/common/lint.h:1.22
--- src/usr.bin/xlint/common/lint.h:1.21	Sat Jan  2 01:06:15 2021
+++ src/usr.bin/xlint/common/lint.h	Mon Jan  4 01:11:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.21 2021/01/02 01:06:15 rillig Exp $	*/
+/*	$NetBSD: lint.h,v 1.22 2021/01/04 01:11:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -136,4 +136,12 @@ typedef	struct	ob {
 
 typedef struct type type_t;
 
+typedef struct target_platform {
+	const char *pl_name;
+	tspec_t pl_char_type;
+	size_t pl_long_pointer_size;
+	tspec_t pl_intptr_type;		/* either INT or LONG */
+	size_t pl_sizeof_long_double;	/* either 8, 12 or 16 */
+} target_platform;
+
 #include "externs.h"

Index: src/usr.bin/xlint/common/lp64.h
diff -u src/usr.bin/xlint/common/lp64.h:1.7 src/usr.bin/xlint/common/lp64.h:1.8
--- src/usr.bin/xlint/common/lp64.h:1.7	Fri Nov 16 20:49:08 2018
+++ src/usr.bin/xlint/common/lp64.h	Mon Jan  4 01:11:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lp64.h,v 1.7 2018/11/16 20:49:08 scole Exp $	*/
+/*	$NetBSD: lp64.h,v 1.8 2021/01/04 01:11:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -53,11 +53,11 @@
 #define	TARG_SCHAR_MIN	((-TARG_CHAR_MAX) - 1)
 #define	TARG_UCHAR_MAX	((unsigned char) -1)
 
-#define	TARG_SHRT_MAX	((int16_t) (((uint16_t) -1) >> 1))
-#define	TARG_SHRT_MIN	((-TARG_SHRT_MAX) - 1)
-#define	TARG_USHRT_MAX	((uint16_t) -1)
+#define	TARG_SHRT_MAX	32767
+#define	TARG_SHRT_MIN	(-32768)
+#define	TARG_USHRT_MAX	65535
 
-#define	TARG_INT_MAX	((int32_t) (((uint32_t) -1) >> 1))
+#define	TARG_INT_MAX	(2147483647)
 #define	TARG_INT_MIN	((-TARG_INT_MAX) - 1)
 #define	TARG_UINT_MAX	((uint32_t) -1)
 



CVS commit: src/usr.bin/xlint/common

2021-01-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan  4 01:11:01 UTC 2021

Modified Files:
src/usr.bin/xlint/common: externs.h ilp32.h inittyp.c lint.h lp64.h

Log Message:
lint: fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/xlint/common/ilp32.h
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/common/lp64.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2021-01-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan  2 01:36:28 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: order tspec_name in the same way as the enum


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.18 src/usr.bin/xlint/common/tyname.c:1.19
--- src/usr.bin/xlint/common/tyname.c:1.18	Fri Jan  1 01:42:55 2021
+++ src/usr.bin/xlint/common/tyname.c	Sat Jan  2 01:36:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.18 2021/01/01 01:42:55 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.19 2021/01/02 01:36:28 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.18 2021/01/01 01:42:55 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.19 2021/01/02 01:36:28 rillig Exp $");
 #endif
 
 #include 
@@ -57,10 +57,12 @@ const char *
 tspec_name(tspec_t t)
 {
 	switch (t) {
+	case SIGNED:	return "signed";
+	case UNSIGN:	return "unsigned";
 	case BOOL:	return "_Bool";
 	case CHAR:	return "char";
-	case UCHAR:	return "unsigned char";
 	case SCHAR:	return "signed char";
+	case UCHAR:	return "unsigned char";
 	case SHORT:	return "short";
 	case USHORT:	return "unsigned short";
 	case INT:	return "int";
@@ -77,18 +79,16 @@ tspec_name(tspec_t t)
 	case DOUBLE:	return "double";
 	case LDOUBLE:	return "long double";
 	case VOID:	return "void";
-	case PTR:	return "pointer";
-	case ENUM:	return "enum";
 	case STRUCT:	return "struct";
 	case UNION:	return "union";
-	case FUNC:	return "function";
+	case ENUM:	return "enum";
+	case PTR:	return "pointer";
 	case ARRAY:	return "array";
+	case FUNC:	return "function";
+	case COMPLEX:	return "_Complex";
 	case FCOMPLEX:	return "float _Complex";
 	case DCOMPLEX:	return "double _Complex";
 	case LCOMPLEX:	return "long double _Complex";
-	case COMPLEX:	return "_Complex";
-	case SIGNED:	return "signed";
-	case UNSIGN:	return "unsigned";
 	default:
 		LERROR("tspec_name(%d)", t);
 		return NULL;



CVS commit: src/usr.bin/xlint/common

2021-01-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan  2 01:36:28 UTC 2021

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
lint: order tspec_name in the same way as the enum


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2020-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 30 11:47:16 UTC 2020

Modified Files:
src/usr.bin/xlint/common: emit.c

Log Message:
lint: fix Clang-tidy warning about narrowing conversion


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/common/emit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/emit.c
diff -u src/usr.bin/xlint/common/emit.c:1.8 src/usr.bin/xlint/common/emit.c:1.9
--- src/usr.bin/xlint/common/emit.c:1.8	Wed Dec 30 10:46:11 2020
+++ src/usr.bin/xlint/common/emit.c	Wed Dec 30 11:47:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: emit.c,v 1.8 2020/12/30 10:46:11 rillig Exp $	*/
+/*	$NetBSD: emit.c,v 1.9 2020/12/30 11:47:15 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit.c,v 1.8 2020/12/30 10:46:11 rillig Exp $");
+__RCSID("$NetBSD: emit.c,v 1.9 2020/12/30 11:47:15 rillig Exp $");
 #endif
 
 #include 
@@ -133,7 +133,7 @@ outchar(int c)
 }
 
 /*
- * write a character to the output buffer, qouted if necessary
+ * write a character to the output buffer, quoted if necessary
  */
 void
 outqchar(int c)
@@ -175,8 +175,8 @@ outqchar(int c)
 			outchar('a');
 			break;
 		default:
-			outcharu_int)c >> 6) & 07) + '0');
-			outcharu_int)c >> 3) & 07) + '0');
+			outcharunsigned char)c >> 6) & 07) + '0');
+			outcharunsigned char)c >> 3) & 07) + '0');
 			outchar((c & 07) + '0');
 			break;
 		}



CVS commit: src/usr.bin/xlint/common

2020-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 30 11:47:16 UTC 2020

Modified Files:
src/usr.bin/xlint/common: emit.c

Log Message:
lint: fix Clang-tidy warning about narrowing conversion


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/common/emit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2020-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 30 11:43:13 UTC 2020

Modified Files:
src/usr.bin/xlint/common: param.h

Log Message:
lint: remove unused macro STRBLEN


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/common/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/param.h
diff -u src/usr.bin/xlint/common/param.h:1.7 src/usr.bin/xlint/common/param.h:1.8
--- src/usr.bin/xlint/common/param.h:1.7	Wed Dec 30 11:39:55 2020
+++ src/usr.bin/xlint/common/param.h	Wed Dec 30 11:43:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.7 2020/12/30 11:39:55 rillig Exp $	*/
+/*	$NetBSD: param.h,v 1.8 2020/12/30 11:43:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -32,12 +32,6 @@
  */
 
 /*
- * Minimun size of string buffer. If this is not enough, the buffer
- * is enlarged in steps of STRBLEN bytes.
- */
-#define	STRBLEN		256
-
-/*
  * The size of memory blocks which are used to allocate memory in larger
  * chunks.
  */



CVS commit: src/usr.bin/xlint/common

2020-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 30 11:43:13 UTC 2020

Modified Files:
src/usr.bin/xlint/common: param.h

Log Message:
lint: remove unused macro STRBLEN


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/common/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2020-12-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec 28 22:16:42 UTC 2020

Modified Files:
src/usr.bin/xlint/common: mem.c

Log Message:
lint: remove trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/xlint/common/mem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/mem.c
diff -u src/usr.bin/xlint/common/mem.c:1.9 src/usr.bin/xlint/common/mem.c:1.10
--- src/usr.bin/xlint/common/mem.c:1.9	Mon Dec 28 21:24:55 2020
+++ src/usr.bin/xlint/common/mem.c	Mon Dec 28 22:16:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.9 2020/12/28 21:24:55 rillig Exp $	*/
+/*	$NetBSD: mem.c,v 1.10 2020/12/28 22:16:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem.c,v 1.9 2020/12/28 21:24:55 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.10 2020/12/28 22:16:42 rillig Exp $");
 #endif
 
 #include 
@@ -137,4 +137,3 @@ xmapalloc(size_t len)
 		err(1, "Cannot map memory for %lu bytes", (unsigned long)len);
 	return p;
 }
- 
\ No newline at end of file



CVS commit: src/usr.bin/xlint/common

2020-12-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec 28 22:16:42 UTC 2020

Modified Files:
src/usr.bin/xlint/common: mem.c

Log Message:
lint: remove trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/xlint/common/mem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2020-12-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec 28 18:06:23 UTC 2020

Modified Files:
src/usr.bin/xlint/common: lint.h

Log Message:
lint: fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/common/lint.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.14 src/usr.bin/xlint/common/lint.h:1.15
--- src/usr.bin/xlint/common/lint.h:1.14	Fri Sep  7 15:16:15 2018
+++ src/usr.bin/xlint/common/lint.h	Mon Dec 28 18:06:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.14 2018/09/07 15:16:15 christos Exp $	*/
+/*	$NetBSD: lint.h,v 1.15 2020/12/28 18:06:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -100,7 +100,7 @@ typedef	struct {
 	u_int	tt_isatyp : 1;		/* 1 if arithmetic type */
 	u_int	tt_issclt : 1;		/* 1 if scalar type */
 	u_int	tt_isctyp : 1;		/* 1 if complex type */
-	const char *tt_name;		/* Bezeichnung des Typs */
+	const char *tt_name;		/* name of the type */
 } ttab_t;
 
 #define size(t)		(ttab[t].tt_sz)



CVS commit: src/usr.bin/xlint/common

2020-12-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec 28 18:06:23 UTC 2020

Modified Files:
src/usr.bin/xlint/common: lint.h

Log Message:
lint: fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/common/lint.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2018-11-16 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Fri Nov 16 20:49:08 UTC 2018

Modified Files:
src/usr.bin/xlint/common: lp64.h

Log Message:
PR toolchain/53710

allow 64bit target to compile on 32bit host

Ok'ed by 


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/xlint/common/lp64.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/lp64.h
diff -u src/usr.bin/xlint/common/lp64.h:1.6 src/usr.bin/xlint/common/lp64.h:1.7
--- src/usr.bin/xlint/common/lp64.h:1.6	Sun Oct  7 14:20:01 2018
+++ src/usr.bin/xlint/common/lp64.h	Fri Nov 16 20:49:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: lp64.h,v 1.6 2018/10/07 14:20:01 christos Exp $	*/
+/*	$NetBSD: lp64.h,v 1.7 2018/11/16 20:49:08 scole Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -45,7 +45,9 @@
 #define	LONG_SIZE	(8 * CHAR_BIT)
 #define	QUAD_SIZE	(8 * CHAR_BIT)
 #define	PTR_SIZE	(8 * CHAR_BIT)
+#ifdef _LP64
 #define	INT128_SIZE	(16 * CHAR_BIT)
+#endif
 
 #define	TARG_SCHAR_MAX	((signed char) (((unsigned char) -1) >> 1))
 #define	TARG_SCHAR_MIN	((-TARG_CHAR_MAX) - 1)
@@ -67,7 +69,7 @@
 #define	TARG_QUAD_MIN	((-TARG_QUAD_MAX) - 1)
 #define	TARG_UQUAD_MAX	((uint64_t) -1)
 
-#ifndef _LP64
+#ifdef _LP64
 /* XXX on a 32 build for a 64 build host we skip these */
 #define	TARG_INT128_MAX		((__int128_t) (((__uint128_t) -1) >> 1))
 #define	TARG_INT128_MIN		((-TARG_INT128_MAX) - 1)



CVS commit: src/usr.bin/xlint/common

2018-11-16 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Fri Nov 16 20:49:08 UTC 2018

Modified Files:
src/usr.bin/xlint/common: lp64.h

Log Message:
PR toolchain/53710

allow 64bit target to compile on 32bit host

Ok'ed by 


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/xlint/common/lp64.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2016-08-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Aug 19 10:18:11 UTC 2016

Modified Files:
src/usr.bin/xlint/common: externs.h tyname.c

Log Message:
add a type comparison function.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.5 src/usr.bin/xlint/common/externs.h:1.6
--- src/usr.bin/xlint/common/externs.h:1.5	Thu Apr 17 14:52:03 2014
+++ src/usr.bin/xlint/common/externs.h	Fri Aug 19 06:18:11 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.5 2014/04/17 18:52:03 christos Exp $	*/
+/*	$NetBSD: externs.h,v 1.6 2016/08/19 10:18:11 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -44,7 +44,8 @@ extern	void	inittyp(void);
 /*
  * tyname.c
  */
-extern	const	char *tyname(char *, size_t, type_t *);
+extern	const	char *tyname(char *, size_t, const type_t *);
+extern	int	sametype(const type_t *, const type_t *);
 extern	const	char *basictyname(tspec_t);
 
 /*

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.11 src/usr.bin/xlint/common/tyname.c:1.12
--- src/usr.bin/xlint/common/tyname.c:1.11	Wed Jun 20 14:50:11 2012
+++ src/usr.bin/xlint/common/tyname.c	Fri Aug 19 06:18:11 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.11 2012/06/20 18:50:11 christos Exp $	*/
+/*	$NetBSD: tyname.c,v 1.12 2016/08/19 10:18:11 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.11 2012/06/20 18:50:11 christos Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.12 2016/08/19 10:18:11 christos Exp $");
 #endif
 
 #include 
@@ -88,8 +88,68 @@ basictyname(tspec_t t)
 	}
 }
 
+int
+sametype(const type_t *t1, const type_t *t2)
+{
+	tspec_t	t;
+
+	if (t1->t_tspec != t2->t_tspec)
+		return 0;
+
+	/* Ignore const/void */
+
+	switch (t = t1->t_tspec) {
+	case BOOL:
+	case CHAR:
+	case UCHAR:
+	case SCHAR:
+	case SHORT:
+	case USHORT:
+	case INT:
+	case UINT:
+	case LONG:
+	case ULONG:
+	case QUAD:
+	case UQUAD:
+	case FLOAT:
+	case DOUBLE:
+	case LDOUBLE:
+	case VOID:
+	case FUNC:
+	case COMPLEX:
+	case FCOMPLEX:
+	case DCOMPLEX:
+	case LCOMPLEX:
+		return 1;
+	case ARRAY:
+		if (t1->t_dim != t2->t_dim)
+			return 0;
+		/*FALLTHROUGH*/
+	case PTR:
+		return sametype(t1->t_subt, t2->t_subt);
+	case ENUM:
+#ifdef t_enum
+		return strcmp(t1->t_enum->etag->s_name,
+		t2->t_enum->etag->s_name) == 0;
+#else
+		return 1;
+#endif
+	case STRUCT:
+	case UNION:
+#ifdef t_str
+		return strcmp(t1->t_str->stag->s_name,
+		t2->t_str->stag->s_name) == 0;
+#else
+		return 1;
+#endif
+	default:
+		LERROR("tyname(%d)", t);
+		return 0;
+	}
+}
+
 const char *
-tyname(char *buf, size_t bufsiz, type_t *tp)
+tyname(char *buf, size_t bufsiz, const type_t *tp)
 {
 	tspec_t	t;
 	const	char *s;



CVS commit: src/usr.bin/xlint/common

2016-08-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Aug 19 10:18:11 UTC 2016

Modified Files:
src/usr.bin/xlint/common: externs.h tyname.c

Log Message:
add a type comparison function.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 18:52:03 UTC 2014

Modified Files:
src/usr.bin/xlint/common: emit.c externs.h

Log Message:
make outname print where it came from in case of error


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/xlint/common/emit.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/xlint/common/externs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/emit.c
diff -u src/usr.bin/xlint/common/emit.c:1.5 src/usr.bin/xlint/common/emit.c:1.6
--- src/usr.bin/xlint/common/emit.c:1.5	Tue Apr 14 21:20:57 2009
+++ src/usr.bin/xlint/common/emit.c	Thu Apr 17 14:52:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: emit.c,v 1.5 2009/04/15 01:20:57 christos Exp $	*/
+/*	$NetBSD: emit.c,v 1.6 2014/04/17 18:52:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(lint)
-__RCSID($NetBSD: emit.c,v 1.5 2009/04/15 01:20:57 christos Exp $);
+__RCSID($NetBSD: emit.c,v 1.6 2014/04/17 18:52:03 christos Exp $);
 #endif
 
 #include ctype.h
@@ -216,11 +216,11 @@ outint(int i)
  * the name is preceded by its length
  */
 void
-outname(const char *name)
+outname1(const char *file, size_t line, const char *name)
 {
 
 	if (name == NULL)
-		errx(1, internal error: outname() 1);
+		errx(1, %s, %zu: internal error: outname(NULL), file, line);
 	outint((int)strlen(name));
 	outstrg(name);
 }

Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.4 src/usr.bin/xlint/common/externs.h:1.5
--- src/usr.bin/xlint/common/externs.h:1.4	Thu Apr  7 12:28:40 2005
+++ src/usr.bin/xlint/common/externs.h	Thu Apr 17 14:52:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.4 2005/04/07 16:28:40 christos Exp $	*/
+/*	$NetBSD: externs.h,v 1.5 2014/04/17 18:52:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -69,5 +69,6 @@ extern	void	outchar(int);
 extern	void	outqchar(int);
 extern	void	outstrg(const char *);
 extern	void	outint(int);
-extern	void	outname(const char *);
+#define outname(a)	outname1(__FILE__, __LINE__, a);
+extern	void	outname1(const char *, size_t, const char *);
 extern	void	outsrc(const char *);



CVS commit: src/usr.bin/xlint/common

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 18:52:03 UTC 2014

Modified Files:
src/usr.bin/xlint/common: emit.c externs.h

Log Message:
make outname print where it came from in case of error


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/xlint/common/emit.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/xlint/common/externs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/common

2012-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 20 18:50:11 UTC 2012

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
better to print (null) than core-dump


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.10 src/usr.bin/xlint/common/tyname.c:1.11
--- src/usr.bin/xlint/common/tyname.c:1.10	Fri Sep 26 19:51:04 2008
+++ src/usr.bin/xlint/common/tyname.c	Wed Jun 20 14:50:11 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.10 2008/09/26 23:51:04 matt Exp $	*/
+/*	$NetBSD: tyname.c,v 1.11 2012/06/20 18:50:11 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(lint)
-__RCSID($NetBSD: tyname.c,v 1.10 2008/09/26 23:51:04 matt Exp $);
+__RCSID($NetBSD: tyname.c,v 1.11 2012/06/20 18:50:11 christos Exp $);
 #endif
 
 #include limits.h
@@ -96,6 +96,8 @@ tyname(char *buf, size_t bufsiz, type_t 
 	char lbuf[64];
 	char cv[20];
 
+	if (tp == NULL)
+		return (null);
 	if ((t = tp-t_tspec) == INT  tp-t_isenum)
 		t = ENUM;
 



CVS commit: src/usr.bin/xlint/common

2012-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 20 18:50:11 UTC 2012

Modified Files:
src/usr.bin/xlint/common: tyname.c

Log Message:
better to print (null) than core-dump


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.