Browser build failed after adding a new cpp file in layout/base/

RESOLVED FIXED in mozilla35

Status

()

defect
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: TYLin, Assigned: TYLin)

Tracking

Trunk
mozilla35
x86
macOS
Points:
---
Dependency tree / graph
Bug Flags:
qe-verify -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

Add a new cpp file in layout/base as the patch attached.

The following build error will be generated.
 0:32.67 In file included from /Users/tlin/Projects/gecko-dev/obj-firefox/layout/base/Unified_cpp_layout_base1.cpp:67:
 0:32.67 /Users/tlin/Projects/gecko-dev/layout/base/nsCSSRenderingBorders.cpp:1577:3: error: reference to 'S' is ambiguous
 0:32.67   S(" mOuterRect: "), S(mOuterRect), SN();
 0:32.67   ^
 0:32.67 /Users/tlin/Projects/gecko-dev/layout/base/nsBidi.cpp:29:5: note: candidate found by name lookup is '::S'
 0:32.67     S =   eCharType_SegmentSeparator,
 0:32.68     ^
 0:32.68 /Users/tlin/Projects/gecko-dev/layout/base/nsCSSRenderingBorders.h:282:20: note: candidate found by name lookup is 'mozilla::S'
 0:32.68 static inline void S(const char *s) {}
 0:32.68                    ^
 0:32.68 /Users/tlin/Projects/gecko-dev/layout/base/nsCSSRenderingBorders.h:278:20: note: candidate found by name lookup is 'mozilla::S'
 0:32.68 static inline void S(const gfxPoint& p) {}
 0:32.68                    ^
 0:32.68 /Users/tlin/Projects/gecko-dev/layout/base/nsCSSRenderingBorders.h:279:20: note: candidate found by name lookup is 'mozilla::S'
 0:32.68 static inline void S(const gfxSize& s) {}
 0:32.68                    ^
 0:32.68 /Users/tlin/Projects/gecko-dev/layout/base/nsCSSRenderingBorders.h:280:20: note: candidate found by name lookup is 'mozilla::S'
 0:32.68 static inline void S(const gfxRect& r) {}
 0:32.68                    ^
 0:32.68 /Users/tlin/Projects/gecko-dev/layout/base/nsCSSRenderingBorders.h:281:20: note: candidate found by name lookup is 'mozilla::S'
 0:32.68 static inline void S(const gfxFloat f) {}
 0:32.68                    ^
 0:32.68 In file included from /Users/tlin/Projects/gecko-dev/obj-firefox/layout/base/Unified_cpp_layout_base1.cpp:67:
 0:32.68 /Users/tlin/Projects/gecko-dev/layout/base/nsCSSRenderingBorders.cpp:1578:3: error: reference to 'S' is ambiguous
 0:32.68   S(" mInnerRect: "), S(mInnerRect), SN();
 0:32.68   ^
 0:32.68 /Users/tlin/Projects/gecko-dev/layout/base/nsBidi.cpp:29:5: note: candidate found by name lookup is '::S'
 0:32.68     S =   eCharType_SegmentSeparator,
 0:32.68     ^
 0:32.68 /Users/tlin/Projects/gecko-dev/layout/base/nsCSSRenderingBorders.h:282:20: note: candidate found by name lookup is 'mozilla::S'
 0:32.68 static inline void S(const char *s) {}
 0:32.68                    ^
 0:32.68 /Users/tlin/Projects/gecko-dev/layout/base/nsCSSRenderingBorders.h:278:20: note: candidate found by name lookup is 'mozilla::S'
 0:32.68 static inline void S(const gfxPoint& p) {}
 0:32.68                    ^
 0:32.68 /Users/tlin/Projects/gecko-dev/layout/base/nsCSSRenderingBorders.h:279:20: note: candidate found by name lookup is 'mozilla::S'
 0:32.68 static inline void S(const gfxSize& s) {}
 0:32.68                    ^
 0:32.68 /Users/tlin/Projects/gecko-dev/layout/base/nsCSSRenderingBorders.h:280:20: note: candidate found by name lookup is 'mozilla::S'
 0:32.68 static inline void S(const gfxRect& r) {}
 0:32.68                    ^
 0:32.68 /Users/tlin/Projects/gecko-dev/layout/base/nsCSSRenderingBorders.h:281:20: note: candidate found by name lookup is 'mozilla::S'
 0:32.68 static inline void S(const gfxFloat f) {}
 0:32.68                    ^
 0:32.68 2 errors generated.
 0:32.68 
 0:32.68 In the directory  /Users/tlin/Projects/gecko-dev/obj-firefox/layout/base
 0:32.68 The following command failed to execute properly:
 0:32.68 /usr/local/bin/ccache /usr/bin/clang++ -o Unified_cpp_layout_base1.o -c -fvisibility=hidden -DOS_POSIX=1 -DOS_MACOSX=1 -DSTATIC_EXPORTABLE_JS_API -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -DAB_CD=en-US -DNO_NSPR_10_SUPPORT -I/Users/tlin/Projects/gecko-dev/layout/base -I. -I/Users/tlin/Projects/gecko-dev/obj-firefox/ipc/ipdl/_ipdlheaders -I/Users/tlin/Projects/gecko-dev/ipc/chromium/src -I/Users/tlin/Projects/gecko-dev/ipc/glue -I/Users/tlin/Projects/gecko-dev/layout/base/../../content/base/src -I/Users/tlin/Projects/gecko-dev/layout/base/../../content/html/content/src -I/Users/tlin/Projects/gecko-dev/layout/base/../../content/svg/content/src -I/Users/tlin/Projects/gecko-dev/layout/base/../forms -I/Users/tlin/Projects/gecko-dev/layout/base/../generic -I/Users/tlin/Projects/gecko-dev/layout/base/../mathml -I/Users/tlin/Projects/gecko-dev/layout/base/../printing -I/Users/tlin/Projects/gecko-dev/layout/base/../style -I/Users/tlin/Projects/gecko-dev/layout/base/../svg -I/Users/tlin/Projects/gecko-dev/layout/base/../tables -I/Users/tlin/Projects/gecko-dev/layout/base/../xul -I/Users/tlin/Projects/gecko-dev/layout/base/../xul/tree/ -I/Users/tlin/Projects/gecko-dev/docshell/base -I/Users/tlin/Projects/gecko-dev/dom/base -I/Users/tlin/Projects/gecko-dev/dom/xbl -I/Users/tlin/Projects/gecko-dev/view -I../../dist/include -I/Users/tlin/Projects/gecko-dev/obj-firefox/dist/include/nspr -I/Users/tlin/Projects/gecko-dev/obj-firefox/dist/include/nss -fPIC -Qunused-arguments -DMOZILLA_CLIENT -include ../../mozilla-config.h -MD -MP -MF .deps/Unified_cpp_layout_base1.o.pp -Qunused-arguments -Qunused-arguments -Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type -Werror=int-to-pointer-cast -Werror=type-limits -Wempty-body -Wsign-compare -Wno-invalid-offsetof -Wno-inline-new-delete -Wno-c++0x-extensions -Wno-extended-offsetof -Wno-unknown-warning-option -Wno-return-type-c-linkage -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -std=gnu++0x -pthread -DNO_X11 -pipe -DDEBUG -DTRACING -g -fno-omit-frame-pointer -I/Users/tlin/Projects/gecko-dev/obj-firefox/dist/include/cairo /Users/tlin/Projects/gecko-dev/obj-firefox/layout/base/Unified_cpp_layout_base1.cpp


