Skip to content

fix(headers): rename the None members X11's <X11/X.h> macro breaks - #589

Merged
transfix merged 2 commits into
masterfrom
fix/x11-none-enumerators
Oct 9, 2026
Merged

transfix merged 2 commits into
masterfrom
fix/x11-none-enumerators

Conversation

@transfix

@transfix transfix commented Oct 9, 2026

Copy link
Copy Markdown
Owner

What

X11's <X11/X.h> does #define None 0L. Two public declarations named None therefore fail to compile in any translation unit that has an X11 header in scope first. cvcGL apps on Linux are exposed to this, because they get X11 through VTK's X11 render window.

Before After Where
cvc::ariadne::BorderShow::None BorderShow::Off inc/cvc/ariadne/widget.h (the Layout::borders default)
cvc::gl::Switch::None (-1) Switch::Off (-1) inc/cvc/gl/nodes.h, next to Switch::All

This renames names only; the values are unchanged. Nothing in bindings/, the .ari DSL (the loader never spells BorderShow::None), or the downstream repos (cvcdbg, volrover, cyos, txwtf, cvcpkg) uses either name. Follows up #588, which flagged this collision and left it out of scope.

Audit: I checked every public header against all 3,228 macros from <X11/X.h>, <X11/Xlib.h>, <X11/Xutil.h> and <X11/keysym.h>. None is the only collision; NULL hits are intended uses. Private .cpp-local enums such as Gesture::None and the examples' Capture::None are not public API and are untouched.

Regression tests

  • x11_macro_headers_test includes <X11/X.h> first, then <cvc/ariadne/widget.h>, and checks that Layout::borders defaults to BorderShow::Off.
  • cvcgl_x11_macros (headless) includes VTK headers, then <X11/X.h>, then <cvc/gl/nodes.h>. That's the order VTK's X11 render window produces. Putting X11 before VTK breaks VTK's own vtksys/Status.hxx on X11's Success macro, which is outside libcvc. It static_asserts Switch::Off == -1 / Switch::All == -3.

Both skip the X11 include where X11 headers aren't available, so on Windows and macOS they compile without the macro.

Verification

Built locally with g++ 11 against an installed libcvc 3.5.0 prefix (VTK 9.5, X11 headers):

  • Before (master's widget.h/nodes.h): both test files fail with X11/X.h: expected identifier before numeric constant.
  • After: x11_macro_headers_test passes (1/1). cvcgl_x11_macros builds against VTK and runs (ok). Both build cleanly under -Wall -Wextra.
  • ftxui_backend.cpp, cvcGL/nodes.cpp and cvcgl_traversal.cpp compile against the new headers.
  • check_test_targets.py passes (161). The changed lines and both new files are clang-format clean.

Release note (source-level rename, no ABI change): ariadne::BorderShow::None → BorderShow::Off, gl::Switch::None → Switch::Off.

X11's <X11/X.h> does `#define None 0L`, so two public declarations stopped
compiling in any translation unit that had an X11 header in scope first --
cvcGL apps on Linux get X11 through VTK's X11 render window:

- cvc::ariadne::BorderShow::None -> BorderShow::Off (inc/cvc/ariadne/widget.h;
  the default for Layout::borders). The .ari loader never spelled it, so the
  DSL is unchanged.
- cvc::gl::Switch::None -> Switch::Off (inc/cvc/gl/nodes.h), next to
  Switch::All; the Inventor "no child" value (-1) is unchanged.

Source-level rename only (same values); nothing in the bindings or in the
downstream repos uses either name. An audit of every public header against
all 3,228 macros from <X11/X.h>, <X11/Xlib.h>, <X11/Xutil.h> and
<X11/keysym.h> finds no other collision (NULL aside).

Regression tests:
- x11_macro_headers_test: <X11/X.h> first, then <cvc/ariadne/widget.h>.
- cvcgl_x11_macros (headless): VTK headers, then <X11/X.h>, then
  <cvc/gl/nodes.h> -- the order VTK's X11 render window produces (X11
  before VTK breaks VTK's own vtksys/Status.hxx on `Success`).
Both skip the X11 include where X11 headers are unavailable.
googletest declares its own `struct None` (gtest/internal/gtest-type-util.h),
so with <X11/X.h> first the macro broke gtest itself -- the Linux Debug lanes
failed compiling gtest-type-util.h / gtest-internal.h, not libcvc. Parse gtest
before X11; the test is about libcvc's headers, which still come after the
macro. (The earlier local check used a gtest stub, which has no `None`.)
@transfix
transfix merged commit b1463d9 into master Oct 9, 2026
14 checks passed
transfix added a commit that referenced this pull request Oct 9, 2026
Patch release carrying the fixes since 3.5.0: the cvcGL M_PI build fix
(#582), CameraController Map mode holding its pose (#584), the tag-release /
publish workflow fixes (#585, #586), macro-safe public headers after
<signal.h> / <sys/param.h> (#588), and the X11 `None` renames (#589:
ariadne::BorderShow::None -> Off, gl::Switch::None -> Off). Bumps
project(VERSION) 3.5.0 -> 3.5.1 and every cvcpkg recipe's upstream_version to
match (cvc_revision stays 1, per the recipe-version gate).
@transfix
transfix deleted the fix/x11-none-enumerators branch October 10, 2026 03:38
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.

1 participant