Last Comment Bug 773865 - Ensure `MOZ_WINCONSOLE` preprocessor definition exists if env var is 1
: Ensure `MOZ_WINCONSOLE` preprocessor definition exists if env var is 1
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Build Config (show other bugs)
: Trunk
: x86_64 Windows 7
: -- normal (vote)
: mozilla17
Assigned To: Tim Abraldes [:TimAbraldes] [:tabraldes]
:
: Gregory Szorc [:gps]
Mentors:
Depends on:
Blocks: 778684
  Show dependency treegraph
 
Reported: 2012-07-13 16:37 PDT by Tim Abraldes [:TimAbraldes] [:tabraldes]
Modified: 2012-09-17 11:58 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch v1 (2.33 KB, patch)
2012-07-13 16:37 PDT, Tim Abraldes [:TimAbraldes] [:tabraldes]
no flags Details | Diff | Splinter Review
Patch v2 (1.83 KB, patch)
2012-07-19 13:50 PDT, Tim Abraldes [:TimAbraldes] [:tabraldes]
ted: review+
Details | Diff | Splinter Review

Description Tim Abraldes [:TimAbraldes] [:tabraldes] 2012-07-13 16:37:50 PDT
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
Comment 1 Ted Mielczarek [:ted.mielczarek] 2012-07-16 09:25:52 PDT
Can you just push this all the way up to an AC_DEFINE in configure.in instead?
Comment 2 Tim Abraldes [:TimAbraldes] [:tabraldes] 2012-07-19 13:50:34 PDT
Created attachment 644005 [details] [diff] [review]
Patch v2

I'm not entirely sure how to use `AC_DEFINE`.  Ted: Does this look right?
Comment 3 Tim Abraldes [:TimAbraldes] [:tabraldes] 2012-07-23 18:29:36 PDT
This is running through try:
  https://tbpl.mozilla.org/?tree=Try&rev=25459b473e77
Comment 4 Tim Abraldes [:TimAbraldes] [:tabraldes] 2012-07-24 10:15:58 PDT
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
Comment 5 Ed Morley [:emorley] 2012-07-25 08:12:14 PDT
https://hg.mozilla.org/mozilla-central/rev/95992c6312e3
Comment 6 neil@parkwaycc.co.uk 2012-09-15 16:48:37 PDT
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.
Comment 7 Tim Abraldes [:TimAbraldes] [:tabraldes] 2012-09-17 11:58:20 PDT
(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?

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