nsGtkIMModule.h uses mozilla::-namespaced classes without the namespace, causing build errors like "nsGtkIMModule.h:208:9: error: unknown type name 'WritingMode'; did you mean 'mozilla::WritingMode'?"

RESOLVED FIXED in Firefox 41

Status

()

Core
Widget: Gtk
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

Trunk
mozilla41
Points:
---

Firefox Tracking Flags

(firefox41 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
Local build errors when building mozilla-central today:
{
 0:11.23 In file included from $SRC/widget/gtk/nsWindow.cpp:123:
 0:11.23 In file included from $SRC/widget/gtk/nsWindow.h:34:
 0:11.23 $SRC/widget/gtk/nsGtkIMModule.h:208:9: error: unknown type name 'WritingMode'; did you mean 'mozilla::WritingMode'?
 0:11.23         WritingMode mWritingMode;
 0:11.24         ^~~~~~~~~~~
 0:11.24         mozilla::WritingMode
 0:11.24 $SRC/layout/generic/WritingModes.h:155:7: note: 'mozilla::WritingMode' declared here
 0:11.24 class WritingMode {
 0:11.24       ^
 0:11.30 In file included from $SRC/widget/gtk/nsWindow.cpp:123:
 0:11.30 In file included from $SRC/widget/gtk/nsWindow.h:34:
 0:11.30 $SRC/widget/gtk/nsGtkIMModule.h:224:27: error: unknown type name 'WidgetQueryContentEvent'; did you mean 'mozilla::WidgetQueryContentEvent'?
 0:11.30         void Assign(const WidgetQueryContentEvent& aSelectedTextEvent);
 0:11.30                           ^~~~~~~~~~~~~~~~~~~~~~~
 0:11.30                           mozilla::WidgetQueryContentEvent
 0:11.30 ../../dist/include/mozilla/TextEvents.h:446:7: note: 'mozilla::WidgetQueryContentEvent' declared here
 0:11.30 class WidgetQueryContentEvent : public WidgetGUIEvent
 0:11.30       ^
 0:11.34 In file included from $SRC/widget/gtk/nsWindow.cpp:123:
 0:11.34 In file included from $SRC/widget/gtk/nsWindow.h:34:
 0:11.34 $SRC/widget/gtk/nsGtkIMModule.h:220:28: error: use of undeclared identifier 'WritingMode'
 0:11.34             mWritingMode = WritingMode();
 0:11.34                            ^
 0:11.36 $SRC/widget/gtk/nsGtkIMModule.h:233:13: error: no template named 'CheckedInt'; did you mean 'mozilla::CheckedInt'?
 0:11.36             CheckedInt<uint32_t> endOffset =
 0:11.36             ^~~~~~~~~~
 0:11.36             mozilla::CheckedInt
 0:11.36 ../../dist/include/mozilla/CheckedInt.h:539:16: note: 'mozilla::CheckedInt' declared here
 0:11.36   friend class CheckedInt;
 0:11.36                ^
 0:11.39 In file included from $SRC/widget/gtk/nsWindow.cpp:123:
 0:11.39 In file included from $SRC/widget/gtk/nsWindow.h:34:
 0:11.39 $SRC/widget/gtk/nsGtkIMModule.h:234:17: error: no template named 'CheckedInt'; did you mean 'mozilla::CheckedInt'?
 0:11.39                 CheckedInt<uint32_t>(mOffset) + mLength;
 0:11.39                 ^~~~~~~~~~
 0:11.39                 mozilla::CheckedInt
 0:11.39 ../../dist/include/mozilla/CheckedInt.h:539:16: note: 'mozilla::CheckedInt' declared here
 0:11.39   friend class CheckedInt;
 0:11.39                ^
 0:12.26 5 errors generated.
}

These were caused by https://hg.mozilla.org/mozilla-central/rev/caa60ea601b2 which added usages of these classes to this header file.

I didn't get this build error in a different local build (with a different mozconfig), so I think the default build is saved from hitting this by virtue of unified builds happening to pull in a "using namespace mozilla;" from some other .cpp file into this compilation unit.

We shouldn't depend on that, though. (and my particular constellation of mozconfig options in my failing build isn't saved by that)
(Assignee)

Comment 1

2 years ago
Created attachment 8621778 [details] [diff] [review]
fix v1

This fixes the build errors for me (& lets me complete my build).
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #8621778 - Flags: review?(masayuki)
(Assignee)

Comment 2

2 years ago
For the record, the mozconfig I'm using in the affected build is as follows:
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj
ac_add_options --enable-debug --disable-optimize
ac_add_options --disable-crashreporter
ac_add_options --disable-installer
ac_add_options --disable-updater
ac_add_options --enable-valgrind
ac_add_options --enable-warnings-as-errors
ac_add_options --enable-profiling
ac_add_options --disable-accessibility
ac_add_options --disable-eme
ac_add_options --disable-gamepad
ac_add_options --disable-gstreamer
ac_add_options --disable-jsd
ac_add_options --disable-sandbox
ac_add_options --disable-universalchardet
ac_add_options --disable-necko-wifi
ac_add_options --disable-wave
ac_add_options --disable-webapp-runtime
ac_add_options --disable-webaudio
ac_add_options --disable-webgl
ac_add_options --disable-webrtc
ac_add_options --disable-webspeech
ac_add_options --disable-webspeechtestbackend
ac_add_options --without-intl-api

Updated

2 years ago
Attachment #8621778 - Flags: review?(masayuki) → review+
(Assignee)

Comment 3

2 years ago
Since this is trivial & fixes bustage, and since I think it's Saturday morning for masayuki & all of the normal widget/gtk reviewers that I'm aware of, I punted this review to Ms2ger instead of masayuki, since he was around & up for reviewing.

If masayuki prefers that we fix this issue some other way (e.g. with typedefs of some sort), I'll let him take care of that separately; and in the meantime, I'll still be able to build. :)

