Bug 210890 - [exp-run] Define max_align_t for C11 and C++11 in stddef.h
Summary: [exp-run] Define max_align_t for C11 and C++11 in stddef.h
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: John Baldwin
URL:
Keywords:
: 193594 (view as bug list)
Depends on: 213657
Blocks: 193594
  Show dependency treegraph
 
Reported: 2016-07-07 12:44 UTC by John Baldwin
Modified: 2018-06-25 16:12 UTC (History)
3 users (show)

See Also:
koobs: mfc-stable11+
koobs: mfc-stable10+
koobs: exp-run+


Attachments
max_align_t.patch (981 bytes, patch)
2016-07-07 12:44 UTC, John Baldwin
no flags Details | Diff
max_align_t.patch (980 bytes, patch)
2016-07-13 16:40 UTC, John Baldwin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Baldwin freebsd_committer freebsd_triage 2016-07-07 12:44:48 UTC
Created attachment 172194 [details]
max_align_t.patch

gnu lib wants max_align_t defined by the C compiler.  If it doesn't find one, it generates its own version which conflicts with the version in libc++'s stddef.h.  This breaks builds of GDB master on 11.0.  I know dim@ (cc'd) has worked around this in various ports by forcing max_align_t to be defined via autoconf.  However, defining max_align_t in C (not just C++) should fix this for real.

This patch has survived make tinderbox, but I need to see what fallout it has in ports.  Note that you will need to build a new world with this to get updated headers.  It does not require a new kernel.
Comment 1 Antoine Brodin freebsd_committer freebsd_triage 2016-07-08 08:57:42 UTC
Buildworld fails with the patch:

In file included from /poudriere/jails/headamd64PR210890/usr/src/lib/libcxxrt/../../contrib/libcxxrt/memory.cc:36:
/usr/obj/poudriere/jails/headamd64PR210890/usr/src/tmp/usr/include/stddef.h:67:9: error: unknown type name '___max_align_t'; did you mean '__max_align
_t'?
typedef ___max_align_t  max_align_t;
        ^
/usr/obj/poudriere/jails/headamd64PR210890/usr/src/tmp/usr/include/sys/_types.h:106:3: note: '__max_align_t' declared here
} __max_align_t;
  ^
Comment 2 John Baldwin freebsd_committer freebsd_triage 2016-07-13 16:40:36 UTC
Created attachment 172467 [details]
max_align_t.patch

Oops, uploaded older version of the patch.  This is the version that survived 'make tinderbox'.
Comment 3 Antoine Brodin freebsd_committer freebsd_triage 2016-07-15 12:27:34 UTC
On amd64 there is 1 new failure:  www/mongrel2


Failure log:

http://package18.nyi.freebsd.org/data/headamd64PR210890-default/2016-07-15_05h15m48s/logs/errors/mongrel2-1.7.5_2.log
Comment 4 Antoine Brodin freebsd_committer freebsd_triage 2016-07-16 21:21:54 UTC
On i386, there is 1 new failure, www/mongrel2

Failure log:

http://package18.nyi.freebsd.org/data/headi386PR210890-default/2016-07-16_13h22m06s/logs/errors/mongrel2-1.7.5_2.log
Comment 5 commit-hook freebsd_committer freebsd_triage 2016-10-21 23:50:49 UTC
A commit references this bug:

Author: jhb
Date: Fri Oct 21 23:50:02 UTC 2016
New revision: 307756
URL: https://svnweb.freebsd.org/changeset/base/307756

Log:
  Define max_align_t for C11.

  libc++'s stddef.h includes an existing definition of max_align_t for
  C++11, but it is only defined for C++, not for C.  In addition, GCC and
  clang both define an alternate version of max_align_t that uses a
  union of multiple types rather than a plain long double as in libc++.
  This adds a __max_align_t to <sys/_types.h> that matches the GCC and
  clang definition that is mapped to max_align_t in <stddef.h>.

  PR:		210890
  Reviewed by:	dim
  MFC after:	1 month
  Differential Revision:	https://reviews.freebsd.org/D8194

Changes:
  head/include/stddef.h
  head/sys/sys/_types.h
Comment 6 commit-hook freebsd_committer freebsd_triage 2016-11-28 18:37:13 UTC
A commit references this bug:

Author: jhb
Date: Mon Nov 28 18:36:37 UTC 2016
New revision: 309258
URL: https://svnweb.freebsd.org/changeset/base/309258

Log:
  MFC 307756: Define max_align_t for C11.

  libc++'s stddef.h includes an existing definition of max_align_t for
  C++11, but it is only defined for C++, not for C.  In addition, GCC and
  clang both define an alternate version of max_align_t that uses a
  union of multiple types rather than a plain long double as in libc++.
  This adds a __max_align_t to <sys/_types.h> that matches the GCC and
  clang definition that is mapped to max_align_t in <stddef.h>.

  PR:		210890

Changes:
_U  stable/10/
  stable/10/include/stddef.h
  stable/10/sys/sys/_types.h
_U  stable/11/
  stable/11/include/stddef.h
  stable/11/sys/sys/_types.h
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2018-06-25 04:19:49 UTC
*** Bug 193594 has been marked as a duplicate of this bug. ***
Comment 8 Kubilay Kocak freebsd_committer freebsd_triage 2018-06-25 04:23:25 UTC
Re-classify as a base issue (observed by/with ports build failures (eg: gdb)) as the resolution (commit) was done there (in base).
Comment 9 Kubilay Kocak freebsd_committer freebsd_triage 2018-06-25 04:23:39 UTC
Record MFC's.
Comment 10 John Baldwin freebsd_committer freebsd_triage 2018-06-25 16:12:24 UTC
(In reply to Kubilay Kocak from comment #8)
It was a ports issue solely because this was only an exp-run bug, not a but to track the actual issue of max_align_t (there wasn't a bug for that).