public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][PR build/29791] gnulib: Disable _GL_ATTRIBUTE_DEALLOC on Solaris
@ 2022-11-18 13:08 Rainer Orth
  2022-11-18 16:00 ` Simon Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Rainer Orth @ 2022-11-18 13:08 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 969 bytes --]

gdbsupport compilation badly fails with GCC 12 on Solaris, with errors
like

../gnulib/config.h:1693:72: error: ‘malloc’ attribute argument 1 is ambiguous
 1693 | # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
      |                                                                        ^
../gnulib/config.h:1693:72: note: use a cast to the expected type to disambiguate

We've not yet been able to determine where the ambiguity actually lies,
so this patch works around the issue by disabling _GL_ATTRIBUTE_DEALLOC
on Solaris, at least as a workaround for GDB 13.

As Tom suggested in the PR, this is done using our infrastructure for
local gnulib patches.

Tested on sparcv9-sun-solaris2.11, amd64-pc-solaris2.11, and
x86_64-pc-linux-gnu.

Ok for trunk?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol2-attribute-malloc-error-gcc12.patch --]
[-- Type: text/x-patch, Size: 2757 bytes --]

# HG changeset patch
# Parent  ebbd2c43c7405df23a60abebbe5cbf995bb99de2
[PR build/29791] gnulib: Disable _GL_ATTRIBUTE_DEALLOC on Solaris

diff --git a/gnulib/config.in b/gnulib/config.in
--- a/gnulib/config.in
+++ b/gnulib/config.in
@@ -1688,7 +1688,8 @@
    _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
    can be freed via 'free'; it can be used only after declaring 'free'.  */
 /* Applies to: functions.  Cannot be used on inline functions.  */
-#if _GL_GNUC_PREREQ (11, 0)
+/* Disable on Solaris to avoid GDB PR build/29791.  */
+#if _GL_GNUC_PREREQ (11, 0) && !(defined(__sun__) && defined(__svr4__))
 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
 #else
 # define _GL_ATTRIBUTE_DEALLOC(f, i)
diff --git a/gnulib/import/m4/gnulib-common.m4 b/gnulib/import/m4/gnulib-common.m4
--- a/gnulib/import/m4/gnulib-common.m4
+++ b/gnulib/import/m4/gnulib-common.m4
@@ -182,7 +182,8 @@ AC_DEFUN([gl_COMMON_BODY], [
    _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
    can be freed via 'free'; it can be used only after declaring 'free'.  */
 /* Applies to: functions.  Cannot be used on inline functions.  */
-#if _GL_GNUC_PREREQ (11, 0)
+/* Disable on Solaris to avoid GDB PR build/29791.  */
+#if _GL_GNUC_PREREQ (11, 0) && !(defined(__sun__) && defined(__svr4__))
 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
 #else
 # define _GL_ATTRIBUTE_DEALLOC(f, i)
diff --git a/gnulib/patches/0002-no-solaris-_gl_attribute_dealloc b/gnulib/patches/0002-no-solaris-_gl_attribute_dealloc
new file mode 100644
--- /dev/null
+++ b/gnulib/patches/0002-no-solaris-_gl_attribute_dealloc
@@ -0,0 +1,13 @@
+diff --git a/gnulib/import/m4/gnulib-common.m4 b/gnulib/import/m4/gnulib-common.m4
+--- a/gnulib/import/m4/gnulib-common.m4
++++ b/gnulib/import/m4/gnulib-common.m4
+@@ -182,7 +182,8 @@ AC_DEFUN([gl_COMMON_BODY], [
+    _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
+    can be freed via 'free'; it can be used only after declaring 'free'.  */
+ /* Applies to: functions.  Cannot be used on inline functions.  */
+-#if _GL_GNUC_PREREQ (11, 0)
++/* Disable on Solaris to avoid GDB PR build/29791.  */
++#if _GL_GNUC_PREREQ (11, 0) && !(defined(__sun__) && defined(__svr4__))
+ # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+ #else
+ # define _GL_ATTRIBUTE_DEALLOC(f, i)
diff --git a/gnulib/update-gnulib.sh b/gnulib/update-gnulib.sh
--- a/gnulib/update-gnulib.sh
+++ b/gnulib/update-gnulib.sh
@@ -188,6 +188,7 @@ apply_patches ()
 }
 
 apply_patches "patches/0001-use-windows-stat"
+apply_patches "patches/0002-no-solaris-_gl_attribute_dealloc"
 
 # Regenerate all necessary files...
 aclocal &&

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

* Re: [PATCH][PR build/29791] gnulib: Disable _GL_ATTRIBUTE_DEALLOC on Solaris
  2022-11-18 13:08 [PATCH][PR build/29791] gnulib: Disable _GL_ATTRIBUTE_DEALLOC on Solaris Rainer Orth
@ 2022-11-18 16:00 ` Simon Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2022-11-18 16:00 UTC (permalink / raw)
  To: Rainer Orth, gdb-patches



On 11/18/22 08:08, Rainer Orth wrote:
> gdbsupport compilation badly fails with GCC 12 on Solaris, with errors
> like
> 
> ../gnulib/config.h:1693:72: error: ‘malloc’ attribute argument 1 is ambiguous
>  1693 | # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
>       |                                                                        ^
> ../gnulib/config.h:1693:72: note: use a cast to the expected type to disambiguate
> 
> We've not yet been able to determine where the ambiguity actually lies,
> so this patch works around the issue by disabling _GL_ATTRIBUTE_DEALLOC
> on Solaris, at least as a workaround for GDB 13.
> 
> As Tom suggested in the PR, this is done using our infrastructure for
> local gnulib patches.
> 
> Tested on sparcv9-sun-solaris2.11, amd64-pc-solaris2.11, and
> x86_64-pc-linux-gnu.
> 
> Ok for trunk?

Thanks, this is ok:

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon

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

end of thread, other threads:[~2022-11-18 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18 13:08 [PATCH][PR build/29791] gnulib: Disable _GL_ATTRIBUTE_DEALLOC on Solaris Rainer Orth
2022-11-18 16:00 ` Simon Marchi

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).