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

Undefine major and minor through <sys/sysmacros.h> #1988

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

Conversation

gulfemsavrun
Copy link

<sys/sysmacros.h> is included through some other headers. This results in major(x) being resolved to gnu_dev_major(x) which is an expression in a constructor initializer list. This patch includes <sys/sysmacros.h> at the very beginning, and undefines major and minor to avoid them to be resolved to gnu_dev_major(x) or gnu_dev_minor(x).

<sys/sysmacros.h> is included through some other headers.
This results in major(x) being resolved to gnu_dev_major(x)
which is an expression in a constructor initializer list.
This patch includes <sys/sysmacros.h> at the very beginning,
and undefines major and minor to avoid them to be resolved
to gnu_dev_major(x) or gnu_dev_minor(x).
@CLAassistant
Copy link

CLAassistant commented Nov 1, 2024

CLA assistant check
All committers have signed the CLA.

@asuessenbach
Copy link
Contributor

I think, sys/sysmacros.h is not available on every platform supported by Vulkan-Hpp. Therefore, you can't just include it.

Essentially, you just moved the undef of major and minor a few lines up... where exactly would you need that, and why?

And, by the way, vulkan.hpp is a generated file, you can't modify that file directly. Changes of that kind should be done to the appropriate files in Vulkan-Hpp/snippets, maybe snippets/defines.hpp.

@gulfemsavrun
Copy link
Author

gulfemsavrun commented Nov 4, 2024

@asuessenbach thanks for your response. I'm not familiar this codebase, and we currently have an issue in our project, where we use Vulkan-Headers as third_party code. The issue is that vulkan.hpp has include <vector>. We use libc++ from Clang in our project. There is an upstream change in libc++, where it stopped transitively including sys/sysmacros.h for include <vector>.
llvm/llvm-project#99705

This started resulting in major(x) being resolved to gnu_dev_major(x). This seems to be an known issue for include <tuple> as explained in the comments. I was trying to extend this to any header that might transitively include sys/sysmacros.h. What is the proper way of fixing this issue in this code base?

@asuessenbach
Copy link
Contributor

This started resulting in major(x) being resolved to gnu_dev_major(x)

I still don't get, which major(x) is wrongly resolved here. Where does it come from. And why doesn't the undef of major and minor that is already there does not help?

And: I think, just unconditionally including sysmacros.h here is not an option.

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.

3 participants