зеркало из https://github.com/mozilla/gecko-dev.git
Bug 792059 - Add NeedsWindowsUndef extended attribute for constants; r=bz
When defining WebIDL constants in C++, we may need to undefine some constant names that conflict with windows.h preprocessor defines. Doing this in the binding header is far easier than tracking down the include orders that may cause conflicts. MozReview-Commit-ID: A0UoYezIQs5 --HG-- extra : rebase_source : d9100af2ccdb5c6e6468542ac68f74b2e4f9050c
This commit is contained in:
Родитель
b0922aec43
Коммит
df8270946f
|
@ -2855,6 +2855,16 @@ class CGConstDefinition(CGThing):
|
||||||
self.const = "static const %s %s = %s;" % (builtinNames[tag],
|
self.const = "static const %s %s = %s;" % (builtinNames[tag],
|
||||||
name,
|
name,
|
||||||
value)
|
value)
|
||||||
|
if member.getExtendedAttribute("NeedsWindowsUndef"):
|
||||||
|
self.const = fill(
|
||||||
|
"""
|
||||||
|
#ifdef XP_WIN
|
||||||
|
#undef ${name}
|
||||||
|
#endif // XP_WIN
|
||||||
|
${constDecl}
|
||||||
|
""",
|
||||||
|
name=name,
|
||||||
|
constDecl=self.const)
|
||||||
|
|
||||||
def declare(self):
|
def declare(self):
|
||||||
return self.const
|
return self.const
|
||||||
|
|
|
@ -3976,7 +3976,8 @@ class IDLConst(IDLInterfaceMember):
|
||||||
identifier == "ChromeOnly" or
|
identifier == "ChromeOnly" or
|
||||||
identifier == "Func" or
|
identifier == "Func" or
|
||||||
identifier == "SecureContext" or
|
identifier == "SecureContext" or
|
||||||
identifier == "NonEnumerable"):
|
identifier == "NonEnumerable" or
|
||||||
|
identifier == "NeedsWindowsUndef"):
|
||||||
# Known attributes that we don't need to do anything with here
|
# Known attributes that we don't need to do anything with here
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -27,6 +27,11 @@ class Promise;
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
// We don't export TestCodeGenBinding.h, but it's right in our parent dir.
|
// We don't export TestCodeGenBinding.h, but it's right in our parent dir.
|
||||||
|
#ifdef XP_WIN
|
||||||
|
// If we're on windows, simulate including windows.h. This step will cause
|
||||||
|
// compilation failure if NeedsWindowsUndef is not defined.
|
||||||
|
#define NO_ERROR 0x1
|
||||||
|
#endif
|
||||||
#include "../TestCodeGenBinding.h"
|
#include "../TestCodeGenBinding.h"
|
||||||
|
|
||||||
extern bool TestFuncControlledMember(JSContext*, JSObject*);
|
extern bool TestFuncControlledMember(JSContext*, JSObject*);
|
||||||
|
|
|
@ -983,6 +983,10 @@ interface TestInterface {
|
||||||
[NonEnumerable]
|
[NonEnumerable]
|
||||||
void nonEnumerableMethod();
|
void nonEnumerableMethod();
|
||||||
|
|
||||||
|
// [NeedsWindowsUndef] test generation
|
||||||
|
[NeedsWindowsUndef]
|
||||||
|
const unsigned long NO_ERROR = 0xffffffff;
|
||||||
|
|
||||||
// If you add things here, add them to TestExampleGen and TestJSImplGen as well
|
// If you add things here, add them to TestExampleGen and TestJSImplGen as well
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -810,6 +810,10 @@ interface TestExampleInterface {
|
||||||
[NonEnumerable]
|
[NonEnumerable]
|
||||||
void nonEnumerableMethod();
|
void nonEnumerableMethod();
|
||||||
|
|
||||||
|
// [NeedsWindowsUndef] test generation
|
||||||
|
[NeedsWindowsUndef]
|
||||||
|
const unsigned long NO_ERROR = 0xffffffff;
|
||||||
|
|
||||||
// If you add things here, add them to TestCodeGen and TestJSImplGen as well
|
// If you add things here, add them to TestCodeGen and TestJSImplGen as well
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -830,6 +830,10 @@ interface TestJSImplInterface {
|
||||||
[NonEnumerable]
|
[NonEnumerable]
|
||||||
void nonEnumerableMethod();
|
void nonEnumerableMethod();
|
||||||
|
|
||||||
|
// [NeedsWindowsUndef] test generation
|
||||||
|
[NeedsWindowsUndef]
|
||||||
|
const unsigned long NO_ERROR = 0xffffffff;
|
||||||
|
|
||||||
// If you add things here, add them to TestCodeGen as well
|
// If you add things here, add them to TestCodeGen as well
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -280,6 +280,7 @@ interface WebGL2RenderingContextBase
|
||||||
const GLenum ALREADY_SIGNALED = 0x911A;
|
const GLenum ALREADY_SIGNALED = 0x911A;
|
||||||
const GLenum TIMEOUT_EXPIRED = 0x911B;
|
const GLenum TIMEOUT_EXPIRED = 0x911B;
|
||||||
const GLenum CONDITION_SATISFIED = 0x911C;
|
const GLenum CONDITION_SATISFIED = 0x911C;
|
||||||
|
[NeedsWindowsUndef]
|
||||||
const GLenum WAIT_FAILED = 0x911D;
|
const GLenum WAIT_FAILED = 0x911D;
|
||||||
const GLenum SYNC_FLUSH_COMMANDS_BIT = 0x00000001;
|
const GLenum SYNC_FLUSH_COMMANDS_BIT = 0x00000001;
|
||||||
const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE;
|
const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE;
|
||||||
|
|
|
@ -217,6 +217,7 @@ interface WebGLRenderingContextBase {
|
||||||
const GLenum SAMPLE_COVERAGE = 0x80A0;
|
const GLenum SAMPLE_COVERAGE = 0x80A0;
|
||||||
|
|
||||||
/* ErrorCode */
|
/* ErrorCode */
|
||||||
|
[NeedsWindowsUndef]
|
||||||
const GLenum NO_ERROR = 0;
|
const GLenum NO_ERROR = 0;
|
||||||
const GLenum INVALID_ENUM = 0x0500;
|
const GLenum INVALID_ENUM = 0x0500;
|
||||||
const GLenum INVALID_VALUE = 0x0501;
|
const GLenum INVALID_VALUE = 0x0501;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче