public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug stdio/31939] New: __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first
@ 2024-06-29  2:06 pinskia at gcc dot gnu.org
  2024-06-29  2:27 ` [Bug stdio/31939] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-29  2:06 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31939

            Bug ID: 31939
           Summary: __attr_dealloc_fclose can be defined differently
                    depending on if wchar.h or stdio.h is included first
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: stdio
          Assignee: unassigned at sourceware dot org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

stdio.h version:
#undef __attr_dealloc_fclose
#define __attr_dealloc_fclose __attr_dealloc (fclose, 1)

wchar.h:
#define __attr_dealloc_fclose 

This makes a difference for c++ modules, see 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115705

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug stdio/31939] __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first
  2024-06-29  2:06 [Bug stdio/31939] New: __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first pinskia at gcc dot gnu.org
@ 2024-06-29  2:27 ` pinskia at gcc dot gnu.org
  2024-06-29  6:54 ` schwab@linux-m68k.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-29  2:27 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31939

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the wchar.h depends on if fclose is defined:
```
#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
# ifndef __attr_dealloc_fclose
#   if defined __has_builtin
#     if __has_builtin (__builtin_fclose)
/* If the attribute macro hasn't been defined yet (by <stdio.h>) and
   fclose is a built-in, use it.  */
#      define __attr_dealloc_fclose __attr_dealloc (__builtin_fclose, 1)
#     endif
#   endif
# endif
# ifndef __attr_dealloc_fclose
#  define __attr_dealloc_fclose /* empty */
# endif
```

Maybe this could be solved like:
# ifndef __attr_dealloc_fclose
#   if defined __has_builtin
#     if __has_builtin (__builtin_fclose)
/* If the attribute macro hasn't been defined yet (by <stdio.h>) and
   fclose is a built-in, use it.  */
#      define __attr_dealloc_fclose_wchar __attr_dealloc (__builtin_fclose, 1)
#     endif
#   endif
# endif
# ifndef __attr_dealloc_fclose_wchar
#  define __attr_dealloc_fclose_wchar /* empty */
# else
#  define __attr_dealloc_fclose_wchar __attr_dealloc_fclose
#endif

And then in this file use __attr_dealloc_fclose_wchar  instead of
__attr_dealloc_fclose .

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug stdio/31939] __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first
  2024-06-29  2:06 [Bug stdio/31939] New: __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first pinskia at gcc dot gnu.org
  2024-06-29  2:27 ` [Bug stdio/31939] " pinskia at gcc dot gnu.org
@ 2024-06-29  6:54 ` schwab@linux-m68k.org
  2024-06-29 11:09 ` sam at gentoo dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: schwab@linux-m68k.org @ 2024-06-29  6:54 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31939

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
That won't fix the bug that open_wmemstream is declared differently depdending
on inclusion order.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug stdio/31939] __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first
  2024-06-29  2:06 [Bug stdio/31939] New: __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first pinskia at gcc dot gnu.org
  2024-06-29  2:27 ` [Bug stdio/31939] " pinskia at gcc dot gnu.org
  2024-06-29  6:54 ` schwab@linux-m68k.org
@ 2024-06-29 11:09 ` sam at gentoo dot org
  2024-06-29 19:25 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: sam at gentoo dot org @ 2024-06-29 11:09 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31939

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gentoo dot org

--- Comment #3 from Sam James <sam at gentoo dot org> ---
commit c1760eaf3b575ad174fd88b252fd16bd525fa818
Author: Martin Sebor <msebor@redhat.com>
Date:   Sun May 16 15:21:18 2021 -0600

    Enable support for GCC 11 -Wmismatched-dealloc.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug stdio/31939] __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first
  2024-06-29  2:06 [Bug stdio/31939] New: __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-06-29 11:09 ` sam at gentoo dot org
@ 2024-06-29 19:25 ` pinskia at gcc dot gnu.org
  2024-06-29 19:56 ` schwab@linux-m68k.org
  2024-07-01 16:15 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-29 19:25 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31939

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=115705

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andreas Schwab from comment #2)
> That won't fix the bug that open_wmemstream is declared differently
> depdending on inclusion order.

True. So I guess __attr_dealloc_fclose_wchar should be done indepdently of
__attr_dealloc_fclose then.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug stdio/31939] __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first
  2024-06-29  2:06 [Bug stdio/31939] New: __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first pinskia at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-06-29 19:25 ` pinskia at gcc dot gnu.org
@ 2024-06-29 19:56 ` schwab@linux-m68k.org
  2024-07-01 16:15 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: schwab@linux-m68k.org @ 2024-06-29 19:56 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31939

--- Comment #5 from Andreas Schwab <schwab@linux-m68k.org> ---
POSIX allows <wchar.h> to inclue <stdio.h>.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug stdio/31939] __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first
  2024-06-29  2:06 [Bug stdio/31939] New: __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first pinskia at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-06-29 19:56 ` schwab@linux-m68k.org
@ 2024-07-01 16:15 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2024-07-01 16:15 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31939

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

--- Comment #6 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Andreas Schwab from comment #5)
> POSIX allows <wchar.h> to inclue <stdio.h>.

Ah. And we only need this for open_memstream. So it looks like we should
perform the inclusion under #if defined __USE_XOPEN2K8 || __GLIBC_USE
(LIB_EXT2).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-07-01 16:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-29  2:06 [Bug stdio/31939] New: __attr_dealloc_fclose can be defined differently depending on if wchar.h or stdio.h is included first pinskia at gcc dot gnu.org
2024-06-29  2:27 ` [Bug stdio/31939] " pinskia at gcc dot gnu.org
2024-06-29  6:54 ` schwab@linux-m68k.org
2024-06-29 11:09 ` sam at gentoo dot org
2024-06-29 19:25 ` pinskia at gcc dot gnu.org
2024-06-29 19:56 ` schwab@linux-m68k.org
2024-07-01 16:15 ` fweimer at redhat 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).