- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15k
Open
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Description
clang complains when using poorly written macros in system headers in a way that gcc doesn't, which is highly problematic as we try to use -Werror.
E.g. this code:
#include <winsock2.h>
int main(int argc, char** argv)
{
    int fd = 12;
    fd_set fds;
    FD_ZERO(&fds);
    FD_SET(fd, &fds);
    
    return 0;
}Will cause this error on Windows:
fdset.c:9:5: warning: comparison of integers of different signs: 'SOCKET' (aka 'unsigned long long') and 'int' [-Wsign-compare]
    9 |     FD_SET(fd, &fds);
      |     ^~~~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/sys-root/mingw/include/psdk_inc/_fd_types.h:77:40: note: expanded from macro 'FD_SET'
   77 |                 if (((fd_set *)(set))->fd_array[__i] == (fd)) {         \
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^   ~~
gcc gladly respects that _fd_types.h is a system header and is silent.
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer