microsoft / microsoft/DirectXShaderCompiler

#pragma once cannot support path aliases

Open
#3,943 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

By using the -I <path> flag, it is possible to specify an additional root folder in which to look for headers.
This means that the same file can be included as:

#include "MyFile.h" // local include
#include "Root/../MyFile.h" // absolute include from the specified path

#pragma once considers the two paths above as different, and this causes the same file to be included twice.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the two include forms shown in the report and inspect the compiler's preprocessor handling of #pragma once and header path identity. Determine how the same physical header is tracked under aliased paths; done means both include forms are recognized as one file and the header is not processed twice.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.