public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: soeren@soeren-tempel.net, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] stddef.h: add support for musl typedef macro guards
Date: Thu, 2 Dec 2021 09:38:11 -0700	[thread overview]
Message-ID: <7da617fe-bf76-fd57-b32b-0688ac8795ac@gmail.com> (raw)
In-Reply-To: <20211126165717.9729-1-soeren@soeren-tempel.net>



On 11/26/2021 9:57 AM, soeren--- via Gcc-patches wrote:
> From: Sören Tempel <soeren+git@soeren-tempel.net>
>
> The stddef.h header checks/sets various hardcoded toolchain/os specific
> macro guards to prevent redefining types such as ptrdiff_t, wchar_t, or
> size_t. However, without this patch, the file does not check/set the
> typedef macro guards for musl libc. This causes types such as size_t to
> be defined twice for files which include both musl's stddef.h as well as
> GCC's ginclude/stddef.h. This is, for example, the case for
> libgo/sysinfo.c. If libgo/sysinfo.c has multiple typedefs for size_t
> this confuses -fdump-go-spec and causes size_t not to be included in the
> generated type definitions thereby causing a gcc-go compilation failure
> on Alpine Linux Edge (which uses musl libc) with the following error:
>
> 	sysinfo.go:7765:13: error: use of undefined type '_size_t'
> 	 7765 | type Size_t _size_t
> 	      |             ^
> 	libcall_posix.go:49:35: error: non-integer len argument in make
> 	   49 |                 b := make([]byte, len)
> 	      |
>
> This commit fixes this issue by ensuring that ptrdiff_t, wchar_t, and size_t
> are only defined once in the pre-processed libgo/sysinfo.c file by enhancing
> gcc/ginclude/stddef.h with musl-specific typedef macro guards.
>
> gcc/ChangeLog:
>
> 	* ginclude/stddef.h (__DEFINED_ptrdiff_t): Add support for musl
> 	libc typedef macro guard.
> 	(__DEFINED_size_t): Ditto.
> 	(__DEFINED_wchar_t): Ditto.
So what doesn't make sense here is how both stddef.h files get 
included.  That's the core problem I think you need to resolve.

Jeff


  reply	other threads:[~2021-12-02 16:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26 16:57 soeren
2021-12-02 16:38 ` Jeff Law [this message]
2021-12-03  6:24   ` Sören Tempel
2021-12-14 23:10     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7da617fe-bf76-fd57-b32b-0688ac8795ac@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=soeren@soeren-tempel.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).