Skip to content

cmake: Fix the include guards in rfbconfig.h#693

Merged
bk138 merged 1 commit intoLibVNC:masterfrom
mstorsjo:cmake-include-guard
Mar 10, 2026
Merged

cmake: Fix the include guards in rfbconfig.h#693
bk138 merged 1 commit intoLibVNC:masterfrom
mstorsjo:cmake-include-guard

Conversation

@mstorsjo
Copy link
Contributor

The include guard shouldn't be a cmakedefine - this is not a 0/1 define that we expect cmake to configure, it should always be defined here.

This avoids warnings like this (when building with Clang, targeting Windows), due to rfbconfig.h being included multiple times, when building with CMake:

libvncserver/build/include/rfb/rfbconfig.h:197:13: warning: redefinition of typedef 'socklen_t' is a C11 feature [-Wtypedef-redefinition]
  197 | typedef int socklen_t;
      |             ^
libvncserver/include/rfb/rfbproto.h:70:10: note: 'libvncserver/build/include/rfb/rfbconfig.h' included multiple times, additional include site here
   70 | #include <rfb/rfbconfig.h>
      |          ^
libvncserver/include/rfb/threading.h:25:10: note: 'libvncserver/build/include/rfb/rfbconfig.h' included multiple times, additional include site here
   25 | #include <rfb/rfbconfig.h>
      |          ^

The include guard shouldn't be a cmakedefine - this is not a 0/1
define that we expect cmake to configure, it should always be
defined here.

This avoids warnings like this (when building with Clang, targeting
Windows), due to rfbconfig.h being included multiple times, when
building with CMake:

    libvncserver/build/include/rfb/rfbconfig.h:197:13: warning: redefinition of typedef 'socklen_t' is a C11 feature [-Wtypedef-redefinition]
      197 | typedef int socklen_t;
          |             ^
    libvncserver/include/rfb/rfbproto.h:70:10: note: 'libvncserver/build/include/rfb/rfbconfig.h' included multiple times, additional include site here
       70 | #include <rfb/rfbconfig.h>
          |          ^
    libvncserver/include/rfb/threading.h:25:10: note: 'libvncserver/build/include/rfb/rfbconfig.h' included multiple times, additional include site here
       25 | #include <rfb/rfbconfig.h>
          |          ^
@bk138 bk138 merged commit 9c68402 into LibVNC:master Mar 10, 2026
28 checks passed
@bk138
Copy link
Member

bk138 commented Mar 10, 2026

That is of course right, thanks for spotting!

@mstorsjo mstorsjo deleted the cmake-include-guard branch March 10, 2026 20:19
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.

2 participants