Bug 1487449 - stop macro redefinition warning spam for Windows macros; r=ted.mielczarek

This warning spam happens particularly with WebRTC, but I can see it
happening for any third-party software whose use of WINVER and friends
conflicts with our own.  Let's just change mozilla-config.h to avoid
defining these macros if they're already defined via the command line.
This commit is contained in:
Nathan Froyd 2018-08-30 16:09:23 -04:00
Родитель c85c47cc05
Коммит 992139e95b
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -51,8 +51,18 @@ def process_define_file(output, input):
raise Exception(
'`#define ALLDEFINES` is not allowed in a '
'CONFIGURE_DEFINE_FILE')
# WebRTC files like to define WINVER and _WIN32_WINNT
# via the command line, which raises a mass of macro
# redefinition warnings. Just handle those macros
# specially here.
def define_for_name(name, val):
define = "#define {name} {val}".format(name=name, val=val)
if name in ('WINVER', '_WIN32_WINNT'):
return '#if !defined({name})\n{define}\n#endif' \
.format(name=name, define=define)
return define
defines = '\n'.join(sorted(
'#define %s %s' % (name, val)
define_for_name(name, val)
for name, val in config.defines['ALLDEFINES'].iteritems()))
l = l[:m.start('cmd') - 1] \
+ defines + l[m.end('name'):]