summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorT. Foley <tfoleyNV@users.noreply.github.com>2021-05-21 15:07:21 -0700
committerGitHub <noreply@github.com>2021-05-21 15:07:21 -0700
commit0389546b0b065303d3c6874891a9fab4428910b9 (patch)
tree4e0b1e3f34aea0a1729e0a5641efba3198fd2896 /tests
parentc4c90f5a6da45229405533372215ba40de91df37 (diff)
Overhaul the preprocessor (#1849)
* Overhaul the preprocessor The old Slang preprocessor was based on a simple mental model that tried to unify two parts of macro expansion: * Scanning for macro invocations in a sequence of tokens * Producing the expanded tokens for a macro expansion by substituting arguments into its body The basic was that substitution of macro arguments into a macro definition is superficially similar to top-level macro expansion, just with an environment where the macro arguments act like `#define`s for the corresponding parameter names. That approach was "clever" and could conceivably have been extended to include a lot of advanced preprocessor features (e.g., a preprocessor-level `lambda` would be easy to support!), but it was basically impossible to make it correctly handle all the corner cases of the full C/C++ preprocessor. The fundamental problem with the old approach was that it conflated the two parts of expansion listed above into one implementation, while the various special cases of the C/C++ preprocessor rely on treating the two cases very differently. The new approach here (which is somewhere between a refactor and a full rewrite of the preprocessor) changes things up in a few key ways: * The abstraction still cares a lot about streams of tokens, but it now treats the top level streams (`InputFile`s) as fairly different from the lower-level streams (`InputStream`s) * Macro expansion is handled as a dedicated type of stream that wraps another stream. This allows macro expansion to be applied to anything, and supports cases where multiple rounds of macro expansion are required by the spec. * Macro *invocations* and the substitution of their arguments are now handled by a completely new system. * Macro arguments are no longer treated as if they were `#define`s * The macro body/definition is analyzed at definition time to detect various kinds of issues, and to derive a list of "ops" that make it easier to "play back" the definition at substitution time * Token pasting and stringizing are now only handled in macro definitions (rather than being allowed anywhere), and their use cases are restricted to only those that make sense (e.g., you can't stringize anythign except a macro parameter, because anything else wouldn't make sense) The key new types here are the `ExpansionInputStream` which handles scanning for macro invocations, and the `MacroInvocation` type, which handles playing back the macro body with substitutions. The `ExpansionInputStream` is the easier of the two to understand. By refactoring it to use a single token of lookahead, the one major detail it had to deal with before (abandoning expansion of a function-like macro if the macro name was not followed by `(`) is significantly easier to manage. The more subtle part is the `MacroInvocation` type, and most of the complexity there is around handling of token pasting, and the fact that either or both of the operands to a token paste might be empty. Many of the test cases that exposed the problems in the preprocessor have been moved from `current-bugs` to `preprocessor` since they now work correctly. * debugging: enable extractor command line dump * fixup * fixup
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/token-limit.slang3
-rw-r--r--tests/current-bugs/paste-non-expansion.slang16
-rw-r--r--tests/current-bugs/preproc-concat-5.slang13
-rw-r--r--tests/current-bugs/preproc-detail-1.slang.expected7
-rw-r--r--tests/current-bugs/preproc-expand-1.slang16
-rw-r--r--tests/current-bugs/preproc-pound-pound-1.slang.expected6
-rw-r--r--tests/diagnostics/token-paste-location.slang4
-rw-r--r--tests/diagnostics/token-paste-location.slang.expected6
-rw-r--r--tests/diagnostics/x-macro-line-continuation.slang.expected6
-rw-r--r--tests/parser/incomplete-member-decl.slang.expected1
-rw-r--r--tests/preprocessor/error.slang.expected2
-rw-r--r--tests/preprocessor/paste-non-expansion.slang13
-rw-r--r--tests/preprocessor/paste-non-expansion.slang.expected (renamed from tests/current-bugs/paste-non-expansion.slang.expected)2
-rw-r--r--tests/preprocessor/preproc-concat-1.slang (renamed from tests/current-bugs/preproc-concat-1.slang)4
-rw-r--r--tests/preprocessor/preproc-concat-1.slang.expected (renamed from tests/current-bugs/preproc-concat-1.slang.expected)2
-rw-r--r--tests/preprocessor/preproc-concat-2.slang (renamed from tests/current-bugs/preproc-concat-2.slang)4
-rw-r--r--tests/preprocessor/preproc-concat-2.slang.expected (renamed from tests/current-bugs/preproc-concat-2.slang.expected)2
-rw-r--r--tests/preprocessor/preproc-concat-3.slang (renamed from tests/current-bugs/preproc-concat-3.slang)4
-rw-r--r--tests/preprocessor/preproc-concat-3.slang.expected9
-rw-r--r--tests/preprocessor/preproc-concat-4.slang (renamed from tests/current-bugs/preproc-concat-4.slang)4
-rw-r--r--tests/preprocessor/preproc-concat-4.slang.expected (renamed from tests/current-bugs/preproc-concat-4.slang.expected)2
-rw-r--r--tests/preprocessor/preproc-concat-5.slang.expected (renamed from tests/current-bugs/preproc-detail-2.slang.expected)2
-rw-r--r--tests/preprocessor/preproc-detail-1.slang (renamed from tests/current-bugs/preproc-detail-1.slang)4
-rw-r--r--tests/preprocessor/preproc-detail-1.slang.expected (renamed from tests/current-bugs/preproc-concat-3.slang.expected)2
-rw-r--r--tests/preprocessor/preproc-detail-2.slang (renamed from tests/current-bugs/preproc-detail-2.slang)2
-rw-r--r--tests/preprocessor/preproc-detail-2.slang.expected9
-rw-r--r--tests/preprocessor/preproc-detail-3.slang (renamed from tests/current-bugs/preproc-detail-3.slang)2
-rw-r--r--tests/preprocessor/preproc-detail-3.slang.expected (renamed from tests/current-bugs/preproc-detail-3.slang.expected)2
-rw-r--r--tests/preprocessor/preproc-expand-1.slang.expected (renamed from tests/current-bugs/preproc-expand-1.slang.expected)2
-rw-r--r--tests/preprocessor/preproc-pound-pound-1.slang (renamed from tests/current-bugs/preproc-pound-pound-1.slang)4
-rw-r--r--tests/preprocessor/preproc-pound-pound-1.slang.expected9
-rw-r--r--tests/preprocessor/preproc-pound-pound-2.slang (renamed from tests/current-bugs/preproc-pound-pound-2.slang)4
-rw-r--r--tests/preprocessor/preproc-pound-pound-2.slang.expected (renamed from tests/current-bugs/preproc-pound-pound-2.slang.expected)2
-rw-r--r--tests/preprocessor/preproc-stringify-1.slang (renamed from tests/current-bugs/preproc-stringify-1.slang)4
-rw-r--r--tests/preprocessor/preproc-stringify-1.slang.expected (renamed from tests/current-bugs/preproc-stringify-1.slang.expected)2
-rw-r--r--tests/preprocessor/warning.slang.expected2
36 files changed, 71 insertions, 107 deletions
diff --git a/tests/bugs/token-limit.slang b/tests/bugs/token-limit.slang
index bab18575c..8f7046296 100644
--- a/tests/bugs/token-limit.slang
+++ b/tests/bugs/token-limit.slang
@@ -6,7 +6,8 @@
// Build up a 2048 byte name
#define LONG_NAME abcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGHabcdefghABCDEFGH
-#define CONCAT(A, B) A ## B
+#define CONCAT2(A, B) A ## B
+#define CONCAT(A, B) CONCAT2(A, B)
//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4):name=inputBuffer
RWStructuredBuffer<int> inputBuffer;
diff --git a/tests/current-bugs/paste-non-expansion.slang b/tests/current-bugs/paste-non-expansion.slang
deleted file mode 100644
index 8270db676..000000000
--- a/tests/current-bugs/paste-non-expansion.slang
+++ /dev/null
@@ -1,16 +0,0 @@
-//DIAGNOSTIC_TEST:SIMPLE:-E
-
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
-// This demonstrates the existance of a bug in Slang preprocessor macro expansion. Could be due to incorrect paste handling
-// or perhaps the rules around parameter expansion.
-
-#define CONCAT2(x, y) x ## y
-#define CONCAT(x, y) CONCAT2(x, y)
-
-#define SOMETHING someThing
-
-// Should be someThingElse
-CONCAT(SOMETHING, Else)
-// Should be SOMETHINGAnother, but Slang expands to produce someThingAnother
-CONCAT2(SOMETHING, Another) \ No newline at end of file
diff --git a/tests/current-bugs/preproc-concat-5.slang b/tests/current-bugs/preproc-concat-5.slang
deleted file mode 100644
index 2be554f89..000000000
--- a/tests/current-bugs/preproc-concat-5.slang
+++ /dev/null
@@ -1,13 +0,0 @@
-//DISABLE_DIAGNOSTIC_TEST:SIMPLE:-E
-
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
-// It should produce 'THING', as the original invocation should have disabled THING,
-// but it actually ends up in an infinite loop.
-
-#define CONCAT(x, y) x ## y
-
-#define THING2 THING
-#define THING CONCAT(THING, 2)
-
-THING
diff --git a/tests/current-bugs/preproc-detail-1.slang.expected b/tests/current-bugs/preproc-detail-1.slang.expected
deleted file mode 100644
index ba93983af..000000000
--- a/tests/current-bugs/preproc-detail-1.slang.expected
+++ /dev/null
@@ -1,7 +0,0 @@
-result code = 0
-standard error = {
-tests/current-bugs/preproc-detail-1.slang(10): error 15501: wrong number of arguments to macro (expected 1, got 0)
-}
-standard output = {
-
-}
diff --git a/tests/current-bugs/preproc-expand-1.slang b/tests/current-bugs/preproc-expand-1.slang
deleted file mode 100644
index f95b432e2..000000000
--- a/tests/current-bugs/preproc-expand-1.slang
+++ /dev/null
@@ -1,16 +0,0 @@
-//DIAGNOSTIC_TEST:SIMPLE:-E
-
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
-// Should produce: Hi
-// Slang produces: C ( Hi )
-
-#define OPEN (
-#define CLOSE )
-
-#define C(x) x
-
-#define B(x) x
-
-B(C OPEN Hi CLOSE)
-
diff --git a/tests/current-bugs/preproc-pound-pound-1.slang.expected b/tests/current-bugs/preproc-pound-pound-1.slang.expected
deleted file mode 100644
index 80a64402a..000000000
--- a/tests/current-bugs/preproc-pound-pound-1.slang.expected
+++ /dev/null
@@ -1,6 +0,0 @@
-result code = 0
-standard error = {
-}
-standard output = {
-Hello ## There ;
-}
diff --git a/tests/diagnostics/token-paste-location.slang b/tests/diagnostics/token-paste-location.slang
index 4da66bab3..ded5892f7 100644
--- a/tests/diagnostics/token-paste-location.slang
+++ b/tests/diagnostics/token-paste-location.slang
@@ -1,8 +1,8 @@
//DIAGNOSTIC_TEST:SIMPLE:
-#define SOME %
-#define THING %
+#define SOME +
+#define THING +
#define A SOME
#define B THING
diff --git a/tests/diagnostics/token-paste-location.slang.expected b/tests/diagnostics/token-paste-location.slang.expected
index 987bff15e..4ebdf4f3a 100644
--- a/tests/diagnostics/token-paste-location.slang.expected
+++ b/tests/diagnostics/token-paste-location.slang.expected
@@ -1,9 +1,9 @@
result code = -1
standard error = {
-token paste(1): error 20001: unexpected '%', expected identifier
+token paste(1): error 20001: unexpected '++', expected identifier
tests/diagnostics/token-paste-location.slang(10): note: see token pasted location
-%%
-^
+++
+^~
}
standard output = {
}
diff --git a/tests/diagnostics/x-macro-line-continuation.slang.expected b/tests/diagnostics/x-macro-line-continuation.slang.expected
index 6b910b701..306123ec5 100644
--- a/tests/diagnostics/x-macro-line-continuation.slang.expected
+++ b/tests/diagnostics/x-macro-line-continuation.slang.expected
@@ -1,8 +1,8 @@
result code = -1
standard error = {
-tests/diagnostics/x-macro-line-continuation.slang(12): error 15501: wrong number of arguments to macro (expected 1, got 2)
- M(5) \
- ^
+tests/diagnostics/x-macro-line-continuation.slang(11): error 15501: wrong number of arguments to macro (expected 1, got 2)
+ M(4, 4) \
+ ^
}
standard output = {
}
diff --git a/tests/parser/incomplete-member-decl.slang.expected b/tests/parser/incomplete-member-decl.slang.expected
index ed5695977..d7df41f58 100644
--- a/tests/parser/incomplete-member-decl.slang.expected
+++ b/tests/parser/incomplete-member-decl.slang.expected
@@ -3,6 +3,7 @@ standard error = {
tests/parser/incomplete-member-decl.slang(19): error 20001: unexpected identifier, expected '('
int MyType<X> inner;
^~~~~
+tests/parser/incomplete-member-decl.slang(20): error 20001: unexpected end of file, expected identifier
}
standard output = {
}
diff --git a/tests/preprocessor/error.slang.expected b/tests/preprocessor/error.slang.expected
index 927819780..f191f7aaa 100644
--- a/tests/preprocessor/error.slang.expected
+++ b/tests/preprocessor/error.slang.expected
@@ -1,6 +1,6 @@
result code = -1
standard error = {
-tests/preprocessor/error.slang(11): error 15900: #error: This isn't valid!
+tests/preprocessor/error.slang(11): error 15900: #error: This isn't valid!
#error This isn't valid!
^~~~~
}
diff --git a/tests/preprocessor/paste-non-expansion.slang b/tests/preprocessor/paste-non-expansion.slang
new file mode 100644
index 000000000..d3487aeef
--- /dev/null
+++ b/tests/preprocessor/paste-non-expansion.slang
@@ -0,0 +1,13 @@
+//DIAGNOSTIC_TEST:SIMPLE:-E
+
+// This os a regression test for a bug in Slang preprocessor macro expansion.
+
+#define CONCAT2(x, y) x ## y
+#define CONCAT(x, y) CONCAT2(x, y)
+
+#define SOMETHING someThing
+
+// Should be someThingElse
+CONCAT(SOMETHING, Else)
+// Should be SOMETHINGAnother, but old Slang expands to produce someThingAnother
+CONCAT2(SOMETHING, Another) \ No newline at end of file
diff --git a/tests/current-bugs/paste-non-expansion.slang.expected b/tests/preprocessor/paste-non-expansion.slang.expected
index 2fbb7bad3..b62416de7 100644
--- a/tests/current-bugs/paste-non-expansion.slang.expected
+++ b/tests/preprocessor/paste-non-expansion.slang.expected
@@ -2,5 +2,5 @@ result code = 0
standard error = {
}
standard output = {
-someThingElse someThingAnother
+someThingElse SOMETHINGAnother
}
diff --git a/tests/current-bugs/preproc-concat-1.slang b/tests/preprocessor/preproc-concat-1.slang
index d9f205457..44d6c1d61 100644
--- a/tests/current-bugs/preproc-concat-1.slang
+++ b/tests/preprocessor/preproc-concat-1.slang
@@ -1,11 +1,9 @@
//DIAGNOSTIC_TEST:SIMPLE:-E
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
#define CONCAT(a, b) a ## b
// Correct output AB;
-// Slang output
+// Old Slang output
// ab;
#define A a
diff --git a/tests/current-bugs/preproc-concat-1.slang.expected b/tests/preprocessor/preproc-concat-1.slang.expected
index 673d7bc4c..84e8c280f 100644
--- a/tests/current-bugs/preproc-concat-1.slang.expected
+++ b/tests/preprocessor/preproc-concat-1.slang.expected
@@ -2,5 +2,5 @@ result code = 0
standard error = {
}
standard output = {
-ab ;
+AB ;
}
diff --git a/tests/current-bugs/preproc-concat-2.slang b/tests/preprocessor/preproc-concat-2.slang
index f3c4d28ff..b965eeaa3 100644
--- a/tests/current-bugs/preproc-concat-2.slang
+++ b/tests/preprocessor/preproc-concat-2.slang
@@ -1,7 +1,5 @@
//DIAGNOSTIC_TEST:SIMPLE:-E
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
#define CONCAT(a, b) a ## b
#define A a
@@ -11,7 +9,7 @@
#define B2 B
// Correct output: a A2B2 b;
-// Slang output
+// Old Slang output
// a ab b ;
CONCAT(A2 A2, B2 B2);
diff --git a/tests/current-bugs/preproc-concat-2.slang.expected b/tests/preprocessor/preproc-concat-2.slang.expected
index 4b30fc7c2..1badd0da0 100644
--- a/tests/current-bugs/preproc-concat-2.slang.expected
+++ b/tests/preprocessor/preproc-concat-2.slang.expected
@@ -2,5 +2,5 @@ result code = 0
standard error = {
}
standard output = {
-a ab b ;
+a A2B2 b ;
}
diff --git a/tests/current-bugs/preproc-concat-3.slang b/tests/preprocessor/preproc-concat-3.slang
index c4077f75d..7f1953a2d 100644
--- a/tests/current-bugs/preproc-concat-3.slang
+++ b/tests/preprocessor/preproc-concat-3.slang
@@ -1,7 +1,5 @@
//DIAGNOSTIC_TEST:SIMPLE:-E
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
#define CONCAT(a, b) a ## b
#define A a
@@ -13,6 +11,6 @@
// Gives error (as trys to concat unexpanded input)
// <source>:11:1: error: pasting formed ')CONCAT', an invalid preprocessing token
//
-// Slang output: aabb ;
+// Old Slang output: aabb ;
CONCAT(CONCAT(A2, A2), CONCAT(B2, B2));
diff --git a/tests/preprocessor/preproc-concat-3.slang.expected b/tests/preprocessor/preproc-concat-3.slang.expected
new file mode 100644
index 000000000..b39a659ed
--- /dev/null
+++ b/tests/preprocessor/preproc-concat-3.slang.expected
@@ -0,0 +1,9 @@
+result code = 0
+standard error = {
+tests/preprocessor/preproc-concat-3.slang(5): warning 15503: toking pasting with '##' resulted in the invalid token ')CONCAT'
+#define CONCAT(a, b) a ## b
+ ^~
+}
+standard output = {
+CONCAT ( a , a ) CONCAT ( b , b ) ;
+}
diff --git a/tests/current-bugs/preproc-concat-4.slang b/tests/preprocessor/preproc-concat-4.slang
index 31ec16268..4d1e3425f 100644
--- a/tests/current-bugs/preproc-concat-4.slang
+++ b/tests/preprocessor/preproc-concat-4.slang
@@ -1,7 +1,5 @@
//DIAGNOSTIC_TEST:SIMPLE:-E
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
#define CONCAT(a, b) a ## b
#define A a
@@ -17,7 +15,7 @@
// CONCAT is disabled, A and B are expanded on next pass
// A2 B2 are first and last tokens pre expansion args
//
-// Slang outputs
+// Old Slang outputs
// ab ab ab
CONCAT(CONCAT(A, B) A2, B2 CONCAT(A, B))
diff --git a/tests/current-bugs/preproc-concat-4.slang.expected b/tests/preprocessor/preproc-concat-4.slang.expected
index 82d7225b2..6d3b1ca59 100644
--- a/tests/current-bugs/preproc-concat-4.slang.expected
+++ b/tests/preprocessor/preproc-concat-4.slang.expected
@@ -2,5 +2,5 @@ result code = 0
standard error = {
}
standard output = {
-ab ab ab
+CONCAT ( a , b ) A2B2 CONCAT ( a , b )
}
diff --git a/tests/current-bugs/preproc-detail-2.slang.expected b/tests/preprocessor/preproc-concat-5.slang.expected
index b48d7909f..a401f9c6c 100644
--- a/tests/current-bugs/preproc-detail-2.slang.expected
+++ b/tests/preprocessor/preproc-concat-5.slang.expected
@@ -2,5 +2,5 @@ result code = 0
standard error = {
}
standard output = {
-a b c
+THING
}
diff --git a/tests/current-bugs/preproc-detail-1.slang b/tests/preprocessor/preproc-detail-1.slang
index 4cff0d205..ed465c38c 100644
--- a/tests/current-bugs/preproc-detail-1.slang
+++ b/tests/preprocessor/preproc-detail-1.slang
@@ -1,9 +1,7 @@
//DIAGNOSTIC_TEST:SIMPLE:-E
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
// If a macro can take a single parameter, it is valid to pass in 'nothing'.
-// Slang outputs an error about the wrong amount of parameters
+// Old Slang outputs an error about the wrong amount of parameters
// Correct output: a b
#define A(x) a x b
diff --git a/tests/current-bugs/preproc-concat-3.slang.expected b/tests/preprocessor/preproc-detail-1.slang.expected
index 8be308266..7ebaef377 100644
--- a/tests/current-bugs/preproc-concat-3.slang.expected
+++ b/tests/preprocessor/preproc-detail-1.slang.expected
@@ -2,5 +2,5 @@ result code = 0
standard error = {
}
standard output = {
-aabb ;
+a b
}
diff --git a/tests/current-bugs/preproc-detail-2.slang b/tests/preprocessor/preproc-detail-2.slang
index eb687db31..7cb0c4f7e 100644
--- a/tests/current-bugs/preproc-detail-2.slang
+++ b/tests/preprocessor/preproc-detail-2.slang
@@ -1,7 +1,5 @@
//DIAGNOSTIC_TEST:SIMPLE:-E
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
// Macro parameters must have unique names
#define A(x, x) a x b x c
diff --git a/tests/preprocessor/preproc-detail-2.slang.expected b/tests/preprocessor/preproc-detail-2.slang.expected
new file mode 100644
index 000000000..16468fc68
--- /dev/null
+++ b/tests/preprocessor/preproc-detail-2.slang.expected
@@ -0,0 +1,9 @@
+result code = 0
+standard error = {
+tests/preprocessor/preproc-detail-2.slang(7): error 15408: redefinition of macro parameter 'A'
+#define A(x, x) a x b x c
+ ^
+}
+standard output = {
+a b c
+}
diff --git a/tests/current-bugs/preproc-detail-3.slang b/tests/preprocessor/preproc-detail-3.slang
index b0675204b..7d07af33b 100644
--- a/tests/current-bugs/preproc-detail-3.slang
+++ b/tests/preprocessor/preproc-detail-3.slang
@@ -1,7 +1,5 @@
//DIAGNOSTIC_TEST:SIMPLE:-E
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
// Undefining a macro that is not defined within C/C++ is defined as *not* an error or a warning.
// On checking with DXC/FXC they also have this behavior (ie they don't output anything)
// It's arguable if Slang should match this behavior - at least it is a warning.
diff --git a/tests/current-bugs/preproc-detail-3.slang.expected b/tests/preprocessor/preproc-detail-3.slang.expected
index a44c60220..44f38e85f 100644
--- a/tests/current-bugs/preproc-detail-3.slang.expected
+++ b/tests/preprocessor/preproc-detail-3.slang.expected
@@ -1,6 +1,6 @@
result code = 0
standard error = {
-tests/current-bugs/preproc-detail-3.slang(9): warning 15401: macro 'C' is not defined
+tests/preprocessor/preproc-detail-3.slang(9): warning 15401: macro 'C' is not defined
#undef C
^
}
diff --git a/tests/current-bugs/preproc-expand-1.slang.expected b/tests/preprocessor/preproc-expand-1.slang.expected
index d46fa1159..70aa3f352 100644
--- a/tests/current-bugs/preproc-expand-1.slang.expected
+++ b/tests/preprocessor/preproc-expand-1.slang.expected
@@ -2,5 +2,5 @@ result code = 0
standard error = {
}
standard output = {
-C ( Hi )
+Hi
}
diff --git a/tests/current-bugs/preproc-pound-pound-1.slang b/tests/preprocessor/preproc-pound-pound-1.slang
index 7f369b861..3aa157bae 100644
--- a/tests/current-bugs/preproc-pound-pound-1.slang
+++ b/tests/preprocessor/preproc-pound-pound-1.slang
@@ -1,10 +1,8 @@
//DIAGNOSTIC_TEST:SIMPLE:-E
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
// GCC: <source>:1:9: error: '##' cannot appear at either end of a macro expansion.
// Clang: <source>:1:21: error: '##' cannot appear at start of macro expansion
-// Slang outputs Hello ## There;
+// Old Slang outputs Hello ## There;
#define POUND_POUND ##
Hello POUND_POUND There;
diff --git a/tests/preprocessor/preproc-pound-pound-1.slang.expected b/tests/preprocessor/preproc-pound-pound-1.slang.expected
new file mode 100644
index 000000000..92ba92f20
--- /dev/null
+++ b/tests/preprocessor/preproc-pound-pound-1.slang.expected
@@ -0,0 +1,9 @@
+result code = 0
+standard error = {
+tests/preprocessor/preproc-pound-pound-1.slang(8): error 15405: '##' is not allowed at the start of a macro body
+#define POUND_POUND ##
+ ^~
+}
+standard output = {
+Hello ## There ;
+}
diff --git a/tests/current-bugs/preproc-pound-pound-2.slang b/tests/preprocessor/preproc-pound-pound-2.slang
index 44181261b..d8038c2d4 100644
--- a/tests/current-bugs/preproc-pound-pound-2.slang
+++ b/tests/preprocessor/preproc-pound-pound-2.slang
@@ -1,13 +1,11 @@
//DIAGNOSTIC_TEST:SIMPLE:-E
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
#define A a
#define B b
#define OBJ A ## B
// Should output AB
-// Slang outputs ab
+// Old Slang outputs ab
OBJ
diff --git a/tests/current-bugs/preproc-pound-pound-2.slang.expected b/tests/preprocessor/preproc-pound-pound-2.slang.expected
index a818a4683..cacad8abd 100644
--- a/tests/current-bugs/preproc-pound-pound-2.slang.expected
+++ b/tests/preprocessor/preproc-pound-pound-2.slang.expected
@@ -2,5 +2,5 @@ result code = 0
standard error = {
}
standard output = {
-ab
+AB
}
diff --git a/tests/current-bugs/preproc-stringify-1.slang b/tests/preprocessor/preproc-stringify-1.slang
index 03e8366b5..32bfb00cc 100644
--- a/tests/current-bugs/preproc-stringify-1.slang
+++ b/tests/preprocessor/preproc-stringify-1.slang
@@ -1,13 +1,11 @@
//DIAGNOSTIC_TEST:SIMPLE:-E
-// NOTE! This test should *fail*, if preprocessor is working correctly!
-
#define A a
#define B b
// Correct output
// "A B"
-// Slang output
+// Old Slang output
// # a b ;
#define STRINGIFY(x) #x
diff --git a/tests/current-bugs/preproc-stringify-1.slang.expected b/tests/preprocessor/preproc-stringify-1.slang.expected
index 53efce117..dac301880 100644
--- a/tests/current-bugs/preproc-stringify-1.slang.expected
+++ b/tests/preprocessor/preproc-stringify-1.slang.expected
@@ -2,5 +2,5 @@ result code = 0
standard error = {
}
standard output = {
-# a b ;
+"A B" ;
}
diff --git a/tests/preprocessor/warning.slang.expected b/tests/preprocessor/warning.slang.expected
index 66b1e5f17..23efd1479 100644
--- a/tests/preprocessor/warning.slang.expected
+++ b/tests/preprocessor/warning.slang.expected
@@ -1,6 +1,6 @@
result code = 0
standard error = {
-tests/preprocessor/warning.slang(9): warning 15901: #warning: You wouldn't like me when I'm angry...
+tests/preprocessor/warning.slang(9): warning 15901: #warning: You wouldn't like me when I'm angry...
#warning You wouldn't like me when I'm angry...
^~~~~~~
}