"compress" and other zlib keywords are effectively reserved keywords

NEW
Unassigned

Status

()

Core
General
4 years ago
4 months ago

People

(Reporter: glandium, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
In at least cairo and zlib, we namespace the function names so that they don't clash with the same symbols in system libraries. In cairo, it's not a problem, because everything starts with cairo_, but for zlib, this means we have e.g. #define compress MOZ_Z_compress to avoid rewriting all third-party imported code that use those symbols (which include, e.g. ots, skia, libpng, etc.).

In turn, this makes us randomly break code that uses the "compress" keyword. See http://mxr.mozilla.org/mozilla-central/source/ipc/glue/MessageChannel.cpp#17 for instance.

Luke encountered the problem in bug 960367, where he started using LZ4::compress, which gets rewritten as LZ4::MOZ_Z_compress in the js engine because jsutil.h includes zlib.h, but not in mfbt itself, because zlib.h is not included there.

So essentially, "compress", "uncompress", and other zlib symbols are effectively reserved keywords.

We should do something about it, whatever this ends up being.
(Reporter)

Comment 1

4 years ago
Benjamin, maybe you have something to suggest?
You need to log in before you can comment on or make changes to this bug.