Title: [149932] trunk/Source/WebCore
Revision
149932
Author
[email protected]
Date
2013-05-11 09:09:43 -0700 (Sat, 11 May 2013)

Log Message

Make it a build error to put invalid C++ symbol names in WebCore.exp.in
https://bugs.webkit.org/show_bug.cgi?id=115958

Reviewed by Andreas Kling.

While invalid C++ symbols will eventually show up as a link error since the symbol won't be found,
this makes it easier to catch invalid symbols inside of #ifdefs.

* make-export-file-generator:
Try to demangle C++ symbols before printing them.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149931 => 149932)


--- trunk/Source/WebCore/ChangeLog	2013-05-11 14:09:05 UTC (rev 149931)
+++ trunk/Source/WebCore/ChangeLog	2013-05-11 16:09:43 UTC (rev 149932)
@@ -1,3 +1,16 @@
+2013-05-11  Anders Carlsson  <[email protected]>
+
+        Make it a build error to put invalid C++ symbol names in WebCore.exp.in
+        https://bugs.webkit.org/show_bug.cgi?id=115958
+
+        Reviewed by Andreas Kling.
+
+        While invalid C++ symbols will eventually show up as a link error since the symbol won't be found,
+        this makes it easier to catch invalid symbols inside of #ifdefs.
+
+        * make-export-file-generator:
+        Try to demangle C++ symbols before printing them.
+
 2013-05-11  David Kilzer  <[email protected]>
 
         BUILD FIX (r149718): Move exported symbol into ENABLE(FULLSCREEN_API) section

Modified: trunk/Source/WebCore/make-export-file-generator (149931 => 149932)


--- trunk/Source/WebCore/make-export-file-generator	2013-05-11 14:09:05 UTC (rev 149931)
+++ trunk/Source/WebCore/make-export-file-generator	2013-05-11 16:09:43 UTC (rev 149932)
@@ -30,14 +30,30 @@
 
 def line_for_output line
   return line.chomp if line =~ /#/
-  "    printf(\"#{line.chomp}\\n\");"
+  "    validateAndPrint(\"#{line.chomp}\");"
 end
 
 TEMPLATE = <<-EOF
 #include "config.h"
 #include <stdio.h>
 #include <wtf/Assertions.h>
+#include <cxxabi.h>
 
+static void validateAndPrint(const char* symbol)
+{
+    if (!strncmp(symbol, "__Z", strlen("__Z"))) {
+      char* demangledName = abi::__cxa_demangle(symbol + 1, nullptr, nullptr, nullptr);
+      if (!demangledName) {
+        fprintf(stderr, "ERROR: \\"%s\\" is not a valid C++ mangled name.\\n", symbol);
+        exit(EXIT_FAILURE);
+      }
+      
+      free(demangledName);
+    }
+
+    printf("%s\\n", symbol);
+}
+
 int main(int, char**)
 {
 <%- input.each_line do |line| -%>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to