Reputation: 31
When compiling GLAD with Clang using these flags: -pedantic -Wall -Wextra
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.
Above this chunk of code is another block that looks like this:
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
/*
* Using <stdint.h>
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
...and this one seems to use the standard integer types.
Is there a way to compile with pedantic without having these warnings generated?
For example is there a way to force the second block of code to be used instead so that GLAD won't use platform-specific extensions?
Why does GLAD use these non-standard types in the first place?
Generate GLAD from here
Copy the src
and include
directories to the root of your project
Create a main.cpp
in the root of the project
Add this code to main.cpp
#include <glad/glad.h>
int main() {}
run this command:
clang++ .\src\glad.c .\main.cpp -I .\include\ -pedantic
This will cause the warnings mentioned above.
Upvotes: 0
Views: 75