Bug 215861

Summary: lang/spidermonkey170 & lang/spidermonkey24: fail to build with clang 4.0
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Jan Beich <jbeich>
Status: Closed FIXED    
Severity: Affects Only Me CC: dim
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugzilla.mozilla.org/show_bug.cgi?id=1012971
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216015
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216016
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216046
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216051
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216052
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216056
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216058
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216072
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216074
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216075
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216076
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216159
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216176
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216194
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216197
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216198
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216199
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216200
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216203
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216206
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216211
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216213
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216214
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216215
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216216
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216217
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216218
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216221
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216222
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216227
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216228
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216233
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216234
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216235
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216253
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216354
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216355
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216356
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216357
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216358
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216615
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216617
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216618
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216619
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216620
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216621
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216622
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216623
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216624
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216626
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216627
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216629
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216630
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216631
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216632
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216633
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216634
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216635
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216636
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216637
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216638
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216639
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216640
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216641
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216642
Bug Depends on:    
Bug Blocks: 216008    
Attachments:
Description Flags
Fix quote() failures none

Description Jan Beich freebsd_committer 2017-01-07 19:57:35 UTC
jsopcode.cpp:6070:45: error: ordered comparison between pointer and zero ('char *' and 'int')
    return QuoteString(&sprinter, s, quote) >= 0;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~

full build log: http://sprunge.us/hcKI
Comment 1 Jan Beich freebsd_committer 2017-01-07 19:57:55 UTC
Upstream fix uses nullptr but the port predates -std=c++11, so we need to use NULL except it doesn't work. NULL is expanded to __null which is not a pointer. Why?

jsopcode.cpp:6070:45: error: ordered comparison between pointer and zero ('char *' and 'long')
    return QuoteString(&sprinter, s, quote) >= NULL;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
Comment 2 Jan Beich freebsd_committer 2017-01-07 21:04:44 UTC
Created attachment 178609 [details]
Fix quote() failures

$ cat >a.cc
int main(void)
{
  void *p = (void *)0xdeadbeef;
  return !(p >= 0);
}

$ c++ a.cc
a.cc:4:14: error: ordered comparison between pointer and zero ('void *' and 'int')
  return !(p >= 0);
           ~ ^  ~
1 error generated.
Comment 3 commit-hook freebsd_committer 2017-01-13 01:43:45 UTC
A commit references this bug:

Author: jbeich
Date: Fri Jan 13 01:42:46 UTC 2017
New revision: 431335
URL: https://svnweb.freebsd.org/changeset/ports/431335

Log:
  lang/spidermonkey170: unbreak with clang 4.0

  Fix quoting failure handling in JSOP_CALLPROP and JSOP_STRING.

  jsopcode.cpp:6070:45: error: ordered comparison between pointer and zero ('char *' and 'int')
      return QuoteString(&sprinter, s, quote) >= 0;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~

  PR:		215861
  Regressed by:	https://github.com/llvm-mirror/clang/commit/4b6ad14285f3
  Obtained from:	upstream (only the specific fix)
  Approved by:	portmgr blanket
  MFH:		2017Q1 (changes existing behavior)

Changes:
  head/lang/spidermonkey170/Makefile
  head/lang/spidermonkey170/files/patch-bug1012971
  head/lang/spidermonkey24/Makefile
  head/lang/spidermonkey24/files/patch-bug1012971
Comment 4 commit-hook freebsd_committer 2017-01-19 05:12:25 UTC
A commit references this bug:

Author: jbeich
Date: Thu Jan 19 05:12:03 UTC 2017
New revision: 431842
URL: https://svnweb.freebsd.org/changeset/ports/431842

Log:
  MFH: r431335

  lang/spidermonkey170: unbreak with clang 4.0

  Fix quoting failure handling in JSOP_CALLPROP and JSOP_STRING.

  jsopcode.cpp:6070:45: error: ordered comparison between pointer and zero ('char *' and 'int')
      return QuoteString(&sprinter, s, quote) >= 0;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~

  PR:		215861
  Regressed by:	https://github.com/llvm-mirror/clang/commit/4b6ad14285f3
  Obtained from:	upstream (only the specific fix)
  Approved by:	portmgr blanket
  Approved by:	ports-secteam (junovitch)

Changes:
_U  branches/2017Q1/
  branches/2017Q1/lang/spidermonkey170/Makefile
  branches/2017Q1/lang/spidermonkey170/files/patch-bug1012971
  branches/2017Q1/lang/spidermonkey24/Makefile
  branches/2017Q1/lang/spidermonkey24/files/patch-bug1012971