Bug 216010 - lang/spidermonkey24: fails to build with libc++ 4.0 (12 ports skipped)
Summary: lang/spidermonkey24: fails to build with libc++ 4.0 (12 ports skipped)
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: Koop Mast
URL:
Keywords: needs-patch
Depends on:
Blocks: 216008
  Show dependency treegraph
 
Reported: 2017-01-13 00:42 UTC by Jan Beich
Modified: 2017-01-19 05:14 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (kwm)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2017-01-13 00:42:45 UTC
In file included from mfbt/decimal/Decimal.cpp:31:
In file included from mfbt/decimal/Decimal.h:44:
In file included from ./dist/system_wrappers_js/string:3:
In file included from /usr/include/c++/v1/string:470:
In file included from /usr/include/c++/v1/string_view:171:
In file included from /usr/include/c++/v1/__string:55:
In file included from ./dist/system_wrappers_js/algorithm:3:
In file included from /usr/include/c++/v1/algorithm:637:
/usr/include/c++/v1/type_traits:2075:14: error: expected class name
    : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {};
             ^
./dist/include/mozilla/Types.h:141:20: note: expanded from macro 'decltype'
#  define decltype __typeof__
                   ^

full build log: http://sprunge.us/dXcJ
first bad: https://github.com/llvm-mirror/libcxx/commit/602fe15f55ea
Comment 1 Jan Beich freebsd_committer 2017-01-13 00:43:07 UTC
While USE_CXXSTD=c++11 can be a workaround it'd expose the port to

js/src/shell/jsoptparse.cpp:256:22: error:
      comparison between pointer and integer ('char *' and 'int')
        if (value[0] == '\0')
            ~~~~~~~~ ^  ~~~~
Comment 2 Jan Beich freebsd_committer 2017-01-18 16:05:11 UTC
libc++ seems to only check whether "__decltype" is defined but not "decltype".

$ cat a.cc
// mozilla/Types.h reduced
#include <stddef.h>

#if defined(__GNUC__) && defined(__cplusplus) && \
  !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
#  define decltype __typeof__
#endif

#include <string>

int main(void) { return 0; }

$ c++ a.cc
a.cc:5:11: warning: 'decltype' macro redefined [-Wmacro-redefined]
#  define decltype __typeof__
          ^
/usr/include/c++/v1/__config:745:11: note: previous definition is here
#  define decltype(__x) __decltype(__x)
          ^
In file included from a.cc:8:
In file included from /usr/include/c++/v1/string:470:
In file included from /usr/include/c++/v1/string_view:171:
In file included from /usr/include/c++/v1/__string:56:
In file included from /usr/include/c++/v1/algorithm:637:
/usr/include/c++/v1/type_traits:2075:14: error: expected class name
    : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {};
             ^
a.cc:5:20: note: expanded from macro 'decltype'
#  define decltype __typeof__
                   ^
1 warning and 1 error generated.
Comment 3 commit-hook freebsd_committer 2017-01-18 16:34:14 UTC
A commit references this bug:

Author: jbeich
Date: Wed Jan 18 16:33:31 UTC 2017
New revision: 431816
URL: https://svnweb.freebsd.org/changeset/ports/431816

Log:
  lang/spidermonkey24: prefer pre-C++11 decltype from libc++

  libc++ 4.0 started to use it within <string> in a way incompatible
  with __typeof__ which broke build but upstream switched to C++11 long
  ago to notice -Wmacro-redefined.

  PR:		216010
  MFH:		2017Q1

Changes:
  head/lang/spidermonkey24/Makefile
  head/lang/spidermonkey24/files/patch-mfbt_Types.h
Comment 4 Jan Beich freebsd_committer 2017-01-18 16:35:18 UTC
libcxx after r276599 may no longer be usable with GCC < 4.6 in pre-C++11 mode. Try to apply the following hack, then include <string>.

diff --git a/include/__config b/include/__config
index 3073a6d6..566e190e 100644
--- a/include/__config
+++ b/include/__config
@@ -752,7 +752,7 @@ template <unsigned> struct __static_assert_check {};
 
 #ifdef _LIBCPP_HAS_NO_DECLTYPE
 // GCC 4.6 provides __decltype in all standard modes.
-#if __has_keyword(__decltype) || _GNUC_VER >= 406
+#if 0 // Test
 #  define decltype(__x) __decltype(__x)
 #else
 #  define decltype(__x) __typeof__(__x)
Comment 5 commit-hook freebsd_committer 2017-01-19 05:14:28 UTC
A commit references this bug:

Author: jbeich
Date: Thu Jan 19 05:13:55 UTC 2017
New revision: 431843
URL: https://svnweb.freebsd.org/changeset/ports/431843

Log:
  MFH: r431816

  lang/spidermonkey24: prefer pre-C++11 decltype from libc++

  libc++ 4.0 started to use it within <string> in a way incompatible
  with __typeof__ which broke build but upstream switched to C++11 long
  ago to notice -Wmacro-redefined.

  PR:		216010
  Approved by:	ports-secteam (junovitch)

Changes:
_U  branches/2017Q1/
  branches/2017Q1/lang/spidermonkey24/Makefile
  branches/2017Q1/lang/spidermonkey24/files/patch-mfbt_Types.h