public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105584] New: libcxx needs using_if_exist attribute
@ 2022-05-12 16:49 unlvsur at live dot com
  2022-05-12 16:53 ` [Bug c++/105584] " unlvsur at live dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: unlvsur at live dot com @ 2022-05-12 16:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105584

            Bug ID: 105584
           Summary: libcxx needs using_if_exist attribute
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: unlvsur at live dot com
  Target Milestone: ---

https://github.com/llvm/llvm-project/blob/14e83ada16b3944a4431617ed4ce7088f7f7cd9a/libcxx/include/__config#L772

#if __has_attribute(using_if_exists)
# define _LIBCPP_USING_IF_EXISTS __attribute__((using_if_exists))
#else
# define _LIBCPP_USING_IF_EXISTS
#endif

libcxx recently switches a lot of C usings with the new using_if_exists
attribute in clang, but GCC does not support it, causing compilation to fail if
these global definitions do not exist.

/home/cqwrteur/toolchains/native/x86_64-w64-mingw32/x86_64-w64-mingw32/include/c++/v1/cstdlib:139:9:
error: 'aligned_alloc' has not been declared in '::'
  139 | using ::aligned_alloc _LIBCPP_USING_IF_EXISTS;
      |         ^~~~~~~~~~~~~
/home/cqwrteur/toolchains/native/x86_64-w64-mingw32/x86_64-w64-mingw32/include/c++/v1/ctime:75:9:
error: 'timespec_get' has not been declared in '::'
   75 | using ::timespec_get _LIBCPP_USING_IF_EXISTS;
      |         ^~~~~~~~~~~~
I think GCC should add this attribute to support libcxx correctly.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/105584] libcxx needs using_if_exist attribute
  2022-05-12 16:49 [Bug c++/105584] New: libcxx needs using_if_exist attribute unlvsur at live dot com
@ 2022-05-12 16:53 ` unlvsur at live dot com
  2022-05-12 16:57 ` unlvsur at live dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: unlvsur at live dot com @ 2022-05-12 16:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105584

--- Comment #1 from cqwrteur <unlvsur at live dot com> ---
[clang] Implement the using_if_exists attribute


https://github.com/llvm/llvm-project/commit/369c64839946d89cf5697550b6feeea031b2f270

This shows how the attribute works. Hope GCC could add it.

Also probably need __clang__::__using_if_exists__ too to avoid name collisions.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/105584] libcxx needs using_if_exist attribute
  2022-05-12 16:49 [Bug c++/105584] New: libcxx needs using_if_exist attribute unlvsur at live dot com
  2022-05-12 16:53 ` [Bug c++/105584] " unlvsur at live dot com
@ 2022-05-12 16:57 ` unlvsur at live dot com
  2022-05-12 18:27 ` redi at gcc dot gnu.org
  2022-10-20 14:08 ` vital.had at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: unlvsur at live dot com @ 2022-05-12 16:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105584

--- Comment #2 from cqwrteur <unlvsur at live dot com> ---
https://lists.llvm.org/pipermail/cfe-dev/2020-June/066038.html

According to the proposal, it looks like this attribute could benefit libstdc++
too since I do see similar issues before.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/105584] libcxx needs using_if_exist attribute
  2022-05-12 16:49 [Bug c++/105584] New: libcxx needs using_if_exist attribute unlvsur at live dot com
  2022-05-12 16:53 ` [Bug c++/105584] " unlvsur at live dot com
  2022-05-12 16:57 ` unlvsur at live dot com
@ 2022-05-12 18:27 ` redi at gcc dot gnu.org
  2022-10-20 14:08 ` vital.had at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-05-12 18:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105584

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
libc++ should be using __has_cpp_attribute if they still expect to build with
GCC.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/105584] libcxx needs using_if_exist attribute
  2022-05-12 16:49 [Bug c++/105584] New: libcxx needs using_if_exist attribute unlvsur at live dot com
                   ` (2 preceding siblings ...)
  2022-05-12 18:27 ` redi at gcc dot gnu.org
@ 2022-10-20 14:08 ` vital.had at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: vital.had at gmail dot com @ 2022-10-20 14:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105584

Sergey Fedorov <vital.had at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vital.had at gmail dot com

--- Comment #4 from Sergey Fedorov <vital.had at gmail dot com> ---
(In reply to Jonathan Wakely from comment #3)
> libc++ should be using __has_cpp_attribute if they still expect to build
> with GCC.

Wouldn’t it benefit GCC if we add extra support?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-20 14:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 16:49 [Bug c++/105584] New: libcxx needs using_if_exist attribute unlvsur at live dot com
2022-05-12 16:53 ` [Bug c++/105584] " unlvsur at live dot com
2022-05-12 16:57 ` unlvsur at live dot com
2022-05-12 18:27 ` redi at gcc dot gnu.org
2022-10-20 14:08 ` vital.had at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).