Commit bce0d0ab authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

[jumbo] Give two internal ui/gl functions unique names

MakeFunctionUnique and MockInvalidFunction are functions
that are generated twice by ui/gl/generate_bindings.py. With that
double generation the code can't be jumbo compiled because of
the resulting symbol clash when the code ends up in
a single translation unit.

This patch gives the functions unique names by adding the "set_name"
(gl, egl) to their names.

Bug: 864986
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Ia08d42a86b99bddc808d1ac7c921f6801eb07782
Reviewed-on: https://chromium-review.googlesource.com/1148453Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#577800}
parent 3e7ad811
This diff is collapsed.
......@@ -3419,13 +3419,13 @@ namespace {
// This is called mainly to prevent the compiler combining the code of mock
// functions with identical contents, so that their function pointers will be
// different.
void MakeFunctionUnique(const char *func_name) {
void Make%sMockFunctionUnique(const char *func_name) {
VLOG(2) << "Calling mock " << func_name;
}
} // namespace
namespace gl {
""" % (set_name,))
""" % (set_name, set_name.capitalize()))
# Write functions that trampoline into the set MockGLInterface instance.
uniquely_named_functions = GetUniquelyNamedFunctions(functions)
......@@ -3437,7 +3437,8 @@ namespace gl {
file.write('%s GL_BINDING_CALL Mock%sInterface::Mock_%s(%s) {\n' %
(func['return_type'], set_name.upper(), func['name'],
func['arguments']))
file.write(' MakeFunctionUnique("%s");\n' % func['name'])
file.write(' Make%sMockFunctionUnique("%s");\n' % (set_name.capitalize(),
func['name']))
arg_re = r'(const |struct )*[a-zA-Z0-9]+((\s*const\s*)?\*)* ([a-zA-Z0-9]+)'
argument_names = re.sub(arg_re, r'\4', func['arguments'])
if argument_names == 'void':
......@@ -3455,7 +3456,7 @@ namespace gl {
# function pointers or trying to interpret the return value of
# GLProcAddress().
file.write('\n')
file.write('static void MockInvalidFunction() {\n')
file.write('static void Mock%sInvalidFunction() {\n' % set_name.capitalize())
file.write(' NOTREACHED();\n')
file.write('}\n')
......@@ -3472,7 +3473,7 @@ namespace gl {
name)
# Always return a non-NULL pointer like some EGL implementations do.
file.write(' return reinterpret_cast<GLFunctionPointerType>('
'&MockInvalidFunction);\n')
'&Mock%sInvalidFunction);\n' % set_name.capitalize())
file.write('}\n')
file.write('\n')
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment