Bug 1618760 - Remove MSVC-specific include hacks in header wrappers. r=dmajor

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2020-02-28 21:41:18 +00:00
Родитель dd8403bd86
Коммит f9285c1941
6 изменённых файлов: 8 добавлений и 64 удалений

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

@ -6,7 +6,6 @@ from __future__ import print_function
import os
import string
from mozbuild.util import FileAvoidWrite
from system_header_util import header_path
# The 'unused' arg is the output file from the file_generate action. We actually
@ -17,7 +16,5 @@ def gen_wrappers(unused, outdir, compiler, template_file, *header_list):
template = open(template_file, 'r').read()
for header in header_list:
path = header_path(header, compiler)
with FileAvoidWrite(os.path.join(outdir, header)) as f:
f.write(string.Template(template).substitute(HEADER=header,
HEADER_PATH=path))
f.write(string.Template(template).substitute(HEADER=header))

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

@ -6,7 +6,6 @@ from __future__ import absolute_import
import re
import textwrap
import string
from system_header_util import header_path
comment_re = re.compile(r'//[^\n]*\n|/\*.*\*/', re.S)
decl_re = re.compile(r'''^(.+)\s+ # type
@ -81,7 +80,5 @@ def generate(fd, consts_path, unicodes_path, template_path, compiler):
#endif
""".format(ty=ty, name=name, params=params, args=args))
path = header_path('windows.h', compiler)
# Write out the resulting file
fd.write(template.substitute(header_path=path, decls=decls))
fd.write(template.substitute(decls=decls))

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

@ -51,20 +51,7 @@
//# undef _SECURE_SCL
#endif
// C4275: When _HAS_EXCEPTIONS is set to 0, system STL header
// will generate the warning which we can't modify.
// C4530: We know that code won't be able to catch exceptions,
// but that's OK because we're not throwing them.
#pragma warning( push )
#pragma warning( disable : 4275 4530 )
#ifdef __clang__
#include_next <${HEADER}>
#else
#include <${HEADER_PATH}>
#endif
#pragma warning( pop )
#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
// See if we're in code that can use mozalloc.

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

@ -1,21 +0,0 @@
from __future__ import absolute_import
import os
def find_in_path(file, searchpath):
for dir in searchpath.split(os.pathsep):
f = os.path.join(dir, file)
if os.path.exists(f):
return f
return ''
def header_path(header, compiler):
if compiler == 'gcc':
# we use include_next on gcc
return header
elif compiler == 'msvc':
return find_in_path(header, os.environ.get('INCLUDE', ''))
else:
# hope someone notices this ...
raise NotImplementedError(compiler)

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

@ -7,23 +7,15 @@
#ifndef mozilla_windows_h
#define mozilla_windows_h
// Include the "real" windows.h header. On clang/gcc, this can be done with the
// `include_next` feature, however MSVC requires a direct include path.
// Include the "real" windows.h header.
//
// Also turn off deprecation warnings, as we may be wrapping deprecated fns.
#if defined(__GNUC__) || defined(__clang__)
# pragma GCC system_header
# include_next <windows.h>
#pragma GCC system_header
#include_next <windows.h>
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#else
# include <${header_path}>
# pragma warning(push)
# pragma warning(disable: 4996 4995)
#endif // defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Check if the header should be disabled
#if defined(MOZ_DISABLE_WINDOWS_WRAPPER)
@ -32,9 +24,6 @@
#elif !defined(__cplusplus)
#define MOZ_WINDOWS_WRAPPER_DISABLED_REASON "non-C++ source file"
#elif !defined(__GNUC__) && !defined(__clang__) && !defined(_DLL)
#define MOZ_WINDOWS_WRAPPER_DISABLED_REASON "non-dynamic RTL"
#else
// We're allowed to wrap in the current context. Define `MOZ_WRAPPED_WINDOWS_H`
// to note that fact, and perform the wrapping.
@ -49,10 +38,6 @@ ${decls}
#endif // enabled
#if defined(__GNUC__) || defined(__clang__)
# pragma GCC diagnostic pop
#else
# pragma warning(pop)
#endif // defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif // !defined(mozilla_windows_h)

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

@ -26,7 +26,6 @@ license:
- config/external/ffi/subst_header.py
- config/external/nspr/_pl_bld.h
- config/external/nspr/_pr_bld.h
- config/system_header_util.py
- dom/docs/Fission-IPC-Diagram.svg
# Unknown origin
- gfx/2d/MMIHelpers.h