[hackers] [scc] Add test for nested macro expansion || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sun, 27 Sep 2015 10:29:15 +0200 (CEST)

commit 8b47bd6c54891baebf6a1083c7b1f6fa0402b8e4
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sun Sep 27 10:28:19 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sun Sep 27 10:28:19 2015 +0200

    Add test for nested macro expansion
    
    This test also check what happens when a macro with arguments is
    found without them.

diff --git a/cc1/tests/test029.c b/cc1/tests/test029.c
new file mode 100644
index 0000000..3bdd2c9
--- /dev/null
+++ b/cc1/tests/test029.c
_AT_@ -0,0 +1,36 @@
+
+/*
+name: TEST029
+description: Test of nested expansion and refusing macro without arguments
+comments: f(2) will expand to 2*g, which will expand to 2*f, and in this
+ moment f will not be expanded because the macro definition is
+ a function alike macro, and in this case there is no arguments.
+output:
+test029.c:34: error: redefinition of 'f1'
+F2
+G3 F2 f1
+{
+\
+A4 I f
+ A4 #I2 *I
+}
+test029.c:35: error: 'f' undeclared
+*/
+
+
+#define f(a) a*g
+#define g f
+
+int
+f1(void)
+{
+ int f;
+
+ f(2);
+}
+
+int
+f1(void)
+{
+ f(2);
+}
Received on Sun Sep 27 2015 - 10:29:15 CEST

This archive was generated by hypermail 2.3.0 : Sun Sep 27 2015 - 10:36:18 CEST