Bug 216186 - mail/thunderbird, www/firefox, www/firefox-esr, www/libxul, www/seamonkey: fail to build with libc++ 4.0
Summary: mail/thunderbird, www/firefox, www/firefox-esr, www/libxul, www/seamonkey: fa...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-gecko mailing list
URL:
Keywords: needs-patch
Depends on:
Blocks: 216008
  Show dependency treegraph
 
Reported: 2017-01-17 17:09 UTC by Jan Beich
Modified: 2017-01-30 21:07 UTC (History)
1 user (show)

See Also:
jbeich: maintainer-feedback+


Attachments
Use [[noreturn]] for __throw_xxx wrappers, if libc++ 4.0.0 or higher (4.41 KB, patch)
2017-01-24 17:25 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2017-01-17 17:09:33 UTC
In file included from /wrkdirs/usr/ports/mail/thunderbird/work/thunderbird-45.6.0/mozilla/ipc/contentproc/plugin-container.cpp:7:
In file included from ../../dist/include/nsXPCOM.h:10:
In file included from ../../dist/include/nscore.h:20:
In file included from ../../dist/include/mozilla/mozalloc.h:16:
In file included from /wrkdirs/usr/ports/mail/thunderbird/work/thunderbird-45.6.0/obj-x86_64-unknown-freebsd12.0/dist/stl_wrappers/new:44:
In file included from /wrkdirs/usr/ports/mail/thunderbird/work/thunderbird-45.6.0/obj-x86_64-unknown-freebsd12.0/dist/system_wrappers/new:3:
/usr/include/c++/v1/new:132:1: error: function declared '[[noreturn]]' after its first declaration
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc();  // not in C++ spec
^
/usr/include/c++/v1/__config:273:30: note: expanded from macro '_LIBCPP_NORETURN'
#  define _LIBCPP_NORETURN [[noreturn]]
                             ^
../../dist/include/mozilla/throw_gcc.h:35:1: note: declaration missing '[[noreturn]]' attribute is here
__throw_bad_alloc(void)
^

build log: http://sprunge.us/jOLB
"See Also" bugzilla field links upstream bug for more details.
Comment 1 Dimitry Andric freebsd_committer 2017-01-21 16:31:32 UTC
Submitted a libc++ fix here: https://reviews.llvm.org/D28981

With this applied to my local libc++ headers, Firefox is now building.  I'll await the upstream review, and fast-track the patch into clang400-import after it gets approved.
Comment 2 Dimitry Andric freebsd_committer 2017-01-24 17:25:59 UTC
Created attachment 179285 [details]
Use [[noreturn]] for __throw_xxx wrappers, if libc++ 4.0.0 or higher

So since the upstream libc++ review was clearly rejected ("get off my lawn!" :), I now propose this alternate fix, which prefixes all the __throw_xxx functions with [[noreturn]], but *only* for clang, and for libc++ 4.0.0 and higher.

I will send something similar upstream.
Comment 3 Jan Beich freebsd_committer 2017-01-26 05:30:29 UTC
Comment on attachment 179285 [details]
Use [[noreturn]] for __throw_xxx wrappers, if libc++ 4.0.0 or higher

I'm biased against the fix since it looks like a gross workaround for Clang idiosyncrasy: C++11 attributes vs. C++11-style GNU attributes vs. regular GNU attributes vs. no attributes. Somehow the former is incompatible with everything else except for the 1st declaration. So, let's see what lands upstream then backport it here unless /projects/clang400-import is merged to /head before.

Locally I've just replaced [[noreturn]] with [[gnu::noreturn]] in libc++ to avoid having to patch every Firefox checkout.
Comment 4 commit-hook freebsd_committer 2017-01-30 21:04:21 UTC
A commit references this bug:

Author: jbeich
Date: Mon Jan 30 21:03:47 UTC 2017
New revision: 432865
URL: https://svnweb.freebsd.org/changeset/ports/432865

Log:
  gecko: unbreak with clang/libc++ 4.0

  In file included from mozilla/ipc/contentproc/plugin-container.cpp:7:
  In file included from ../../dist/include/nsXPCOM.h:10:
  In file included from ../../dist/include/nscore.h:20:
  In file included from ../../dist/include/mozilla/mozalloc.h:16:
  In file included from objdir/dist/stl_wrappers/new:44:
  In file included from objdir/dist/system_wrappers/new:3:
  /usr/include/c++/v1/new:132:1: error: function declared '[[noreturn]]' after its first declaration
  _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc();  // not in C++ spec
  ^
  /usr/include/c++/v1/__config:273:30: note: expanded from macro '_LIBCPP_NORETURN'
   #  define _LIBCPP_NORETURN [[noreturn]]
                                ^
  ../../dist/include/mozilla/throw_gcc.h:35:1: note: declaration missing '[[noreturn]]' attribute is here
  __throw_bad_alloc(void)
  ^

  PR:		216186
  Submitted by:	dim
  Obtained from:	upstream

Changes:
  head/mail/thunderbird/files/patch-bug1329520
  head/www/firefox/files/patch-bug1329520
  head/www/firefox-esr/files/patch-bug1329520
  head/www/libxul/files/patch-bug1329520
  head/www/seamonkey/files/patch-bug1329520
Comment 5 commit-hook freebsd_committer 2017-01-30 21:06:26 UTC
A commit references this bug:

Author: jbeich
Date: Mon Jan 30 21:06:02 UTC 2017
New revision: 432867
URL: https://svnweb.freebsd.org/changeset/ports/432867

Log:
  MFH: r432865

  gecko: unbreak with clang/libc++ 4.0

  In file included from mozilla/ipc/contentproc/plugin-container.cpp:7:
  In file included from ../../dist/include/nsXPCOM.h:10:
  In file included from ../../dist/include/nscore.h:20:
  In file included from ../../dist/include/mozilla/mozalloc.h:16:
  In file included from objdir/dist/stl_wrappers/new:44:
  In file included from objdir/dist/system_wrappers/new:3:
  /usr/include/c++/v1/new:132:1: error: function declared '[[noreturn]]' after its first declaration
  _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc();  // not in C++ spec
  ^
  /usr/include/c++/v1/__config:273:30: note: expanded from macro '_LIBCPP_NORETURN'
   #  define _LIBCPP_NORETURN [[noreturn]]
                                ^
  ../../dist/include/mozilla/throw_gcc.h:35:1: note: declaration missing '[[noreturn]]' attribute is here
  __throw_bad_alloc(void)
  ^

  PR:		216186
  Submitted by:	dim
  Obtained from:	upstream
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2017Q1/
  branches/2017Q1/mail/thunderbird/files/patch-bug1329520
  branches/2017Q1/www/firefox/files/patch-bug1329520
  branches/2017Q1/www/firefox-esr/files/patch-bug1329520
  branches/2017Q1/www/libxul/files/patch-bug1329520
  branches/2017Q1/www/seamonkey/files/patch-bug1329520