Closed Bug 734490 Opened 12 years ago Closed 12 years ago

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

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla14
Tracking Status
firefox13 - ---

People

(Reporter: gps, Assigned: kdevel)

References

Details

Attachments

(1 file)

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.
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.
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+
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. :)
Is there a reason why this hasn't landed?
https://hg.mozilla.org/mozilla-central/rev/eaea2f2c083a
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
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-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: