Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#247 Implement pragma once directive. #267

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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