Skip to content

Conversation

@TIMONz1535
Copy link

@TIMONz1535 TIMONz1535 commented Apr 20, 2024

  • When the lexer parses pragma directive with the first keyword once, it adds current File.FilePath to the HashSet.
  • Then when the lexer parses include directive it checks if it Contains include.FilePath and doesn't invoke PushIncludeContext (doesn't include the file content).
  • Added test for #pragma once but without path aliases, because InMemoryFileSystem can't handle it properly.
  • Regarding to DXC bug #pragma once cannot support path aliases microsoft/DirectXShaderCompiler#3943 it also cannot support path aliases. It is also case sensitive (not a bug really, its Windows magic). Well its correlates with the latest DXC release!
objects:
	header.hlsli:
		#pragma once
	object.hlsl:
		#include "header.hlsli" // valid
		#include "header.hlsli" // valid, skip

shading.hlsl:
	#include "objects/header.hlsli" // valid, skip
	#include "objects/object.hlsl" // skip header, but not object
	#include "objects/Header.hlsli" // redefinition, because don't do that
	// dxc bug
	#include "fake/../objects/header.hlsli" // on no, redefinition
	#include "fake/../objects/object.hlsl" // on no, another redefinition of header

If you don't know how to resolve the conflict with VariadicArgument, just put OnceKeyword after WarningKeyword but before VariadicArgument.

изображение

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant