summaryrefslogtreecommitdiff
path: root/tests/diagnostics/undefined-in-preprocessor-conditional.slang
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-09-19 08:32:28 -0700
committerGitHub <noreply@github.com>2018-09-19 08:32:28 -0700
commita37b3539d94c434c5d74ab524eae2988e48e0756 (patch)
tree248759eca216d5a47c2b8a5c7f54ec93fe46b3b1 /tests/diagnostics/undefined-in-preprocessor-conditional.slang
parent091f89aaf379d93a40a718a92a27e6c5ef2cbb23 (diff)
Warn when undefined identifier used in preprocessor conditional (#642)
This can mask an error when the user either typos a macro name when writing a conditional, or (as was the case for the user who pointed out this issue) they mistakenly assume that a `#define` in an `import`ed file has been made visible to them. This change just adds the warning in the obvious place, with a test code to ensure it triggers.
Diffstat (limited to 'tests/diagnostics/undefined-in-preprocessor-conditional.slang')
-rw-r--r--tests/diagnostics/undefined-in-preprocessor-conditional.slang10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/diagnostics/undefined-in-preprocessor-conditional.slang b/tests/diagnostics/undefined-in-preprocessor-conditional.slang
new file mode 100644
index 000000000..d46c68d33
--- /dev/null
+++ b/tests/diagnostics/undefined-in-preprocessor-conditional.slang
@@ -0,0 +1,10 @@
+//TEST(smoke):SIMPLE:
+
+// Use an undefined identifier in a preprocessor conditional
+
+#define FOO 1
+#define BORT 1
+
+#if FOO && BART
+#error Should not get here
+#endif