My mozconfig has:

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-firefox
ac_add_options --with-ccache
ac_add_options --enable-application=browser
ac_add_options --enable-debug
ac_add_options --enable-debug-symbols
ac_add_options --enable-tests
ac_add_options --disable-optimize
export ENABLE_MARIONETTE=1
Component: Build Config → Layout
The issue is that nsCSSRenderingBorders.h defines a function called "S".  And nsBidi.cpp defines an enum value called "S".

When we unify nsBidi.cpp and nsCSSRenderingBorders.cpp, this makes "S" ambiguous.

One simple option might be to put the enum in nsBidi.cpp in an anonymous namespace...
Wrapping the enum in nsBidi.cpp in an anonymous namespace does not compile
either since the caller is still ambiguous. The simplest ways might be resolving
at the caller side.
Attachment #8486921 - Flags: review?(bzbarsky)
Comment on attachment 8486921 [details] [diff] [review]
Resolve ambiguous symbol 'S' under layout/base/ (v1)

How about we just rename S/SN/SF to something more self-explaining?
Attachment #8486921 - Flags: review?(bzbarsky) → review-
Sure. Something like S -> PrintAsString, SN -> PrintAsStringNewline, etc.
Yeah, that would be great!
Also fix gfxRect usage in "PrintAsString" as Bug 641426 part 2 did.
Attachment #8486921 - Attachment is obsolete: true
Attachment #8486955 - Flags: review?(bzbarsky)
Comment on attachment 8486955 [details] [diff] [review]
Give S/SN/SF/SN meaningful names.

r=me.  Thanks!
Attachment #8486955 - Flags: review?(bzbarsky) → review+
Try result:
https://tbpl.mozilla.org/?tree=Try&rev=f79f25870703
Assignee: nobody → tlin
Status: NEW → ASSIGNED
Keywords: checkin-needed
Blocks: 1065244
https://hg.mozilla.org/mozilla-central/rev/134555681bd9
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
Flags: qe-verify-
You need to log in before you can comment on or make changes to this bug.