summaryrefslogtreecommitdiffstats
path: root/usr.bin/indent
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/indent')
-rw-r--r--usr.bin/indent/tests/comments.025
-rw-r--r--usr.bin/indent/tests/comments.0.stdout32
-rw-r--r--usr.bin/indent/tests/declarations.021
-rw-r--r--usr.bin/indent/tests/declarations.0.stdout15
-rw-r--r--usr.bin/indent/tests/elsecomment.018
-rw-r--r--usr.bin/indent/tests/elsecomment.0.stdout22
-rw-r--r--usr.bin/indent/tests/elsecomment.pro2
-rw-r--r--usr.bin/indent/tests/float.06
-rw-r--r--usr.bin/indent/tests/float.0.stdout8
-rw-r--r--usr.bin/indent/tests/label.013
-rw-r--r--usr.bin/indent/tests/label.0.stdout14
-rw-r--r--usr.bin/indent/tests/label.pro2
-rw-r--r--usr.bin/indent/tests/list_head.016
-rw-r--r--usr.bin/indent/tests/list_head.0.stdout14
-rw-r--r--usr.bin/indent/tests/nsac.04
-rw-r--r--usr.bin/indent/tests/nsac.0.stdout6
-rw-r--r--usr.bin/indent/tests/nsac.pro2
-rw-r--r--usr.bin/indent/tests/offsetof.05
-rw-r--r--usr.bin/indent/tests/offsetof.0.stdout7
-rw-r--r--usr.bin/indent/tests/sac.04
-rw-r--r--usr.bin/indent/tests/sac.0.stdout6
-rw-r--r--usr.bin/indent/tests/sac.pro2
-rw-r--r--usr.bin/indent/tests/struct.013
-rw-r--r--usr.bin/indent/tests/struct.0.stdout13
-rw-r--r--usr.bin/indent/tests/surplusbad.09
-rw-r--r--usr.bin/indent/tests/surplusbad.0.stdout9
-rw-r--r--usr.bin/indent/tests/surplusbad.pro2
-rw-r--r--usr.bin/indent/tests/types_from_file.03
-rw-r--r--usr.bin/indent/tests/types_from_file.0.stdout3
-rw-r--r--usr.bin/indent/tests/types_from_file.list2
-rw-r--r--usr.bin/indent/tests/types_from_file.pro2
-rw-r--r--usr.bin/indent/tests/wchar.06
-rw-r--r--usr.bin/indent/tests/wchar.0.stdout6
33 files changed, 312 insertions, 0 deletions
diff --git a/usr.bin/indent/tests/comments.0 b/usr.bin/indent/tests/comments.0
new file mode 100644
index 0000000..e642bcc
--- /dev/null
+++ b/usr.bin/indent/tests/comments.0
@@ -0,0 +1,25 @@
+/* $FreeBSD$ */
+/* See r303597, r303598, r309219, and r309343 */
+void t(void) {
+ /*
+ * Old indent wrapped the URL near where this sentence ends.
+ *
+ * https://www.freebsd.org/cgi/man.cgi?query=indent&apropos=0&sektion=0&manpath=FreeBSD+12-current&arch=default&format=html
+ */
+
+ /*
+ * Old indent did not wrap to column 78
+ *
+ * aaaaaa bbbbbb cccccc dddddd eeeeee ffffff ggggg hhhhh iiiii jjjj kk
+ */
+
+ /*
+ * Old indent unnecessarily removed the star comment continuation on the next line.
+ *
+ * *test*
+ */
+
+ /* r309219 Go through linked list, freeing from the malloced (t[-1]) address. */
+
+ /* r309343 */
+}
diff --git a/usr.bin/indent/tests/comments.0.stdout b/usr.bin/indent/tests/comments.0.stdout
new file mode 100644
index 0000000..62417bd
--- /dev/null
+++ b/usr.bin/indent/tests/comments.0.stdout
@@ -0,0 +1,32 @@
+/* $FreeBSD$ */
+/* See r303597, r303598, r309219, and r309343 */
+void
+t(void)
+{
+ /*
+ * Old indent wrapped the URL near where this sentence ends.
+ *
+ * https://www.freebsd.org/cgi/man.cgi?query=indent&apropos=0&sektion=0&manpath=FreeBSD+12-current&arch=default&format=html
+ */
+
+ /*
+ * Old indent did not wrap to column 78
+ *
+ * aaaaaa bbbbbb cccccc dddddd eeeeee ffffff ggggg hhhhh iiiii jjjj
+ * kk
+ */
+
+ /*
+ * Old indent unnecessarily removed the star comment continuation on
+ * the next line.
+ *
+ * *test*
+ */
+
+ /*
+ * r309219 Go through linked list, freeing from the malloced (t[-1])
+ * address.
+ */
+
+ /* r309343 */
+}
diff --git a/usr.bin/indent/tests/declarations.0 b/usr.bin/indent/tests/declarations.0
new file mode 100644
index 0000000..31183ac
--- /dev/null
+++ b/usr.bin/indent/tests/declarations.0
@@ -0,0 +1,21 @@
+/* $FreeBSD$ */
+/* See r303570 */
+void t(void) {
+ int a,
+ b,
+ c;
+ int
+ *d,
+ *e,
+ *f;
+ int (*g)(),
+ (*h)(),
+ (*i)();
+ int j,
+ k,
+ l;
+ int m
+ ,n
+ ,o
+ ;
+}
diff --git a/usr.bin/indent/tests/declarations.0.stdout b/usr.bin/indent/tests/declarations.0.stdout
new file mode 100644
index 0000000..972dd38
--- /dev/null
+++ b/usr.bin/indent/tests/declarations.0.stdout
@@ -0,0 +1,15 @@
+/* $FreeBSD$ */
+/* See r303570 */
+void
+t(void)
+{
+ int a, b, c;
+ int
+ *d, *e, *f;
+ int (*g) (), (*h) (), (*i) ();
+ int j, k, l;
+ int m
+ ,n
+ ,o
+ ;
+}
diff --git a/usr.bin/indent/tests/elsecomment.0 b/usr.bin/indent/tests/elsecomment.0
new file mode 100644
index 0000000..6744e19
--- /dev/null
+++ b/usr.bin/indent/tests/elsecomment.0
@@ -0,0 +1,18 @@
+/* $FreeBSD$ */
+/* See r303484 and r309342 */
+void t(void) {
+ if (0) {
+
+ } /* Old indent would remove the following blank line */
+
+ /*
+ * test
+ */
+
+ if (1)
+ ;
+ else /* Old indent would get very confused here */
+ {
+
+ }
+}
diff --git a/usr.bin/indent/tests/elsecomment.0.stdout b/usr.bin/indent/tests/elsecomment.0.stdout
new file mode 100644
index 0000000..ce78e17
--- /dev/null
+++ b/usr.bin/indent/tests/elsecomment.0.stdout
@@ -0,0 +1,22 @@
+/* $FreeBSD$ */
+/* See r303484 and r309342 */
+void
+t(void)
+{
+ if (0)
+ {
+
+ } /* Old indent would remove the following
+ * blank line */
+
+ /*
+ * test
+ */
+
+ if (1)
+ ;
+ else /* Old indent would get very confused here */
+ {
+
+ }
+}
diff --git a/usr.bin/indent/tests/elsecomment.pro b/usr.bin/indent/tests/elsecomment.pro
new file mode 100644
index 0000000..892386f
--- /dev/null
+++ b/usr.bin/indent/tests/elsecomment.pro
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+-bl
diff --git a/usr.bin/indent/tests/float.0 b/usr.bin/indent/tests/float.0
new file mode 100644
index 0000000..91f017f
--- /dev/null
+++ b/usr.bin/indent/tests/float.0
@@ -0,0 +1,6 @@
+/* $FreeBSD$ */
+/* See r303499 */
+void t(void) {
+ unsigned long x = 314UL;
+ float y = 3.14f;
+}
diff --git a/usr.bin/indent/tests/float.0.stdout b/usr.bin/indent/tests/float.0.stdout
new file mode 100644
index 0000000..03d92c3
--- /dev/null
+++ b/usr.bin/indent/tests/float.0.stdout
@@ -0,0 +1,8 @@
+/* $FreeBSD$ */
+/* See r303499 */
+void
+t(void)
+{
+ unsigned long x = 314UL;
+ float y = 3.14f;
+}
diff --git a/usr.bin/indent/tests/label.0 b/usr.bin/indent/tests/label.0
new file mode 100644
index 0000000..7798a4d
--- /dev/null
+++ b/usr.bin/indent/tests/label.0
@@ -0,0 +1,13 @@
+/* $FreeBSD$ */
+/* See r303489 */
+void t(void) {
+ switch (1)
+ {
+ case 1: /* test */
+ case 2: /* test */
+ }
+CLEANUP:
+ ;
+V: ;
+U: ;
+}
diff --git a/usr.bin/indent/tests/label.0.stdout b/usr.bin/indent/tests/label.0.stdout
new file mode 100644
index 0000000..99314f2
--- /dev/null
+++ b/usr.bin/indent/tests/label.0.stdout
@@ -0,0 +1,14 @@
+/* $FreeBSD$ */
+/* See r303489 */
+void
+t(void)
+{
+ switch (1) {
+ case 1: /* test */
+ case 2: /* test */
+ }
+CLEANUP:
+ ;
+V: ;
+U: ;
+}
diff --git a/usr.bin/indent/tests/label.pro b/usr.bin/indent/tests/label.pro
new file mode 100644
index 0000000..b5afc20
--- /dev/null
+++ b/usr.bin/indent/tests/label.pro
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+-nut
diff --git a/usr.bin/indent/tests/list_head.0 b/usr.bin/indent/tests/list_head.0
new file mode 100644
index 0000000..3a186ca
--- /dev/null
+++ b/usr.bin/indent/tests/list_head.0
@@ -0,0 +1,16 @@
+/* $FreeBSD$ */
+/* See r309380 */
+static int
+do_execve(td, args, mac_p)
+ struct thread *td;
+ struct image_args *args;
+ struct mac *mac_p;
+{
+
+}
+
+static LIST_HEAD(, alq) ald_active;
+static int ald_shuttingdown = 0;
+struct thread *ald_thread;
+
+
diff --git a/usr.bin/indent/tests/list_head.0.stdout b/usr.bin/indent/tests/list_head.0.stdout
new file mode 100644
index 0000000..b6f0762
--- /dev/null
+++ b/usr.bin/indent/tests/list_head.0.stdout
@@ -0,0 +1,14 @@
+/* $FreeBSD$ */
+/* See r309380 */
+static int
+do_execve(td, args, mac_p)
+ struct thread *td;
+ struct image_args *args;
+ struct mac *mac_p;
+{
+
+}
+
+static LIST_HEAD(, alq) ald_active;
+static int ald_shuttingdown = 0;
+struct thread *ald_thread;
diff --git a/usr.bin/indent/tests/nsac.0 b/usr.bin/indent/tests/nsac.0
new file mode 100644
index 0000000..449eadf
--- /dev/null
+++ b/usr.bin/indent/tests/nsac.0
@@ -0,0 +1,4 @@
+/* $FreeBSD$ */
+void t(void) {
+ int a = (double) 8;
+}
diff --git a/usr.bin/indent/tests/nsac.0.stdout b/usr.bin/indent/tests/nsac.0.stdout
new file mode 100644
index 0000000..1620931
--- /dev/null
+++ b/usr.bin/indent/tests/nsac.0.stdout
@@ -0,0 +1,6 @@
+/* $FreeBSD$ */
+void
+t(void)
+{
+ int a = (double)8;
+}
diff --git a/usr.bin/indent/tests/nsac.pro b/usr.bin/indent/tests/nsac.pro
new file mode 100644
index 0000000..ce2e4fe
--- /dev/null
+++ b/usr.bin/indent/tests/nsac.pro
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+-nsac
diff --git a/usr.bin/indent/tests/offsetof.0 b/usr.bin/indent/tests/offsetof.0
new file mode 100644
index 0000000..078db19
--- /dev/null
+++ b/usr.bin/indent/tests/offsetof.0
@@ -0,0 +1,5 @@
+/* $FreeBSD$ */
+/* See r303718 */
+void t(void) {
+ int n = malloc(offsetof(struct s, f) + 1);
+}
diff --git a/usr.bin/indent/tests/offsetof.0.stdout b/usr.bin/indent/tests/offsetof.0.stdout
new file mode 100644
index 0000000..d9f16d9
--- /dev/null
+++ b/usr.bin/indent/tests/offsetof.0.stdout
@@ -0,0 +1,7 @@
+/* $FreeBSD$ */
+/* See r303718 */
+void
+t(void)
+{
+ int n = malloc(offsetof(struct s, f) + 1);
+}
diff --git a/usr.bin/indent/tests/sac.0 b/usr.bin/indent/tests/sac.0
new file mode 100644
index 0000000..449eadf
--- /dev/null
+++ b/usr.bin/indent/tests/sac.0
@@ -0,0 +1,4 @@
+/* $FreeBSD$ */
+void t(void) {
+ int a = (double) 8;
+}
diff --git a/usr.bin/indent/tests/sac.0.stdout b/usr.bin/indent/tests/sac.0.stdout
new file mode 100644
index 0000000..a0e2e71
--- /dev/null
+++ b/usr.bin/indent/tests/sac.0.stdout
@@ -0,0 +1,6 @@
+/* $FreeBSD$ */
+void
+t(void)
+{
+ int a = (double) 8;
+}
diff --git a/usr.bin/indent/tests/sac.pro b/usr.bin/indent/tests/sac.pro
new file mode 100644
index 0000000..ad5cf1a
--- /dev/null
+++ b/usr.bin/indent/tests/sac.pro
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+-sac
diff --git a/usr.bin/indent/tests/struct.0 b/usr.bin/indent/tests/struct.0
new file mode 100644
index 0000000..9dfc31d
--- /dev/null
+++ b/usr.bin/indent/tests/struct.0
@@ -0,0 +1,13 @@
+/* $FreeBSD$ */
+/* See r303485 */
+void
+t(void)
+{
+ static const struct {
+ int a;
+ int b;
+ } c[] = {
+ { D, E },
+ { F, G }
+ };
+}
diff --git a/usr.bin/indent/tests/struct.0.stdout b/usr.bin/indent/tests/struct.0.stdout
new file mode 100644
index 0000000..ef62a12
--- /dev/null
+++ b/usr.bin/indent/tests/struct.0.stdout
@@ -0,0 +1,13 @@
+/* $FreeBSD$ */
+/* See r303485 */
+void
+t(void)
+{
+ static const struct {
+ int a;
+ int b;
+ } c[] = {
+ {D, E},
+ {F, G}
+ };
+}
diff --git a/usr.bin/indent/tests/surplusbad.0 b/usr.bin/indent/tests/surplusbad.0
new file mode 100644
index 0000000..07d0702
--- /dev/null
+++ b/usr.bin/indent/tests/surplusbad.0
@@ -0,0 +1,9 @@
+/* $FreeBSD$ */
+/* See r303599 */
+#if defined(__i386__)
+int a;
+#elif defined(__amd64__)
+int b;
+#else
+#error "Port me"
+#endif
diff --git a/usr.bin/indent/tests/surplusbad.0.stdout b/usr.bin/indent/tests/surplusbad.0.stdout
new file mode 100644
index 0000000..b288970
--- /dev/null
+++ b/usr.bin/indent/tests/surplusbad.0.stdout
@@ -0,0 +1,9 @@
+/* $FreeBSD$ */
+/* See r303599 */
+#if defined(__i386__)
+int a;
+#elif defined(__amd64__)
+int b;
+#else
+#error "Port me"
+#endif
diff --git a/usr.bin/indent/tests/surplusbad.pro b/usr.bin/indent/tests/surplusbad.pro
new file mode 100644
index 0000000..77c3a28
--- /dev/null
+++ b/usr.bin/indent/tests/surplusbad.pro
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+-bad
diff --git a/usr.bin/indent/tests/types_from_file.0 b/usr.bin/indent/tests/types_from_file.0
new file mode 100644
index 0000000..6efca24
--- /dev/null
+++ b/usr.bin/indent/tests/types_from_file.0
@@ -0,0 +1,3 @@
+/* $FreeBSD$ */
+/* See r303735 */
+void t(a *x, b *y, c *z);
diff --git a/usr.bin/indent/tests/types_from_file.0.stdout b/usr.bin/indent/tests/types_from_file.0.stdout
new file mode 100644
index 0000000..8776ca6
--- /dev/null
+++ b/usr.bin/indent/tests/types_from_file.0.stdout
@@ -0,0 +1,3 @@
+/* $FreeBSD$ */
+/* See r303735 */
+void t(a *x, b *y, c * z);
diff --git a/usr.bin/indent/tests/types_from_file.list b/usr.bin/indent/tests/types_from_file.list
new file mode 100644
index 0000000..5f73361
--- /dev/null
+++ b/usr.bin/indent/tests/types_from_file.list
@@ -0,0 +1,2 @@
+b
+a \ No newline at end of file
diff --git a/usr.bin/indent/tests/types_from_file.pro b/usr.bin/indent/tests/types_from_file.pro
new file mode 100644
index 0000000..571b673
--- /dev/null
+++ b/usr.bin/indent/tests/types_from_file.pro
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+-Utypes_from_file.list
diff --git a/usr.bin/indent/tests/wchar.0 b/usr.bin/indent/tests/wchar.0
new file mode 100644
index 0000000..9910e77
--- /dev/null
+++ b/usr.bin/indent/tests/wchar.0
@@ -0,0 +1,6 @@
+/* $FreeBSD$ */
+/* See r309220 */
+#include <wchar.h>
+
+wchar_t *x = L"test";
+wchar_t y = L't';
diff --git a/usr.bin/indent/tests/wchar.0.stdout b/usr.bin/indent/tests/wchar.0.stdout
new file mode 100644
index 0000000..92774ab
--- /dev/null
+++ b/usr.bin/indent/tests/wchar.0.stdout
@@ -0,0 +1,6 @@
+/* $FreeBSD$ */
+/* See r309220 */
+#include <wchar.h>
+
+wchar_t *x = L"test";
+wchar_t y = L't';
OpenPOWER on IntegriCloud