Last Comment Bug 734490 - "no viable overloaded 'PRIxPTR'" when building with Clang or GCC 4.7
: "no viable overloaded 'PRIxPTR'" when building with Clang or GCC 4.7
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Layout (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla14
Assigned To: Stefan
:
: Jet Villegas (:jet)
Mentors:
: 734036 (view as bug list)
Depends on:
Blocks: clang
  Show dependency treegraph
 
Reported: 2012-03-09 13:37 PST by Gregory Szorc [:gps]
Modified: 2012-06-01 14:11 PDT (History)
9 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
-


Attachments
patch (space inserted after string literals) (3.73 KB, patch)
2012-03-12 00:53 PDT, Stefan
zackw: review+
akeybl: approval‑mozilla‑beta-
Details | Diff | Splinter Review

Description Gregory Szorc [:gps] 2012-03-09 13:37:35 PST
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.
Comment 1 Stefan 2012-03-12 00:51:52 PDT
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.
Comment 2 Stefan 2012-03-12 00:53:00 PDT
Created attachment 604851 [details] [diff] [review]
patch (space inserted after string literals)
Comment 3 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2012-03-12 04:26:49 PDT
I think the patch is OK, but have no idea who should approve it .
Comment 4 Ted Mielczarek [:ted.mielczarek] 2012-03-12 05:17:19 PDT
Comment on attachment 604851 [details] [diff] [review]
patch (space inserted after string literals)

Zack wrote this test, let's try him first.
Comment 5 Zack Weinberg (:zwol) 2012-03-12 08:14:48 PDT
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
Comment 6 Gregory Szorc [:gps] 2012-03-12 15:36:13 PDT
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",
                                                     ^
Comment 7 Zack Weinberg (:zwol) 2012-03-12 16:15:33 PDT
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. :)
Comment 8 Gregory Szorc [:gps] 2012-03-15 10:03:25 PDT
Is there a reason why this hasn't landed?
Comment 10 Marco Bonardo [::mak] 2012-03-16 06:15:03 PDT
https://hg.mozilla.org/mozilla-central/rev/eaea2f2c083a
Comment 11 Zack Weinberg (:zwol) 2012-03-27 19:09:50 PDT
*** Bug 734036 has been marked as a duplicate of this bug. ***
Comment 12 Alex Vincent [:WeirdAl] 2012-05-31 00:13:34 PDT
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 13 Alex Vincent [:WeirdAl] 2012-05-31 12:08:46 PDT
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
Comment 14 Alex Keybl [:akeybl] 2012-05-31 17:42:56 PDT
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.

Note You need to log in before you can comment on or make changes to this bug.