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

compiling glad clang and pedantic causes warning on windows #499

Closed
mhhany2000 opened this issue Dec 13, 2024 · 2 comments
Closed

compiling glad clang and pedantic causes warning on windows #499

mhhany2000 opened this issue Dec 13, 2024 · 2 comments

Comments

@mhhany2000
Copy link

when compiling glad with clang using the flag -pedantic I get these warnings:

C:/Dev/glad/include\KHR/khrplatform.h:189:9: warning: extension used [-Wlanguage-extension-token]
  189 | typedef __int32                 khronos_int32_t;
      |         ^
C:/Dev/glad/include\KHR/khrplatform.h:190:18: warning: extension used [-Wlanguage-extension-token]
  190 | typedef unsigned __int32        khronos_uint32_t;
      |                  ^
C:/Dev/glad/include\KHR/khrplatform.h:191:9: warning: extension used [-Wlanguage-extension-token]
  191 | typedef __int64                 khronos_int64_t;
      |         ^
C:/Dev/glad/include\KHR/khrplatform.h:192:18: warning: extension used [-Wlanguage-extension-token]
  192 | typedef unsigned __int64        khronos_uint64_t;
      |         

these warnings do not happen on linux.

this seems to be the piece of code where the warning is generated:

#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)

/*
 * Win32
 */
typedef __int32                 khronos_int32_t;
typedef unsigned __int32        khronos_uint32_t;
typedef __int64                 khronos_int64_t;
typedef unsigned __int64        khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64   1
#define KHRONOS_SUPPORT_FLOAT   1

which is only used if _WIN32 is defined, it uses __intN types that are not standard, causing warnings.


How to reproduce:

  1. download glad from here
  2. add glad.c to your project
  3. include glad/glad.h
  4. compile with clang and the compiler flag -pedantic

this will cause the warnings mentioned above.


more info:

OS: Windows 11
clang was installed through visual studio installer (C++ Clang Compiler for Windows)
clang --version output:

clang version 18.1.8
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin

note sure any of this information is important to the issue but I included them just in case

@Dav1dde
Copy link
Owner

Dav1dde commented Dec 13, 2024

This is unfortunate, this is coming from a khronos header and is not generated code.

Here is the location: https://github.com/KhronosGroup/EGL-Registry/blob/29c4314e0ef04c730992d295f91b76635019fbba/api/KHR/khrplatform.h#L186-L194

You can try filing an issue in the Khronos repo, I don't think I can (or want to) mess with the official headers on this level in glad.

@mhhany2000
Copy link
Author

filed a new issue there, closing this one

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

No branches or pull requests

2 participants