Skip to content

compiling glad clang and pedantic causes warning on windows #209

@mhhany2000

Description

@mhhany2000

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:

/*
* 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. generate glad from here
  2. copy the src and include directories to the root of your project
  3. create a main.cpp in the root of the project
  4. add this code to main.cpp
#include <glad/glad.h>
int main() {}
  1. run this command: clang++ .\src\glad.c .\main.cpp -I .\include\ -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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions