"no viable overloaded 'PRIxPTR'" when building with Clang or GCC 4.7

RESOLVED FIXED in mozilla14

Status

()

Core
Layout
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: gps, Assigned: Stefan)

Tracking

Trunk
mozilla14
Points:
---

Firefox Tracking Flags

(firefox13-)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
Clang SVN builds have been broken since 2012-03-07 with the following:

/home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/layout/base/tests/TestPoisonArea.cpp:400:12: error: no viable overloaded 'PRIxPTR'
    printf("INFO | poison area assumed at 0x%.*"PRIxPTR"\n", SIZxPTR, result);
           ^
/home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/layout/base/tests/TestPoisonArea.cpp:408:14: error: no viable overloaded 'PRIxPTR'
      printf("INFO | poison area allocated at 0x%.*"PRIxPTR
             ^
/home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/layout/base/tests/TestPoisonArea.cpp:419:14: error: no viable overloaded 'PRIxPTR'
      printf("INFO | poison area assumed at 0x%.*"PRIxPTR
             ^
/home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/layout/base/tests/TestPoisonArea.cpp:427:14: error: no viable overloaded 'PRIxPTR'
      printf("INFO | poison area allocated at 0x%.*"PRIxPTR
             ^
/home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/layout/base/tests/TestPoisonArea.cpp:436:14: error: no viable overloaded 'PRIxPTR'
      printf("INFO | poison area allocated at 0x%.*"PRIxPTR
             ^
/home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/layout/base/tests/TestPoisonArea.cpp:458:10: error: no viable overloaded 'PRIxPTR'
  printf("INFO | positive control allocated at 0x%.*"PRIxPTR"\n",
         ^
/home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/layout/base/tests/TestPoisonArea.cpp:489:10: error: no viable overloaded 'PRIxPTR'
  printf("INFO | negative control allocated at 0x%.*"PRIxPTR"\n",
         ^
7 errors generated.

In the directory  /home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/obj/layout/base/tests
The following command failed to execute properly:
/home/jenkins-slave/workspace/llvm/bin/clang++ -o TestPoisonArea.o -c -I../../../dist/stl_wrappers -I../../../dist/system_wrappers -include /home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/config/gcc_hidden.h -DMOZ_GLUE_IN_PROGRAM -DOSTYPE="Linux3.0" -DOSARCH=Linux -D_IMPL_NS_LAYOUT -I/home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/layout/base/tests -I. -I../../../dist/include -I../../../dist/include/nsprpub -I/home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/obj/dist/include/nspr -I/home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/obj/dist/include/nss -fPIC -Qunused-arguments -fno-rtti -pedantic -Qunused-arguments -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-c++0x-extensions -Wno-extended-offsetof -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-long-long -fno-exceptions -fno-strict-aliasing -std=gnu++0x -pthread -ffunction-sections -fdata-sections -pipe -DNDEBUG -DTRIMMED -g -Os -freorder-blocks -fomit-frame-pointer -Qunused-arguments -DMOZILLA_CLIENT -include ../../../mozilla-config.h -MD -MF .deps/TestPoisonArea.pp /home/jenkins-slave/workspace/mozilla-central-linux-x64-optimized-llvm-tip/layout/base/tests/TestPoisonArea.cpp
make[7]: *** [TestPoisonArea.o] Error 1
make[6]: *** [libs] Error 2
make[5]: *** [base_libs] Error 2

The cause was on Clang's side, as they were mucking around with user-defined literals and string literals.

Rafael did some preliminary investigation, but I can't remember what came of it. I believe he knows whether we need to work around this or whether Clang needs to change their code. Either way, we now have a bug on file.
(Assignee)

Comment 1

5 years ago
The upcoming gcc 4.7.0 complains about

error: unable to find string literal operator 'operator"" PRIxPTR'

This can be prevented by inserting a blank after the string literal.
(Assignee)

Comment 2

5 years ago
Created attachment 604851 [details] [diff] [review]
patch (space inserted after string literals)
I think the patch is OK, but have no idea who should approve it .
Comment on attachment 604851 [details] [diff] [review]
patch (space inserted after string literals)

Zack wrote this test, let's try him first.
Attachment #604851 - Flags: review?(zackw)
Assignee: nobody → kdevel
Summary: "no viable overloaded 'PRIxPTR'" when building with Clang → "no viable overloaded 'PRIxPTR'" when building with Clang or GCC 4.7
Comment on attachment 604851 [details] [diff] [review]
patch (space inserted after string literals)

Review of attachment 604851 [details] [diff] [review]:
-----------------------------------------------------------------

I don't have a copy of the C++11 final specification, and it isn't obvious to me from the draft I do have whether this is supposed to happen.  But the patch seems obviously safe and effective, so r=me
Attachment #604851 - Flags: review?(zackw) → review+
(Reporter)

Comment 6

5 years ago
FWIW, Clang now has a better error diagnostic with clarification on C++11.

ws/layout/base/tests/TestPoisonArea.cpp>:489:54: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
  printf("INFO | negative control allocated at 0x%.*"PRIxPTR"\n",
                                                     ^
I'm annoyed at C++11 for what sounds like yet another case where the preprocessor has to be aware of the language, but whatever.  It's not like I have to implement the rules anymore. :)
(Reporter)

Comment 8

5 years ago
Is there a reason why this hasn't landed?
https://hg.mozilla.org/integration/mozilla-inbound/rev/eaea2f2c083a
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/eaea2f2c083a
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14

Updated

5 years ago
Duplicate of this bug: 734036
tracking-firefox13: --- → ?
FF13 is about to go to release with this compile-time bug.  I already felt a burn from FF12 compiling when I upgraded to Fedora 17, courtesy of bug 725655.  Can we please get this landed on 13?
Comment on attachment 604851 [details] [diff] [review]
patch (space inserted after string literals)

[Approval Request Comment]
Bug caused by (feature/regressing bug #): gcc 4.7 enforcing C++11
User impact if declined: gcc 4.7 cannot cleanly build layout tests for Mozilla
Testing completed (on m-c, etc.): FF14 Aurora already has this patch, and the code builds fine.
Risk to taking this patch (and alternatives if risky): Negligible:  affects building of tests only
String or UUID changes made by this patch: only to printf statements
Attachment #604851 - Flags: approval-mozilla-beta?
Comment on attachment 604851 [details] [diff] [review]
patch (space inserted after string literals)

[Triage Comment]
This patch missed our final build of FF13. People using GCC 4.7 will need to apply this patch locally.
Attachment #604851 - Flags: approval-mozilla-beta? → approval-mozilla-beta-

Updated

5 years ago
tracking-firefox13: ? → -
You need to log in before you can comment on or make changes to this bug.