Comment 4

2 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/55180a018737

Comment 5

2 years ago
I also hit this for a failed compile today with a non-standard mozconfig.  

. $topsrcdir/browser/config/mozconfig

ac_add_options --enable-application=browser
ac_add_options --prefix="/usr/local"
ac_add_options --libdir="/usr/local/lib64"
ac_add_options --with-pthreads
ac_add_options --enable-default-toolkit=cairo-gtk3
ac_add_options --enable-pango
ac_add_options --enable-svg
ac_add_options --enable-canvas
ac_add_options --enable-safe-browsing
ac_add_options --enable-libnotify
ac_add_options --enable-url-classifier
ac_add_options --enable-gio
ac_add_options --enable-chrome-format=omni

mk_add_options MOZ_MAKE_FLAGS="-j9 "
ac_add_options --enable-gstreamer
ac_add_options --enable-bundled-fonts
ac_add_options --enable-media-plugins
ac_add_options --enable-webm
ac_add_options --with-x
ac_add_options --with-ccache
ac_add_options --enable-extensions=default
ac_add_options --disable-gamepad
ac_add_options --disable-webspeech        # Disable support for HTML Speech API
ac_add_options --disable-accessibility    # Disable accessibility support
ac_add_options --disable-webrtc           # Disable support for WebRTC
ac_add_options --disable-webapp-runtime   # Disable Web App Runtime
ac_add_options --disable-websms-backend
ac_add_options --disable-android-omx
ac_add_options --disable-xprint
ac_add_options --disable-tests
ac_add_options --disable-necko-wifi
ac_add_options --disable-updater
ac_add_options --disable-parental-controls
ac_add_options --disable-debug
ac_add_options --disable-dbus
ac_add_options --with-intl-api
ac_add_options --without-b2g
ac_add_options --enable-optimize=" -O3"
https://hg.mozilla.org/mozilla-central/rev/55180a018737
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-firefox41: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Thank you for the fix. I guess that it doesn't cause bustage is |using namespace mozilla;| in another .cpp file. We should rename legacy classes with out ns prefix and in mozilla namespace as soon as possible...
You need to log in before you can comment on or make changes to this bug.