From 06f0effb848c6b938e03da8a61e44b3d032380e8 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 26 Jan 2018 15:30:23 -0800 Subject: Fix handling of errors in imported modules (#387) * Fix handling of errors in imported modules - If a semantic error is detected in an imported module, then don't try to generate IR code for it - Also, if a module (transitively) imports itself, then report that as an error - The way I'm checking for this is a bit hacky (I'm adding the module to the map of loaded modules, but in an "unfinished" state, and then using that unfinished state to detect the import of a module already being imported). This isn't a 100% complete solution for any of the related problems, but it improves the user experience for the common case. * Remove #import test. The feature is slated to be removed, so it isn't worth fixing up this test case. --- tests/preprocessor/import.hlsl | 18 ------------------ tests/preprocessor/import.slang.h | 12 ------------ 2 files changed, 30 deletions(-) delete mode 100644 tests/preprocessor/import.hlsl delete mode 100644 tests/preprocessor/import.slang.h (limited to 'tests/preprocessor') diff --git a/tests/preprocessor/import.hlsl b/tests/preprocessor/import.hlsl deleted file mode 100644 index f0618a667..000000000 --- a/tests/preprocessor/import.hlsl +++ /dev/null @@ -1,18 +0,0 @@ -//TEST:SIMPLE:-target none -profile vs_5_0 - -// Confirm that `#import` interacts with preprocessor as expected - -// Here is a macro that flows from parent to child file -#define FOO float - -// Here we import the child file -#import "import.slang.h" - -// Here we use a macro that flows the other way (child->parent) -BAR g( FOO x ) { return f(x); } - -// Here we confirm that importing the file again is a no-op -#import "import.slang.h" - -void main() -{} diff --git a/tests/preprocessor/import.slang.h b/tests/preprocessor/import.slang.h deleted file mode 100644 index a97a199f0..000000000 --- a/tests/preprocessor/import.slang.h +++ /dev/null @@ -1,12 +0,0 @@ -// Confirm that `#import` interacts with preprocessor as expected - -// We add a guard to ensure that this file isn't imported more than once -#ifdef BAR -#error File imported more than one! -#endif - -// Here we use a macro from the parent file -FOO f( FOO y ) { return y; } - -// Here is a macro that flows from child to parent -#define BAR float -- cgit v1.2.3