The default bug view has changed. See this FAQ.

Ensure `MOZ_WINCONSOLE` preprocessor definition exists if env var is 1

RESOLVED FIXED in mozilla17

Status

()

Core
Build Config
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: TimAbraldes, Assigned: TimAbraldes)

Tracking

Trunk
mozilla17
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Created attachment 642134 [details] [diff] [review]
Patch v1

The `MOZ_WINCONSOLE` env var is used to determine whether the application being built should be built as a console app or as a Windows app [1].  In some files, `MOZ_WINCONSOLE` is used as a preprocessor definition [2][3][4].  Setting up the preprocessor definition requires modifying the makefile of each module that wants to use the definition, e.g. [5].  In some cases we are not doing this correctly.  For example, in browser/app/nsBrowserApp.cpp, it is currently impossible for the `#ifdef MOZ_WINCONSOLE` branch to be compiled.

The attached patch changes config.mk to set up the preprocessor definition `MOZ_WINCONSOLE` if the env var is 1.

[1] https://mxr.mozilla.org/mozilla-central/source/config/config.mk?rev=88aaf6c529b9#583
[2] https://mxr.mozilla.org/mozilla-central/source/xulrunner/stub/nsXULStub.cpp?rev=a15d75939cd5#56
[3] https://mxr.mozilla.org/mozilla-central/source/xulrunner/app/nsXULRunnerApp.cpp?rev=3f408698a03f#52
[4] https://mxr.mozilla.org/mozilla-central/source/browser/app/nsBrowserApp.cpp?rev=601e2a3564ac#46
[5] https://mxr.mozilla.org/mozilla-central/source/xulrunner/app/Makefile.in#60
Attachment #642134 - Flags: review?(ted.mielczarek)
Can you just push this all the way up to an AC_DEFINE in configure.in instead?
Created attachment 644005 [details] [diff] [review]
Patch v2

I'm not entirely sure how to use `AC_DEFINE`.  Ted: Does this look right?
Attachment #642134 - Attachment is obsolete: true
Attachment #642134 - Flags: review?(ted.mielczarek)
Attachment #644005 - Flags: review?(ted.mielczarek)
Attachment #644005 - Flags: review?(ted.mielczarek) → review+
This is running through try:
  https://tbpl.mozilla.org/?tree=Try&rev=25459b473e77
Status: NEW → ASSIGNED
https://hg.mozilla.org/integration/mozilla-inbound/rev/95992c6312e3

For some reason, hg.mozilla.org is showing that changeset as blank but browsing to the files in it show that the changes have in fact been applied
Target Milestone: --- → mozilla17
https://hg.mozilla.org/mozilla-central/rev/95992c6312e3
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Blocks: 778684

Comment 6

5 years ago
Comment on attachment 644005 [details] [diff] [review]
Patch v2

This doesn't actually help, because it doesn't make MOZ_WINCONSOLE default to the value of MOZ_DEBUG. So you still build the app with a console, but it's the MessageBox version Output function that gets compiled.

Additionally if you set MOZ_WINCONSOLE during configure, but then later rebuild from a different shell where you forgot to set MOZ_WINCONSOLE, then the Makefile will invoke the MOZ_DEBUG default behaviour, but Output continues to get compiled with the remembered MOZ_WINCONSOLE setting.
(In reply to neil@parkwaycc.co.uk from comment #6)
> Comment on attachment 644005 [details] [diff] [review]
> Patch v2
> 
> This doesn't actually help, because it doesn't make MOZ_WINCONSOLE default
> to the value of MOZ_DEBUG. So you still build the app with a console, but
> it's the MessageBox version Output function that gets compiled.

It sounds like this is probably a separate issue: This patch helps in the sense that setting the MOZ_WINCONSOLE env var now affects the MOZ_WINCONSOLE preprocessor definition.  If we want MOZ_WINCONSOLE to default to the value of MOZ_DEBUG, shouldn't that be a separate bug?

> Additionally if you set MOZ_WINCONSOLE during configure, but then later
> rebuild from a different shell where you forgot to set MOZ_WINCONSOLE, then
> the Makefile will invoke the MOZ_DEBUG default behaviour, but Output
> continues to get compiled with the remembered MOZ_WINCONSOLE setting.

Is the situation different for other "env var -> preprocessor define"s (e.g. MOZ_METRO)?  How do we avoid this issue for those?
You need to log in before you can comment on or make changes to this bug.