make handle -DVAR=NUMBER such that #if VAR == NUMBER works



Firefox Build System
8 years ago
18 days ago


(Reporter: ted, Assigned: ted)


Dependency tree / graph

Firefox Tracking Flags

(Not tracked)



(1 attachment, 1 obsolete attachment)



8 years ago
Created attachment 448546 [details] [diff] [review]
support -DFOO=NUMBER better

Currently if you do:

and then in your preprocessed file:
#if FOO=100
some text

The #if condition will never be true. This is because the expression parser ( calls int() on the values it parses out, but the commandline handler for puts string values in for variables from the commandline. ( appears to handle all variable values as strings, FWIW).

This simple patch makes the commandline handler treat all-digit values as ints, and includes a couple of tests.
Attachment #448546 - Flags: review?(l10n)

Comment 1

8 years ago
Comment on attachment 448546 [details] [diff] [review]
support -DFOO=NUMBER better

This is assuming that in the case, we're forcing our defines to be strings, and that's what it is, right? (unescapeDefines is only true for

r- based on the detail that 0100 should be parsed as octal, as that's what #define does, see

Which is, oh shiny, inconsistent to what Expressions, do. So

#define FOO 0100
#if FOO==0100
0100 not shown
#if FOO==64
64 shown

Happy faces, anyone? Should that be fixed?

We should make document the behaviour we end up with, too :-)
Attachment #448546 - Flags: review?(l10n) → review-

Comment 2

8 years ago
Created attachment 448585 [details] [diff] [review]
(v2) support -DFOO=NUMBER better, also support octal

Lame, but I fixed it.
Attachment #448546 - Attachment is obsolete: true
Attachment #448585 - Flags: review?(l10n)


8 years ago
Attachment #448585 - Flags: review?(l10n) → review+
Last Resolved: 8 years ago
Resolution: --- → FIXED

Comment 4

8 years ago
I forgot to mention that the problem manifested itself after the
latest change:
$ hg log nsHelperAppDlg.js
changeset:   43659:8f63228de64c
user:        Gavin Sharp <>
date:        Mon Jun 07 10:31:58 2010 -0400
summary:     Bug 570155: Make the helperApp dialog use the getFileDisplayname helper consistently (fixes a broken #ifdef exposed by bug 569373), and refactor some ifdefs to avoid code duplication, r=Neil

This fix probably brings a dormant bug to the light of the day.
(That is for some reason, this.dialog was not null for sometime?)


18 days ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.