Commit Graph

247 Commits

Author SHA1 Message Date
Chris Peterson
ac7932ab8d Bug 1662629 - Replace MOZ_MUST_USE with [[nodiscard] in xpcom. r=xpcom-reviewers,sg
The MOZ_MUST_USE macro is defined as clang's and gcc's nonstandard __attribute__((warn_unused_result)). Now that we compile as C++17 by default (bug 1560664), we can replace MOZ_MUST_USE with C++17's standard [[nodiscard]] attribute.

The [[nodiscard]] attribute must precede a function declaration's declaration specifiers (like static, extern, inline, or virtual). The __attribute__((warn_unused_result)) attribute does not have this order restriction.

Differential Revision: https://phabricator.services.mozilla.com/D89092
2020-09-02 09:18:12 +00:00
Jonathan Watt
9eda8c7403 Bug 1661730. Allow std::function to be specified as a native type in XPIDL. r=nika
std::function requires parenthesis to be supported in the type.

Differential Revision: https://phabricator.services.mozilla.com/D88636
2020-08-28 17:51:36 +00:00
Ricky Stewart
f52f291457 Bug 1654602 - Run xpidl unit tests as part of xpcom subsuite r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D84557
2020-07-22 17:51:14 +00:00
Eric Rahm
ba9b93f039 Bug 1646543 - Replace blacklist with more appropriate names. r=xpcom-reviewers,nika
This removes variants of "blacklist" from the xpcom directory. The preference name "network.file.path_blacklist" is left in place and will need a more thorough plan for removal. Instances of `MOZ_ASAN_BLACKLIST` remain as well and should be replaced in a larger modifcation of the `#define` in the mfbt component.

Differential Revision: https://phabricator.services.mozilla.com/D80098
2020-06-17 23:55:46 +00:00
Ricky Stewart
5b7d4ea2b1 Bug 1635755 - Part 1: Emit JSON data in deterministic order in jsonxpt r=nika
In Python 3, iteration order over the contents of a native `dict` is always unpredictable, which results in bugs like bug 1635755 where `xptdata.cpp` has irreproducible content. To avoid this, we be sure to always write out JSON in a fixed, deterministic order.

Differential Revision: https://phabricator.services.mozilla.com/D74443
2020-05-11 15:35:58 +00:00
Ricky Stewart
1395fb03f0 Bug 1634737 - GeneratedFile() template should yell at you if you try to set py2=True r=glandium
As of bug 1621451 this argument was ignored, but it just silently runs your code with `python3` if you pass it anyway. Ensure this doesn't happen any more, and protect against any other unexpected arguments as well.

Differential Revision: https://phabricator.services.mozilla.com/D73485
2020-05-05 15:53:37 +00:00
Ricky Stewart
933b3522b8 Bug 1633156 - Don't emit cached table files from ply r=glandium
`ply`, [by design](https://github.com/dabeaz/ply/issues/79), does not produce reproducible table files; hence bug 1633156. (Note that this was *always* true, but only became a problem once we switched to Python 3, which has more unpredictable dict iteration order than Python 2.7, at least prior to [3.7](https://docs.python.org/3/whatsnew/3.7.html#summary-release-highlights).)

In any other circumstance I would consider submitting a patch to `ply` to fix this, but as of the [in-progress version 4.0 of the library](https://github.com/dabeaz/ply/blob/master/CHANGES), it doesn't even emit this cached data any more, and indeed the [latest version of the code](1fac9fed64/ply) doesn't even call `open()` at all except to do logging or to read the text data to be parsed from `stdin`. So if we were going to pin our future on `ply` and upgrade to later versions of the library in the future, we would have to live in a world where `ply` doesn't generate cached table files for us anyway.

Emitting the cached table files so later build steps can consume them is an "optimization", but it's not clear exactly how much actual value that optimization provides overall. Quoth the `CHANGES` file from that repository:

```
PLY no longer writes cached table files.  Honestly, the use of
the cached files made more sense when I was developing PLY on
my 200Mhz PC in 2001. It's not as much as an issue now. For small
to medium sized grammars, PLY should be almost instantaneous.
```

In practice, I have found this to be true; namely, `./mach build pre-export export` takes just about as long on my machine after this patch as it did before, and in a try push I performed, there's no noticeable performance regression from applying this patch. In local testing I also found that generating the LALR tables in calls to `yacc()` takes about 0.01s on my machine generally, and we generate these tables a couple dozen times total over the course of the `export` tier now. This isn't *nothing*, but in my opinion it's also not nearly long enough where it would be a concern given how long `export` already takes.

That `CHANGES` file also stresses that if caching this data is important, we have the option of doing so via `pickle`. If and when we decide that re-enabling this optimization is valuable for us, we should take control of this process and perform the generation in such a way that we can guarantee reproducibility.

Differential Revision: https://phabricator.services.mozilla.com/D73484
2020-05-07 00:39:28 +00:00
Kartikaya Gupta
23c0fd760e Bug 1636006 - Restore py2 compatibility in xpidl.py. r=froydnj
This file is used by the searchfox indexer using python2, so maintaining
py2-compatibility is desirable if not unduly burdensome.

Differential Revision: https://phabricator.services.mozilla.com/D74224
2020-05-07 11:21:41 +00:00
Nathan Froyd
68154b269c Bug 1635229 - output relative paths in XPIDL-generated source files; r=asuth,glandium,mccr8
We currently generate absolute paths in all of our XPIDL-generated
source files, which is not so great for several reasons (deterministic
generation of files across machines, Searchfox analysis logic, shared
compilation caches, etc.).  Let's generate paths that still indicate
where you should be looking, but are identical across compilations,
objdirs, etc.

Differential Revision: https://phabricator.services.mozilla.com/D73747
2020-05-06 10:56:58 +00:00
Bill Gianopoulos
aebe7bbaed Bug 1634864 - xpidl.xpidl.IDLError: error: Unexpected parameter attribute. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D73543
2020-05-05 08:26:17 +00:00
Csoregi Natalia
5da0fac6d9 Backed out changeset eb1b773902c3 (bug 1635229) for bustages on xpidl/runtests.py. CLOSED TREE 2020-05-06 05:05:41 +03:00
Nathan Froyd
c2d1969d66 Bug 1635229 - output relative paths in XPIDL-generated source files; r=asuth,glandium,mccr8
We currently generate absolute paths in all of our XPIDL-generated
source files, which is not so great for several reasons (deterministic
generation of files across machines, Searchfox analysis logic, shared
compilation caches, etc.).  Let's generate paths that still indicate
where you should be looking, but are identical across compilations,
objdirs, etc.

Differential Revision: https://phabricator.services.mozilla.com/D73747
2020-05-06 01:35:30 +00:00
Ricky Stewart
3749c34fb4 Bug 1632916 - Run JS/web-platform/ipdl build machinery in Python 3 r=jgraham,nika,glandium
Differential Revision: https://phabricator.services.mozilla.com/D72478
2020-05-05 20:32:12 +00:00
Razvan Maries
c7c91266a0 Backed out changeset c63401aa60bc (bug 1634864) for build bustages. CLOSED TREE 2020-05-05 11:18:56 +03:00
Bill Gianopoulos
75c7c1ec6d Bug 1634864 - xpidl.xpidl.IDLError: error: Unexpected parameter attribute. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D73543
2020-05-05 07:26:29 +00:00
Emilio Cobos Álvarez
62bddcab88 Bug 1635094 - Allow having const WebIDL pointers in XPIDL. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D73634
2020-05-04 17:08:14 +00:00
Cosmin Sabou
71a40eae48 Backed out 2 changesets (bug 1635094) for build bustages on nsMacShellService.cpp. CLOSED TREE
Backed out changeset 0a2b0c6ea19a (bug 1635094)
Backed out changeset ead4f26f76ee (bug 1635094)
2020-05-04 20:04:06 +03:00
Emilio Cobos Álvarez
b4e5a478aa Bug 1635094 - Allow having const WebIDL pointers in XPIDL. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D73634
2020-05-04 12:54:15 +00:00
Bogdan Tara
f137fa0613 Backed out 6 changesets (bug 1632916, bug 1599658, bug 1633037, bug 1633039, bug 1633016, bug 1632920) for SA bustages CLOSED TREE
Backed out changeset 332ce0963b4e (bug 1633039)
Backed out changeset a9904cbc40d9 (bug 1633037)
Backed out changeset d06b0ec349f8 (bug 1599658)
Backed out changeset 8fd300cad80f (bug 1633016)
Backed out changeset f8820941c703 (bug 1632916)
Backed out changeset ac9c2c8746ed (bug 1632920)
2020-05-02 01:49:29 +03:00
Ricky Stewart
d990224458 Bug 1632916 - Run JS/web-platform/ipdl build machinery in Python 3 r=jgraham,nika,glandium
Differential Revision: https://phabricator.services.mozilla.com/D72478
2020-05-01 16:31:21 +00:00
Mike Hommey
71ccad7a1b Bug 1634187 - Turn xpcom/idl-parser/xpidl into a proper python 3-ready module. r=rstewart
Differential Revision: https://phabricator.services.mozilla.com/D73151
2020-04-30 21:49:10 +00:00
Daniel Varga
a184202d1f Backed out changeset 5c3005879c35 (bug 1634187) for causing build bustages at builds/worker/checkouts/gecko/xpcom/idl-parser/xpidl/runtests.py
CLOSED TREE
2020-04-30 02:58:00 +03:00
Mike Hommey
697361fcd0 Bug 1634187 - Turn xpcom/idl-parser/xpidl into a proper python 3-ready module. r=rstewart
Differential Revision: https://phabricator.services.mozilla.com/D73151
2020-04-29 23:05:29 +00:00
Ricky Stewart
38f4d8fa39 Bug 1621361 - Convert webidl to py3_action r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D71803
2020-04-24 16:17:26 +00:00
Mike Hommey
0f365ba2c5 Bug 1621452 - Generate xpidllex.py and xpidlyacc.py with python2. r=rstewart
Ply doesn't actually support python3. The generation of the files seems
to work with python3 for some reason, but running the corresponding
tests doesn't. The only version of ply that supports python3 is
currently in beta, so upgrading ply is probably not an option at the
moment.

Other commands that do use ply (mach webidl-parser-test and
ipc/ipdl/Makefile.in) have not switched to python3 (probably because
they don't work). Let's go with the simpler thing for now: switch back
to python 2 for xpidllex.py and xpidlyacc.py, which will make them
deterministically created again.

Differential Revision: https://phabricator.services.mozilla.com/D67400

--HG--
extra : moz-landing-system : lando
2020-03-18 23:53:17 +00:00
Mike Shal
c8abdd68c2 Bug 1616630 - Use py3_action for GENERATED_FILES that already support it; r=firefox-build-system-reviewers,kvark,rstewart
Differential Revision: https://phabricator.services.mozilla.com/D63438

--HG--
extra : moz-landing-system : lando
2020-02-21 00:05:17 +00:00
Csoregi Natalia
6360b24e80 Backed out 2 changesets (bug 1616630) for Android bustage. CLOSED TREE
Backed out changeset 15016546c954 (bug 1616630)
Backed out changeset dcb7dc51633b (bug 1616630)
2020-02-20 21:24:11 +02:00
Mike Shal
39492660f4 Bug 1616630 - Use py3_action for GENERATED_FILES that already support it; r=firefox-build-system-reviewers,kvark,rstewart
Depends on D63437

Differential Revision: https://phabricator.services.mozilla.com/D63438

--HG--
extra : moz-landing-system : lando
2020-02-20 16:21:55 +00:00
Mike Shal
d8e4653d19 Bug 1611326 - Default to py3_action, and add a py2 attribute to GENERATED_FILES; r=firefox-build-system-reviewers,rstewart
GENERATED_FILES now defaults to python3 unless py2=True is specified as
an argument. All existing GENERATED_FILES scripts and GeneratedFile
templates have the py2=True attribute added, so this patch should
effectively be a no-op.

Going forward, individual scripts can be converted to python3 and their
corresponding py2=True attribute can be deleted. In effect, this patch
will be backed out in pieces until all scripts run in python3, at which
point the py2 attribute itself can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D60919

--HG--
extra : moz-landing-system : lando
2020-02-14 13:22:46 +00:00
Cosmin Sabou
ff39f9206d Backed out 2 changesets (bug 1613263, bug 1611326) for presummably causing l10n langpack bustages. a=backout
Backed out changeset 77e54e76848a (bug 1611326)
Backed out changeset 36ba18ac3a68 (bug 1613263)
2020-02-14 15:02:21 +02:00
Mike Shal
ad0c283ab2 Bug 1611326 - Default to py3_action, and add a py2 attribute to GENERATED_FILES; r=firefox-build-system-reviewers,rstewart
GENERATED_FILES now defaults to python3 unless py2=True is specified as
an argument. All existing GENERATED_FILES scripts and GeneratedFile
templates have the py2=True attribute added, so this patch should
effectively be a no-op.

Going forward, individual scripts can be converted to python3 and their
corresponding py2=True attribute can be deleted. In effect, this patch
will be backed out in pieces until all scripts run in python3, at which
point the py2 attribute itself can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D60919

--HG--
extra : moz-landing-system : lando
2020-02-13 23:07:04 +00:00
Brindusan Cristian
e2fb6b8344 Backed out changeset 7fefed11f117 (bug 1611326) for build bustages at update-1.xpi.stub. CLOSED TREE 2020-02-13 23:33:34 +02:00
Mike Shal
e6464dd404 Bug 1611326 - Default to py3_action, and add a py2 attribute to GENERATED_FILES; r=firefox-build-system-reviewers,rstewart
GENERATED_FILES now defaults to python3 unless py2=True is specified as
an argument. All existing GENERATED_FILES scripts and GeneratedFile
templates have the py2=True attribute added, so this patch should
effectively be a no-op.

Going forward, individual scripts can be converted to python3 and their
corresponding py2=True attribute can be deleted. In effect, this patch
will be backed out in pieces until all scripts run in python3, at which
point the py2 attribute itself can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D60919

--HG--
extra : moz-landing-system : lando
2020-02-13 20:31:50 +00:00
Andrew McCreight
359a6cd8c2 Bug 1611173 - Remove support for non-nsISupports XPIDL interfaces. r=nika
It used to be that some XPIDL interfaces were allowed to be non-nsISupports,
and were only used to hold a bunch of constants. It appears that we've now
had enough de-COM work happen that there are no longer any, so we can remove
support for this.

Differential Revision: https://phabricator.services.mozilla.com/D61008

--HG--
extra : moz-landing-system : lando
2020-01-24 23:13:30 +00:00
Brindusan Cristian
d5beb3eb6b Backed out changeset 27bd6308aff7 (bug 1611173) for build bustages at runtests.py. CLOSED TREE 2020-01-25 00:19:04 +02:00
Andrew McCreight
f446abff25 Bug 1611173 - Remove support for non-nsISupports XPIDL interfaces. r=nika
It used to be that some XPIDL interfaces were allowed to be non-nsISupports,
and were only used to hold a bunch of constants. It appears that we've now
had enough de-COM work happen that there are no longer any, so we can remove
support for this.

Differential Revision: https://phabricator.services.mozilla.com/D61008

--HG--
extra : moz-landing-system : lando
2020-01-24 21:59:35 +00:00
Brindusan Cristian
d5dee0c16b Backed out changeset 64c8ab5ec067 (bug 1611173) for linting failure at xpidl.py. CLOSED TREE 2020-01-24 23:54:00 +02:00
Andrew McCreight
ba3997abc8 Bug 1611173 - Remove support for non-nsISupports XPIDL interfaces. r=nika
It used to be that some XPIDL interfaces were allowed to be non-nsISupports,
and were only used to hold a bunch of constants. It appears that we've now
had enough de-COM work happen that there are no longer any, so we can remove
support for this.

Differential Revision: https://phabricator.services.mozilla.com/D61008

--HG--
extra : moz-landing-system : lando
2020-01-24 21:34:24 +00:00
Valentin Gosu
d16b0d8318 Bug 1552176 - Generate rust methods from cenum idl r=nika
This patch changes the xpidl parser to generate the rust trait code for
methods that take or return a cenum value.
Previously this would return an error, which means that adding a method
that uses cenums to an existing interface could cause rust code that
implements that interface to fail to build.

The generated methods take or return u8/u16/u32 depending on the width of the
enum. While this is not optimal (the parameter could contain values that are
not actually part of the enum), this is similar to what we do for nsLoadFlags.
In the future it would be nice to generate code that actually checks the
values are present in the enum, and to use a typedef instead of a plain
unsigned int.

Differential Revision: https://phabricator.services.mozilla.com/D51838

--HG--
extra : moz-landing-system : lando
2020-01-07 19:35:02 +00:00
Boris Zbarsky
d9695ff145 Bug 1600719. Add some sanity-checking for redundant can_run_script annotations on XPIDL attributes. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D55529

--HG--
extra : moz-landing-system : lando
2019-12-02 19:52:11 +00:00
Boris Zbarsky
083b367e51 Bug 1599963. Allow annotating xpidl getters and setters indepdendently in terms of whether they can run script. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D55065

--HG--
extra : moz-landing-system : lando
2019-12-02 18:50:15 +00:00
Sylvestre Ledru
d2eabf8906 Bug 1562642 - add missing license in xpcom/ r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D52579

--HG--
extra : moz-landing-system : lando
2019-11-11 21:44:32 +00:00
Bogdan Tara
80377e90ee Backed out 6 changesets (bug 1552176) for causing Hazard bustages CLOSED TREE
Backed out changeset c79b90bae420 (bug 1552176)
Backed out changeset 4b970cc771ca (bug 1552176)
Backed out changeset de7aa0eaf4c8 (bug 1552176)
Backed out changeset c8e692a40cd3 (bug 1552176)
Backed out changeset 68882d1eccac (bug 1552176)
Backed out changeset 692e5e51e19e (bug 1552176)
2019-11-11 12:11:36 +02:00
Valentin Gosu
0680f64f28 Bug 1552176 - Generate rust methods from cenum idl r=nika
This patch changes the xpidl parser to generate the rust trait code for
methods that take or return a cenum value.
Previously this would return an error, which means that adding a method
that uses cenums to an existing interface could cause rust code that
implements that interface to fail to build.

The generated methods take or return u8/u16/u32 depending on the width of the
enum. While this is not optimal (the parameter could contain values that are
not actually part of the enum), this is similar to what we do for nsLoadFlags.
In the future it would be nice to generate code that actually checks the
values are present in the enum, and to use a typedef instead of a plain
unsigned int.

Differential Revision: https://phabricator.services.mozilla.com/D51838

--HG--
extra : moz-landing-system : lando
2019-11-10 17:12:32 +00:00
Bogdan Tara
8f38f4a3fb Backed out 6 changesets (bug 1552176) for bustages complaining about ServiceWorkerManager.cpp CLOSED TREE
Backed out changeset bff9110e434e (bug 1552176)
Backed out changeset ac8f8a6dbd98 (bug 1552176)
Backed out changeset 8dd630e7534a (bug 1552176)
Backed out changeset 7ce9e220cdb9 (bug 1552176)
Backed out changeset ee9911acfcd4 (bug 1552176)
Backed out changeset 652b3bd6848d (bug 1552176)
2019-11-08 22:18:05 +02:00
Valentin Gosu
b5ca94720e Bug 1552176 - Generate rust methods from cenum idl r=nika
This patch changes the xpidl parser to generate the rust trait code for
methods that take or return a cenum value.
Previously this would return an error, which means that adding a method
that uses cenums to an existing interface could cause rust code that
implements that interface to fail to build.

The generated methods take or return u8/u16/u32 depending on the width of the
enum. While this is not optimal (the parameter could contain values that are
not actually part of the enum), this is similar to what we do for nsLoadFlags.
In the future it would be nice to generate code that actually checks the
values are present in the enum, and to use a typedef instead of a plain
unsigned int.

Differential Revision: https://phabricator.services.mozilla.com/D51838

--HG--
extra : moz-landing-system : lando
2019-11-08 17:13:59 +00:00
Andrew Halberstadt
2b0d90e3ad Bug 1587206 - [lint.flake8] Enable F632 across the tree, r=sylvestre
This ensures we use ==/!= to strings and ints (instead of is/is not).

Differential Revision: https://phabricator.services.mozilla.com/D48609

--HG--
extra : moz-landing-system : lando
2019-10-10 18:50:33 +00:00
Ricky Stewart
c010710916 Bug 1586358 - Replace existing instances of GENERATED_FILES with references to the GeneratedFile template r=firefox-build-system-reviewers,mshal
(Same content as bad revision https://phabricator.services.mozilla.com/D48230, but with a very small change to config/external/icu/data/moz.build to fix the build breakage.)

Try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=833f6a69fcac689488a640b43e8e0bdaa086a56c

Differential Revision: https://phabricator.services.mozilla.com/D48409

--HG--
extra : moz-landing-system : lando
2019-10-07 21:15:19 +00:00
Daniel Varga
052ef806b5 Backed out changeset 8d95f2c8867b (bug 1586358) for build bustage with FATAL ERROR PROCESSING MOZBUILD FILE. On a CLOSED TREE
--HG--
extra : rebase_source : 325fbad2455afc7f693087e75fa57dba79f4d86b
2019-10-07 20:22:08 +03:00
Ricky Stewart
940d91af38 Bug 1586358 - Replace existing instances of GENERATED_FILES with references to the GeneratedFile template r=nalexander
This patch doesn't remove all references to GENERATED_FILES, but does remove most of them, leaving only those which can't be trivially translated to the new template.

Try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=e4a25230c3992b9c5519ceb351fb37f6b2bf605e

Differential Revision: https://phabricator.services.mozilla.com/D48230

--HG--
extra : moz-landing-system : lando
2019-10-07 15:31:05 +00:00