Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 May 2023 15:22:25 +0000
From:      bugzilla-noreply@freebsd.org
To:        x11@FreeBSD.org
Subject:   maintainer-feedback requested: [Bug 271533] x11/xorgproto: ensure Xos.h does not define index() as a macro
Message-ID:  <bug-271533-7141-sArq9eT88l@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-271533-7141@https.bugs.freebsd.org/bugzilla/>
References:  <bug-271533-7141@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-x11 (Nobody)
<x11@FreeBSD.org> for maintainer-feedback:
Bug 271533: x11/xorgproto: ensure Xos.h does not define index() as a macro
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271533



--- Description ---
During the exp-run for clang 16, it turned out that Xos.h defines
index() and rindex() as preprocessor macros, and this causes many
problems with libc++ headers [1]:

  /usr/include/c++/v1/variant:532:39: error: too few arguments provided to
function-like macro invocation
      return __at(__fmatrix, __vs.index()...)(
					^
  /usr/local/include/X11/Xos.h:67:12: note: macro 'index' defined here
  #   define index(s,c) (strchr((s),(c)))
	     ^
  /usr/include/c++/v1/variant:813:18: error: too few arguments provided to
function-like macro invocation
      return index() =3D=3D variant_npos;
		   ^
  /usr/local/include/X11/Xos.h:67:12: note: macro 'index' defined here
  #   define index(s,c) (strchr((s),(c)))
	     ^
  /usr/include/c++/v1/variant:817:25: error: expected ';' at end of declara=
tion
list
    constexpr size_t index() const noexcept {
			  ^
  /usr/include/c++/v1/variant:802:9: error: member initializer '__data' does
not name a non-static data member or base class
	: __data(__tag), __index(__variant_npos<__index_t>) {}
	  ^~~~~~~~~~~~~
  /usr/include/c++/v1/variant:808:9: error: member initializer '__data' does
not name a non-static data member or base class
	  __data(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...),
	  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/include/c++/v1/variant:920:23: error: too few arguments provided to
function-like macro invocation
	    __rhs.index(),
			^
  /usr/local/include/X11/Xos.h:67:12: note: macro 'index' defined here
  #   define index(s,c) (strchr((s),(c)))
	     ^

Add defined(__FreeBSD__) to Xos.h's #if block to include <strings.h>
instead, so it will get our regular index() and rindex() declarations
instead. This has also been sent upstream [2].

[1]
<https://pkg-status.freebsd.org/gohan05/data/mainamd64PR271047-default/2023=
-05-
14_19h35m09s/logs/errors/scim-1.4.9_7.log>
[2] <https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/7=
3>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-271533-7141-sArq9eT88l>