WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Proposed fix
0001-Win-forwarding-headers-should-not-be-copies.patch (text/plain), 5.67 KB, created by
Mark Salisbury
on 2017-11-17 06:06:59 PST
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Mark Salisbury
Created:
2017-11-17 06:06:59 PST
Size:
5.67 KB
patch
obsolete
>From 649c9d808d48d0a3e3b7f461b06c1f718e405cfa Mon Sep 17 00:00:00 2001 >From: Mark Salisbury <mark.salisbury@hp.com> >Date: Fri, 17 Nov 2017 09:56:40 +0900 >Subject: [PATCH] [Win] forwarding headers should not be copies > >Forwarding headers created by JavaScriptCore are currently copies >of files, not files which have a #include path to the real header file. > >The problem with this approach is that if the same file ends up being >included twice, but at different paths, the #pragma once does nothing >and compile errors occur from multiply defined symbols. >--- > Source/JavaScriptCore/ChangeLog | 17 ++++++++++ > Source/JavaScriptCore/PlatformWin.cmake | 11 ++++--- > .../Scripts/make-forwarding-headers.pl | 36 ++++++++++++++++++++++ > 3 files changed, 59 insertions(+), 5 deletions(-) > create mode 100644 Source/JavaScriptCore/Scripts/make-forwarding-headers.pl > >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index e818ffeab1a..4ecf8351884 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,20 @@ >+2017-11-17 Mark Salisbury <mark.salisbury@hp.com> >+ >+ [Win] forwarding headers should not be copies >+ https://bugs.webkit.org/show_bug.cgi?id=179814 >+ >+ Reviewed by Konstantin Tokarev. >+ >+ Forwarding headers created by JavaScriptCore are currently copies >+ of files, not files which have a #include path to the real header file. >+ >+ The problem with this approach is that if the same file ends up being >+ included twice, but at different paths, the #pragma once does nothing >+ and compile errors occur from multiply defined symbols. >+ >+ * PlatformWin.cmake: >+ * Scripts/make-forwarding-headers.pl: Added. >+ > 2017-11-15 Ryan Haddad <ryanhaddad@apple.com> > > Unreviewed, rolling out r224863. >diff --git a/Source/JavaScriptCore/PlatformWin.cmake b/Source/JavaScriptCore/PlatformWin.cmake >index b348eaeafba..fd272e4909a 100644 >--- a/Source/JavaScriptCore/PlatformWin.cmake >+++ b/Source/JavaScriptCore/PlatformWin.cmake >@@ -34,15 +34,16 @@ file(COPY > ) > > file(MAKE_DIRECTORY ${FORWARDING_HEADERS_DIR}/JavaScriptCore) >- > set(JavaScriptCore_PRE_BUILD_COMMAND "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore/preBuild.cmd") > file(REMOVE "${JavaScriptCore_PRE_BUILD_COMMAND}") > foreach (_directory ${JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES}) >- file(APPEND "${JavaScriptCore_PRE_BUILD_COMMAND}" "@xcopy /y /d /f \"${JAVASCRIPTCORE_DIR}/${_directory}/*.h\" \"${FORWARDING_HEADERS_DIR}/JavaScriptCore\" >nul 2>nul\n") >+ file(APPEND "${JavaScriptCore_PRE_BUILD_COMMAND}" "perl ${JAVASCRIPTCORE_DIR}/Scripts/make-forwarding-headers.pl --search-path=\"${JAVASCRIPTCORE_DIR}/${_directory}/*.h\" --include-path=\"${JAVASCRIPTCORE_DIR}/${_directory}\" --forwarding-dir=\"${FORWARDING_HEADERS_DIR}/JavaScriptCore\"\n") >+ file(APPEND "${JavaScriptCore_PRE_BUILD_COMMAND}" "if %errorlevel% NEQ 0 exit /b 1\n") > endforeach () >- > set(JavaScriptCore_POST_BUILD_COMMAND "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore/postBuild.cmd") >-file(WRITE "${JavaScriptCore_POST_BUILD_COMMAND}" "@xcopy /y /d /f \"${DERIVED_SOURCES_DIR}/JavaScriptCore/*.h\" \"${FORWARDING_HEADERS_DIR}/JavaScriptCore\" >nul 2>nul\n") >-file(APPEND "${JavaScriptCore_POST_BUILD_COMMAND}" "@xcopy /y /d /f \"${DERIVED_SOURCES_DIR}/JavaScriptCore/inspector/*.h\" \"${FORWARDING_HEADERS_DIR}/JavaScriptCore\" >nul 2>nul\n") >+file(WRITE "${JavaScriptCore_POST_BUILD_COMMAND}" "perl ${JAVASCRIPTCORE_DIR}/Scripts/make-forwarding-headers.pl --search-path=\"${DERIVED_SOURCES_DIR}/JavaScriptCore/*.h\" --include-path=\"${DERIVED_SOURCES_DIR}/JavaScriptCore\" --forwarding-dir=\"${FORWARDING_HEADERS_DIR}/JavaScriptCore\"\n") >+file(APPEND "${JavaScriptCore_POST_BUILD_COMMAND}" "if %errorlevel% NEQ 0 exit /b 1\n") >+file(APPEND "${JavaScriptCore_POST_BUILD_COMMAND}" "perl ${JAVASCRIPTCORE_DIR}/Scripts/make-forwarding-headers.pl --search-path=\"${DERIVED_SOURCES_DIR}/JavaScriptCore/inspector/*.h\" --include-path=\"${DERIVED_SOURCES_DIR}/JavaScriptCore/inspector\" --forwarding-dir=\"${FORWARDING_HEADERS_DIR}/JavaScriptCore\"\n") >+file(APPEND "${JavaScriptCore_POST_BUILD_COMMAND}" "if %errorlevel% NEQ 0 exit /b 1\n") > > set(JavaScriptCore_OUTPUT_NAME JavaScriptCore${DEBUG_SUFFIX}) >diff --git a/Source/JavaScriptCore/Scripts/make-forwarding-headers.pl b/Source/JavaScriptCore/Scripts/make-forwarding-headers.pl >new file mode 100644 >index 00000000000..951ffb9b8da >--- /dev/null >+++ b/Source/JavaScriptCore/Scripts/make-forwarding-headers.pl >@@ -0,0 +1,36 @@ >+use strict; >+use warnings; >+ >+use File::Basename; >+use File::Spec; >+use Getopt::Long; >+ >+my $searchPath; >+my $includePath; >+my $forwardingDir; >+ >+my %options = ( >+ 'search-path=s' => \$searchPath, >+ 'include-path=s' => \$includePath, >+ 'forwarding-dir=s' => \$forwardingDir, >+); >+GetOptions (%options); >+ >+my @headers = glob($searchPath); >+foreach my $header (@headers) { >+ my $file = basename($header); >+ my $forwardingHeader = File::Spec->join($forwardingDir, $file); >+ my $fileContent = "#include \"$includePath/$file\""; >+ if (-e $forwardingHeader) { >+ open (my $fh, '<', $forwardingHeader) or die("Unable to open $forwardingHeader ($!)"); >+ my $existingContent = <$fh>; >+ close($fh); >+ $fileContent eq $existingContent or die("$forwardingHeader already exists and has content:\n $existingContent\nexpected:\n $fileContent\n"); >+ } >+ else { >+ open(my $fh, '>', $forwardingHeader); >+ print "Creating forwarding header $forwardingHeader with #include \"$includePath/$file\"\n"; >+ print $fh $fileContent; >+ close($fh) or die("Failed to close $forwardingHeader ($!)"); >+ } >+} >-- >2.14.1.windows.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 179814
:
327155
|
327160
|
327163
| 327166