From 5349241098076bead63f638daf2e4b9a9cb3e496 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 31 Jul 2023 15:40:29 -0400 Subject: Fix for #elif evaluation issue (#3038) * A more way robust way to handle resource consumption might use multiple `kind`s on GLSL emit. * Improve method naming and some comments. * Small consistency fix. * Fix issue with #elif evaluation. * Add a test. --- tests/preprocessor/elif-eval.slang | 9 +++++++++ tests/preprocessor/elif-eval.slang.expected | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/preprocessor/elif-eval.slang create mode 100644 tests/preprocessor/elif-eval.slang.expected (limited to 'tests/preprocessor') diff --git a/tests/preprocessor/elif-eval.slang b/tests/preprocessor/elif-eval.slang new file mode 100644 index 000000000..912f70fd2 --- /dev/null +++ b/tests/preprocessor/elif-eval.slang @@ -0,0 +1,9 @@ +//TEST:SIMPLE: + +#ifndef SOME_MACRO +# error Not this one! +// The expression after #elif shouldn't be evaluated, because #ifndef evaluated as true +#elif SOME_OTHER_MACRO +#else +#error This isn't valid! +#endif diff --git a/tests/preprocessor/elif-eval.slang.expected b/tests/preprocessor/elif-eval.slang.expected new file mode 100644 index 000000000..04387be1c --- /dev/null +++ b/tests/preprocessor/elif-eval.slang.expected @@ -0,0 +1,8 @@ +result code = -1 +standard error = { +tests/preprocessor/elif-eval.slang(4): error 15900: #error: Not this one! +# error Not this one! + ^~~~~ +} +standard output = { +} -- cgit v1.2.3