Guest User

Untitled

a guest
Jun 3rd, 2018
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.82 KB | None | 0 0
  1. diff --git a/ChangeLog b/ChangeLog
  2. index 700e224..44e02e8 100644
  3. --- a/ChangeLog
  4. +++ b/ChangeLog
  5. @@ -1,3 +1,23 @@
  6. +2010-08-06 Andras Becsi <abecsi@webkit.org>
  7. +
  8. + Reviewed by NOBODY (OOPS!).
  9. +
  10. + Undefined reference errors when linking due to gperf and inlining.
  11. + webkit.org/b/29244
  12. +
  13. + EFL CMake changes by Leandro Pereira <leandro@profusion.mobi>
  14. +
  15. + Refactor gperf code generation and usage to fix the debug build with gcc>4.4.
  16. + Hitherto gperf generated C code, these files were included in multiple C++ files across WebCore
  17. + to access the functionality provided. This resulted in debug build failure with newer gcc versions
  18. + because of a behaviour change of gcc, which disables C style inlining in debug mode.
  19. + The make-hash-tools.pl script lets gperf generate C++ code for all gperf files now, which are compiled
  20. + in their own compilation unit.
  21. + The functionality provided by the generated code is wrapped behind HashTools.h, so there is no need
  22. + for multiple inclusions of generated C files to access these functions.
  23. +
  24. + * cmake/WebKitGenerators.cmake:
  25. +
  26. 2010-08-05 Jian Li <jianli@chromium.org>
  27.  
  28. Reviewed by David Levin.
  29. diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
  30. index 1a93b0b..93aa08b 100644
  31. --- a/WebCore/CMakeLists.txt
  32. +++ b/WebCore/CMakeLists.txt
  33. @@ -531,6 +531,10 @@ SET(WebCore_SOURCES
  34. ${DERIVED_SOURCES_DIR}/CSSGrammar.cpp
  35. ${DERIVED_SOURCES_DIR}/HTMLElementFactory.cpp
  36. ${DERIVED_SOURCES_DIR}/HTMLEntityNames.cpp
  37. + ${DERIVED_SOURCES_DIR}/DocTypeStrings.cpp
  38. + ${DERIVED_SOURCES_DIR}/CSSValueKeywords.cpp
  39. + ${DERIVED_SOURCES_DIR}/CSSPropertyNames.cpp
  40. + ${DERIVED_SOURCES_DIR}/ColorData.cpp
  41. ${DERIVED_SOURCES_DIR}/HTMLNames.cpp
  42. ${DERIVED_SOURCES_DIR}/JSHTMLElementWrapperFactory.cpp
  43. ${DERIVED_SOURCES_DIR}/MathMLElementFactory.cpp
  44. @@ -1813,9 +1817,11 @@ GENERATE_INSPECTOR_FROM_IDL(inspector/Inspector.idl)
  45.  
  46. LIST(APPEND WebCore_SOURCES ${JS_IDL_FILES} ${Inspector_IDL_FILES})
  47.  
  48. -GENERATE_GPERF(${WEBCORE_DIR}/html/HTMLEntityNames.gperf)
  49. -GENERATE_GPERF(${WEBCORE_DIR}/platform/ColorData.gperf)
  50. -GENERATE_GPERF(${WEBCORE_DIR}/html/DocTypeStrings.gperf)
  51. +MAKE_HASH_TOOLS(${WEBCORE_DIR}/html/HTMLEntityNames)
  52. +MAKE_HASH_TOOLS(${WEBCORE_DIR}/html/DocTypeStrings)
  53. +MAKE_HASH_TOOLS(${DERIVED_SOURCES_DIR}/CSSValueKeywords)
  54. +MAKE_HASH_TOOLS(${DERIVED_SOURCES_DIR}/CSSPropertyNames)
  55. +MAKE_HASH_TOOLS(${WEBCORE_DIR}/platform/ColorData)
  56.  
  57. GENERATE_TOKENIZER()
  58. GENERATE_USER_AGENT_STYLES()
  59. @@ -1826,6 +1832,7 @@ GENERATE_GRAMMAR(xpathyy ${WEBCORE_DIR}/xml/XPathGrammar.y)
  60. GENERATE_CSS_PROPERTY_NAMES()
  61. GENERATE_CSS_VALUE_KEYWORDS()
  62.  
  63. +ADD_SOURCE_DERIVED_DEPENDENCIES(${DERIVED_SOURCES_DIR}/HashTools.h HTMLEntityNames.cpp DocTypeStrings.cpp CSSValueKeywords.cpp CSSPropertyNames.cpp ColorData.cpp)
  64. ADD_SOURCE_DERIVED_DEPENDENCIES(${DERIVED_SOURCES_DIR}/CSSGrammar.cpp CSSValueKeywords.h)
  65. ADD_SOURCE_DERIVED_DEPENDENCIES(${DERIVED_SOURCES_DIR}/CSSGrammar.cpp CSSPropertyNames.h)
  66. ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/css/CSSPrimitiveValueMappings.h CSSValueKeywords.h)
  67. diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
  68. index 07ae173..7dcda74 100644
  69. --- a/WebCore/ChangeLog
  70. +++ b/WebCore/ChangeLog
  71. @@ -1,3 +1,40 @@
  72. +2010-08-06 Andras Becsi <abecsi@webkit.org>
  73. +
  74. + Reviewed by NOBODY (OOPS!).
  75. +
  76. + Undefined reference errors when linking due to gperf and inlining.
  77. + webkit.org/b/29244
  78. +
  79. + EFL CMake changes by Leandro Pereira <leandro@profusion.mobi>
  80. +
  81. + Refactor gperf code generation and usage to fix the debug build with gcc>4.4.
  82. + Hitherto gperf generated C code, these files were included in multiple C++ files across WebCore
  83. + to access the functionality provided. This resulted in debug build failure with newer gcc versions
  84. + because of a behaviour change of gcc, which disables C style inlining in debug mode.
  85. + The make-hash-tools.pl script lets gperf generate C++ code for all gperf files now, which are compiled
  86. + in their own compilation unit.
  87. + The functionality provided by the generated code is wrapped behind HashTools.h, so there is no need
  88. + for multiple inclusions of generated C files to access these functions.
  89. +
  90. + No new tests needed.
  91. +
  92. + * CMakeLists.txt:
  93. + * WebCore.gyp/WebCore.gyp:
  94. + * WebCore.pri:
  95. + * WebCore.xcodeproj/project.pbxproj:
  96. + * css/CSSParser.cpp:
  97. + * css/makeprop.pl:
  98. + * css/makevalues.pl:
  99. + * html/DocTypeStrings.gperf:
  100. + * html/HTMLDocument.cpp:
  101. + * html/HTMLEntityNames.gperf:
  102. + * html/HTMLEntityParser.cpp:
  103. + * html/LegacyHTMLDocumentParser.cpp:
  104. + * html/LegacyPreloadScanner.cpp:
  105. + * make-hash-tools.pl:
  106. + * platform/ColorData.gperf:
  107. + * platform/graphics/Color.cpp:
  108. +
  109. 2010-08-06 Yury Semikhatsky <yurys@chromium.org>
  110.  
  111. Reviewed by Pavel Feldman.
  112. diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp
  113. index a28ee5d..55dbb21 100644
  114. --- a/WebCore/WebCore.gyp/WebCore.gyp
  115. +++ b/WebCore/WebCore.gyp/WebCore.gyp
  116. @@ -607,7 +607,6 @@
  117. '<(SHARED_INTERMEDIATE_DIR)/webkit',
  118. '<(RULE_INPUT_PATH)',
  119. ],
  120. - 'process_outputs_as_sources': 0,
  121. },
  122. # Rule to build generated JavaScript (V8) bindings from .idl source.
  123. {
  124. @@ -702,6 +701,13 @@
  125. # in webcore_files.
  126. '<@(derived_sources_aggregate_files)',
  127.  
  128. + # Additional .cpp files for HashTools.h
  129. + '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLEntityNames.cpp',
  130. + '<(SHARED_INTERMEDIATE_DIR)/webkit/DocTypeStrings.cpp',
  131. + '<(SHARED_INTERMEDIATE_DIR)/webkit/ColorData.cpp',
  132. + '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSPropertyNames.cpp',
  133. + '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSValueKeywords.cpp',
  134. +
  135. # Additional .cpp files from webcore_bindings_sources actions.
  136. '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLElementFactory.cpp',
  137. '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLNames.cpp',
  138. diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri
  139. index 7dd0681..163aa6a 100644
  140. --- a/WebCore/WebCore.pri
  141. +++ b/WebCore/WebCore.pri
  142. @@ -707,7 +707,7 @@ cssprops.wkScript = $$PWD/css/makeprop.pl
  143. cssprops.output = $${WC_GENERATED_SOURCES_DIR}/CSSPropertyNames.cpp
  144. cssprops.input = WALDOCSSPROPS
  145. cssprops.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $${DASHBOARDSUPPORTCSSPROPERTIES} $${EXTRACSSPROPERTIES} > $${WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.in && cd $$WC_GENERATED_SOURCES_DIR && perl $$cssprops.wkScript && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf
  146. -cssprops.depends = ${QMAKE_FILE_NAME} $${DASHBOARDSUPPORTCSSPROPERTIES} $${EXTRACSSPROPERTIES}
  147. +cssprops.depends = ${QMAKE_FILE_NAME} $${DASHBOARDSUPPORTCSSPROPERTIES} $${EXTRACSSPROPERTIES} $$cssprops.wkScript
  148. addExtraCompiler(cssprops)
  149.  
  150. # GENERATOR 6-B:
  151. @@ -715,7 +715,7 @@ cssvalues.wkScript = $$PWD/css/makevalues.pl
  152. cssvalues.output = $${WC_GENERATED_SOURCES_DIR}/CSSValueKeywords.cpp
  153. cssvalues.input = WALDOCSSVALUES
  154. cssvalues.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$EXTRACSSVALUES > $${WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.in && cd $$WC_GENERATED_SOURCES_DIR && perl $$cssvalues.wkScript && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf
  155. -cssvalues.depends = ${QMAKE_FILE_NAME} $${EXTRACSSVALUES}
  156. +cssvalues.depends = ${QMAKE_FILE_NAME} $${EXTRACSSVALUES} $$cssvalues.wkScript
  157. cssvalues.clean = ${QMAKE_FILE_OUT} ${QMAKE_VAR_WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.h
  158. addExtraCompiler(cssvalues)
  159.  
  160. diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
  161. index 18a8d92..397fcda 100644
  162. --- a/WebCore/WebCore.vcproj/WebCore.vcproj
  163. +++ b/WebCore/WebCore.vcproj/WebCore.vcproj
  164. @@ -545,6 +545,26 @@
  165. >
  166. </File>
  167. <File
  168. + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\HashTools.h"
  169. + >
  170. + </File>
  171. + <File
  172. + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\DocTypeStrings.cpp"
  173. + >
  174. + </File>
  175. + <File
  176. + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\CSSValueKeywords.cpp"
  177. + >
  178. + </File>
  179. + <File
  180. + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\CSSPropertyNames.cpp"
  181. + >
  182. + </File>
  183. + <File
  184. + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\ColorData.cpp"
  185. + >
  186. + </File>
  187. + <File
  188. RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\InspectorBackendDispatcher.cpp"
  189. >
  190. </File>
  191. diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
  192. index fa2c51f..20f819c 100644
  193. --- a/WebCore/WebCore.xcodeproj/project.pbxproj
  194. +++ b/WebCore/WebCore.xcodeproj/project.pbxproj
  195. @@ -486,6 +486,11 @@
  196. 1AB7FC860A8B92EC00D9D37B /* XPathValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7FC650A8B92EC00D9D37B /* XPathValue.h */; };
  197. 1AB7FC870A8B92EC00D9D37B /* XPathVariableReference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7FC660A8B92EC00D9D37B /* XPathVariableReference.cpp */; };
  198. 1AB7FC880A8B92EC00D9D37B /* XPathVariableReference.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7FC670A8B92EC00D9D37B /* XPathVariableReference.h */; };
  199. + 1ABA76C911D20E47004C201C /* ColorData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E406F3FB1198307D009D59D6 /* ColorData.cpp */; };
  200. + 1ABA76CA11D20E50004C201C /* CSSPropertyNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41EA038119836DB00710BC5 /* CSSPropertyNames.cpp */; };
  201. + 1ABA76CB11D20E57004C201C /* CSSValueKeywords.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */; };
  202. + 1ABA76CC11D20E5B004C201C /* DocTypeStrings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E406F3FA1198304D009D59D6 /* DocTypeStrings.cpp */; };
  203. + 1ABA77FD11D21031004C201C /* HTMLEntityNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E406F4021198329A009D59D6 /* HTMLEntityNames.cpp */; };
  204. 1ABFE7530CD968D000FE4834 /* SQLTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ABFE7520CD968D000FE4834 /* SQLTransaction.cpp */; };
  205. 1AC2260C0DB69F190089B669 /* JSDOMApplicationCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC2260A0DB69F190089B669 /* JSDOMApplicationCache.cpp */; };
  206. 1AC2260D0DB69F190089B669 /* JSDOMApplicationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC2260B0DB69F190089B669 /* JSDOMApplicationCache.h */; };
  207. @@ -20371,6 +20376,11 @@
  208. isa = PBXSourcesBuildPhase;
  209. buildActionMask = 2147483647;
  210. files = (
  211. + 1ABA76C911D20E47004C201C /* ColorData.cpp in Sources */,
  212. + 1ABA76CA11D20E50004C201C /* CSSPropertyNames.cpp in Sources */,
  213. + 1ABA76CB11D20E57004C201C /* CSSValueKeywords.cpp in Sources */,
  214. + 1ABA76CC11D20E5B004C201C /* DocTypeStrings.cpp in Sources */,
  215. + 1ABA77FD11D21031004C201C /* HTMLEntityNames.cpp in Sources */,
  216. B5B5DC69119BB3D5002A8790 /* AbstractDatabase.cpp in Sources */,
  217. 41E1B1D00FF5986900576B3B /* AbstractWorker.cpp in Sources */,
  218. 29A812280FBB9C1D00510293 /* AccessibilityARIAGrid.cpp in Sources */,
  219. diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
  220. index aa6cdd9..c8f1173 100644
  221. --- a/WebCore/css/CSSParser.cpp
  222. +++ b/WebCore/css/CSSParser.cpp
  223. @@ -61,6 +61,7 @@
  224. #include "FloatConversion.h"
  225. #include "FontFamilyValue.h"
  226. #include "FontValue.h"
  227. +#include "HashTools.h"
  228. #include "MediaList.h"
  229. #include "MediaQueryExp.h"
  230. #include "Pair.h"
  231. @@ -88,9 +89,6 @@ extern int cssyyparse(void* parser);
  232. using namespace std;
  233. using namespace WTF;
  234.  
  235. -#include "CSSPropertyNames.cpp"
  236. -#include "CSSValueKeywords.cpp"
  237. -
  238. namespace WebCore {
  239.  
  240. static const unsigned INVALID_NUM_PARSED_PROPERTIES = UINT_MAX;
  241. diff --git a/WebCore/css/makeprop.pl b/WebCore/css/makeprop.pl
  242. index 0fd1f08..0dd8444 100644
  243. --- a/WebCore/css/makeprop.pl
  244. +++ b/WebCore/css/makeprop.pl
  245. @@ -41,15 +41,14 @@ print GPERF << "EOF";
  246. #include \"CSSPropertyNames.h\"
  247. %}
  248. %struct-type
  249. -struct Property {
  250. - const char* name;
  251. - int id;
  252. -};
  253. -%language=ANSI-C
  254. +struct Property;
  255. +%omit-struct-type
  256. +%language=C++
  257. %readonly-tables
  258. %global-table
  259. %compare-strncmp
  260. -%define lookup-function-name findProperty
  261. +%define class-name CSSPropertyNamesHash
  262. +%define lookup-function-name findPropertyImpl
  263. %define hash-function-name propery_hash_function
  264. %define word-array-name property_wordlist
  265. %includes
  266. @@ -72,6 +71,10 @@ print HEADER << "EOF";
  267. #ifndef CSSPropertyNames_h
  268. #define CSSPropertyNames_h
  269.  
  270. +#include <string.h>
  271. +
  272. +namespace WebCore {
  273. +
  274. enum CSSPropertyID {
  275. CSSPropertyInvalid = 0,
  276. EOF
  277. @@ -99,15 +102,17 @@ print HEADER << "EOF";
  278.  
  279. const char* getPropertyName(CSSPropertyID);
  280.  
  281. +} // namespace WebCore
  282. +
  283. #endif // CSSPropertyNames_h
  284.  
  285. EOF
  286.  
  287. close HEADER;
  288.  
  289. -system("gperf --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf > CSSPropertyNames.cpp") == 0 || die "calling gperf failed: $?";
  290. +system("gperf --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf > CSSPropertyNamesHash.h") == 0 || die "calling gperf failed: $?";
  291.  
  292. -open C, ">>CSSPropertyNames.cpp" || die "Could not open CSSPropertyNames.cpp for writing";
  293. +open C, ">>CSSPropertyNamesHash.h" || die "Could not open CSSPropertyNamesHash.h for writing";
  294. print C "static const char * const propertyNameStrings[$num] = {\n";
  295.  
  296. foreach my $name (@names) {
  297. @@ -116,6 +121,29 @@ foreach my $name (@names) {
  298.  
  299. print C << "EOF";
  300. };
  301. +
  302. +EOF
  303. +
  304. +close C;
  305. +
  306. +my $propertyNamesImpl = "CSSPropertyNames.cpp";
  307. +
  308. +open PROPERTYNAMES, ">$propertyNamesImpl" || die "Could not open $propertyNamesImpl for writing";
  309. +print PROPERTYNAMES << "EOF";
  310. +/* This file is automatically generated by make-hash-tools.pl, do not edit */
  311. +
  312. +
  313. +#include "CSSPropertyNames.h"
  314. +#include "HashTools.h"
  315. +
  316. +namespace WebCore {
  317. +#include "CSSPropertyNamesHash.h"
  318. +
  319. +const Property* findProperty (register const char* str, register unsigned int len)
  320. +{
  321. + return CSSPropertyNamesHash::findPropertyImpl(str, len);
  322. +}
  323. +
  324. const char* getPropertyName(CSSPropertyID id)
  325. {
  326. if (id < firstCSSProperty)
  327. @@ -125,7 +153,10 @@ const char* getPropertyName(CSSPropertyID id)
  328. return 0;
  329. return propertyNameStrings[index];
  330. }
  331. +
  332. +} // namespace WebCore
  333. +
  334. EOF
  335.  
  336. -close C;
  337. +close PROPERTYNAMES;
  338.  
  339. diff --git a/WebCore/css/makevalues.pl b/WebCore/css/makevalues.pl
  340. index 421e470..c9f7f70 100644
  341. --- a/WebCore/css/makevalues.pl
  342. +++ b/WebCore/css/makevalues.pl
  343. @@ -42,14 +42,13 @@ print GPERF << "EOF";
  344. #include \"CSSValueKeywords.h\"
  345. %}
  346. %struct-type
  347. -struct Value {
  348. - const char* name;
  349. - int id;
  350. -};
  351. -%language=ANSI-C
  352. +struct Value;
  353. +%omit-struct-type
  354. +%language=C++
  355. %readonly-tables
  356. %compare-strncmp
  357. -%define lookup-function-name findValue
  358. +%define class-name CSSValueKeywordsHash
  359. +%define lookup-function-name findValueImpl
  360. %define hash-function-name value_hash_function
  361. %define word-array-name value_word_list
  362. %includes
  363. @@ -72,6 +71,10 @@ print HEADER << "EOF";
  364. #ifndef CSSValueKeywords_h
  365. #define CSSValueKeywords_h
  366.  
  367. +#include <string.h>
  368. +
  369. +namespace WebCore {
  370. +
  371. const int CSSValueInvalid = 0;
  372. EOF
  373.  
  374. @@ -92,13 +95,16 @@ print HEADER << "EOF";
  375.  
  376. const char* getValueName(unsigned short id);
  377.  
  378. +} // namespace WebCore
  379. +
  380. #endif // CSSValueKeywords_h
  381. +
  382. EOF
  383. close HEADER;
  384.  
  385. -system("gperf --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf > CSSValueKeywords.cpp") == 0 || die "calling gperf failed: $?";
  386. +system("gperf --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf > CSSValueKeywordsHash.h") == 0 || die "calling gperf failed: $?";
  387.  
  388. -open C, ">>CSSValueKeywords.cpp" || die "Could not open CSSValueKeywords.cpp for writing";
  389. +open C, ">>CSSValueKeywordsHash.h" || die "Could not open CSSValueKeywordsHash.h for writing";
  390. print C "static const char * const valueList[] = {\n";
  391. print C "\"\",\n";
  392. foreach my $name (@names) {
  393. @@ -107,12 +113,38 @@ foreach my $name (@names) {
  394. print C << "EOF";
  395. 0
  396. };
  397. +
  398. +EOF
  399. +
  400. +close C;
  401. +
  402. +my $valueKeywordsImpl = "CSSValueKeywords.cpp";
  403. +
  404. +open VALUEKEYWORDS, ">$valueKeywordsImpl" || die "Could not open $valueKeywordsImpl for writing";
  405. +print VALUEKEYWORDS << "EOF";
  406. +/* This file is automatically generated by make-hash-tools.pl, do not edit */
  407. +
  408. +#include "CSSValueKeywords.h"
  409. +#include "HashTools.h"
  410. +
  411. +namespace WebCore {
  412. +#include "CSSValueKeywordsHash.h"
  413. +
  414. +const Value* findValue (register const char* str, register unsigned int len)
  415. +{
  416. + return CSSValueKeywordsHash::findValueImpl(str, len);
  417. +}
  418. +
  419. const char* getValueName(unsigned short id)
  420. {
  421. if (id >= numCSSValueKeywords || id <= 0)
  422. return 0;
  423. return valueList[id];
  424. }
  425. +
  426. +} // namespace WebCore
  427. +
  428. EOF
  429.  
  430. -close C;
  431. +close VALUEKEYWORDS;
  432. +
  433. diff --git a/WebCore/html/DocTypeStrings.gperf b/WebCore/html/DocTypeStrings.gperf
  434. index 5c213b0..6b7da04 100644
  435. --- a/WebCore/html/DocTypeStrings.gperf
  436. +++ b/WebCore/html/DocTypeStrings.gperf
  437. @@ -1,21 +1,13 @@
  438. %struct-type
  439. -struct PubIDInfo {
  440. - enum eMode {
  441. - eQuirks,
  442. - eQuirks3,
  443. - eAlmostStandards
  444. - };
  445. -
  446. - const char* name;
  447. - eMode mode_if_no_sysid;
  448. - eMode mode_if_sysid;
  449. -}
  450. -%language=ANSI-C
  451. +struct PubIDInfo;
  452. +%omit-struct-type
  453. +%language=C++
  454. %readonly-tables
  455. %global-table
  456. %compare-strncmp
  457. +%define class-name DocTypeStringsHash
  458. %define initializer-suffix ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards
  459. -%define lookup-function-name findDoctypeEntry
  460. +%define lookup-function-name findDoctypeEntryImpl
  461. %define hash-function-name doctype_hash_function
  462. %includes
  463. %enum
  464. diff --git a/WebCore/html/HTMLDocument.cpp b/WebCore/html/HTMLDocument.cpp
  465. index ff0c2de..5047ca1 100644
  466. --- a/WebCore/html/HTMLDocument.cpp
  467. +++ b/WebCore/html/HTMLDocument.cpp
  468. @@ -64,6 +64,7 @@
  469. #include "FrameLoader.h"
  470. #include "FrameTree.h"
  471. #include "FrameView.h"
  472. +#include "HashTools.h"
  473. #include "HTMLDocumentParser.h"
  474. #include "HTMLBodyElement.h"
  475. #include "HTMLElementFactory.h"
  476. @@ -75,8 +76,6 @@
  477. #include "Settings.h"
  478. #include <wtf/text/CString.h>
  479.  
  480. -#include "DocTypeStrings.cpp"
  481. -
  482. namespace WebCore {
  483.  
  484. using namespace HTMLNames;
  485. diff --git a/WebCore/html/HTMLEntityNames.gperf b/WebCore/html/HTMLEntityNames.gperf
  486. index c665efe..6ec5dca 100644
  487. --- a/WebCore/html/HTMLEntityNames.gperf
  488. +++ b/WebCore/html/HTMLEntityNames.gperf
  489. @@ -25,16 +25,16 @@
  490. */
  491. %}
  492. %struct-type
  493. -struct Entity {
  494. - const char *name;
  495. - int code;
  496. -};
  497. -%language=ANSI-C
  498. +struct Entity;
  499. +%language=C++
  500. +%omit-struct-type
  501. %readonly-tables
  502. %global-table
  503. %compare-strncmp
  504. -%define lookup-function-name findEntity
  505. +%define class-name HTMLEntityHash
  506. +%define lookup-function-name findEntityImpl
  507. %define hash-function-name entity_hash_function
  508. +%define word-array-name entity_wordlist
  509. %includes
  510. %enum
  511. %%
  512. diff --git a/WebCore/html/HTMLEntityParser.cpp b/WebCore/html/HTMLEntityParser.cpp
  513. index 84b2006..4621ef3 100644
  514. --- a/WebCore/html/HTMLEntityParser.cpp
  515. +++ b/WebCore/html/HTMLEntityParser.cpp
  516. @@ -28,21 +28,9 @@
  517. #include "config.h"
  518. #include "HTMLEntityParser.h"
  519.  
  520. +#include "HashTools.h"
  521. #include <wtf/Vector.h>
  522.  
  523. -// Use __GNUC__ instead of PLATFORM(GCC) to stay consistent with the gperf generated c file
  524. -#ifdef __GNUC__
  525. -// The main parser includes this too so we are getting two copies of the data. However, this way the code gets inlined.
  526. -#include "HTMLEntityNames.cpp"
  527. -#else
  528. -// Not inlined for non-GCC compilers
  529. -struct Entity {
  530. - const char* name;
  531. - int code;
  532. -};
  533. -const struct Entity* findEntity(register const char* str, register unsigned int len);
  534. -#endif
  535. -
  536. using namespace WTF;
  537.  
  538. namespace WebCore {
  539. diff --git a/WebCore/html/LegacyHTMLDocumentParser.cpp b/WebCore/html/LegacyHTMLDocumentParser.cpp
  540. index cb5fac8..aa6e240 100644
  541. --- a/WebCore/html/LegacyHTMLDocumentParser.cpp
  542. +++ b/WebCore/html/LegacyHTMLDocumentParser.cpp
  543. @@ -39,6 +39,7 @@
  544. #include "Frame.h"
  545. #include "FrameLoader.h"
  546. #include "FrameView.h"
  547. +#include "HashTools.h"
  548. #include "HTMLElement.h"
  549. #include "HTMLNames.h"
  550. #include "LegacyHTMLTreeBuilder.h"
  551. @@ -54,8 +55,6 @@
  552. #include <wtf/ASCIICType.h>
  553. #include <wtf/CurrentTime.h>
  554.  
  555. -#include "HTMLEntityNames.cpp"
  556. -
  557. #define PRELOAD_SCANNER_ENABLED 1
  558.  
  559. using namespace WTF;
  560. diff --git a/WebCore/html/LegacyPreloadScanner.cpp b/WebCore/html/LegacyPreloadScanner.cpp
  561. index c9fda4f..7a6d016 100644
  562. --- a/WebCore/html/LegacyPreloadScanner.cpp
  563. +++ b/WebCore/html/LegacyPreloadScanner.cpp
  564. @@ -38,25 +38,13 @@
  565. #include "Document.h"
  566. #include "Frame.h"
  567. #include "FrameLoader.h"
  568. +#include "HashTools.h"
  569. #include "HTMLLinkElement.h"
  570. #include "HTMLNames.h"
  571. #include <wtf/text/CString.h>
  572. #include <wtf/CurrentTime.h>
  573. #include <wtf/unicode/Unicode.h>
  574.  
  575. -// Use __GNUC__ instead of PLATFORM(GCC) to stay consistent with the gperf generated c file
  576. -#ifdef __GNUC__
  577. -// The main tokenizer includes this too so we are getting two copies of the data. However, this way the code gets inlined.
  578. -#include "HTMLEntityNames.cpp"
  579. -#else
  580. -// Not inlined for non-GCC compilers
  581. -struct Entity {
  582. - const char* name;
  583. - int code;
  584. -};
  585. -const struct Entity* findEntity(register const char* str, register unsigned int len);
  586. -#endif
  587. -
  588. #define PRELOAD_DEBUG 0
  589.  
  590. using namespace WTF;
  591. diff --git a/WebCore/make-hash-tools.pl b/WebCore/make-hash-tools.pl
  592. index 42cb6fd..432ac40 100644
  593. --- a/WebCore/make-hash-tools.pl
  594. +++ b/WebCore/make-hash-tools.pl
  595. @@ -26,35 +26,181 @@ use File::Basename;
  596. my $outdir = $ARGV[0];
  597. shift;
  598. my $option = basename($ARGV[0],".gperf");
  599. +my $hashToolsHeader = "$outdir/HashTools.h";
  600. +
  601. +sub createHashToolsHeader() {
  602. +
  603. +open HEADER, ">$hashToolsHeader" || die "Could not open $hashToolsHeader for writing";
  604. +print HEADER << "EOF";
  605. +/* This file is automatically generated by make-hash-tools.pl, do not edit */
  606. +
  607. +#ifndef HashTools_h
  608. +#define HashTools_h
  609. +
  610. +#include "wtf/Platform.h"
  611. +
  612. +namespace WebCore {
  613. +
  614. +struct Entity {
  615. + const char* name;
  616. + int code;
  617. +};
  618. +
  619. +struct PubIDInfo {
  620. + enum eMode {
  621. + eQuirks,
  622. + eQuirks3,
  623. + eAlmostStandards
  624. + };
  625. +
  626. + const char* name;
  627. + eMode mode_if_no_sysid;
  628. + eMode mode_if_sysid;
  629. +};
  630. +
  631. +struct NamedColor {
  632. + const char* name;
  633. + int RGBValue;
  634. +};
  635. +
  636. +struct Property {
  637. + const char* name;
  638. + int id;
  639. +};
  640. +
  641. +struct Value {
  642. + const char* name;
  643. + int id;
  644. +};
  645. +
  646. +const Entity* findEntity(register const char* str, register unsigned int len);
  647. +const PubIDInfo* findDoctypeEntry(register const char* str, register unsigned int len);
  648. +const NamedColor* findColor(register const char* str, register unsigned int len);
  649. +const Property* findProperty(register const char* str, register unsigned int len);
  650. +const Value* findValue(register const char* str, register unsigned int len);
  651. +
  652. +#if PLATFORM(CHROMIUM)
  653. +
  654. +const Entity* wordList();
  655. +const int wordListSize();
  656. +
  657. +#endif
  658. +
  659. +}
  660. +
  661. +#endif // HashTools_h
  662. +
  663. +EOF
  664. +close HEADER;
  665. +
  666. +}
  667. +
  668. +
  669.  
  670. switch ($option) {
  671.  
  672. case "HTMLEntityNames" {
  673.  
  674. - my $htmlEntityNamesGenerated = "$outdir/HTMLEntityNames.cpp";
  675. + createHashToolsHeader();
  676. +
  677. + my $htmlEntityNamesImpl = "$outdir/HTMLEntityNames.cpp";
  678. + my $htmlEntityNamesGenerated = "$outdir/HTMLEntityNamesHash.h";
  679. my $htmlEntityNamesGperf = $ARGV[0];
  680. shift;
  681.  
  682. + open ENTITIES, ">$htmlEntityNamesImpl" || die "Could not open $htmlEntityNamesImpl for writing";
  683. + print ENTITIES << "EOF";
  684. +/* This file is automatically generated by make-hash-tools.pl, do not edit */
  685. +
  686. +#include "HashTools.h"
  687. +
  688. +namespace WebCore {
  689. +#include "HTMLEntityNamesHash.h"
  690. +
  691. +const Entity* findEntity(register const char* str, register unsigned int len)
  692. +{
  693. + return HTMLEntityHash::findEntityImpl(str, len);
  694. +}
  695. +
  696. +#if PLATFORM(CHROMIUM)
  697. +
  698. +const Entity* wordList()
  699. +{
  700. + return WebCore::entity_wordlist;
  701. +}
  702. +
  703. +const int wordListSize()
  704. +{
  705. + return sizeof(WebCore::entity_wordlist) / sizeof(Entity);
  706. +}
  707. +
  708. +#endif // PLATFORM(CHROMIUM)
  709. +
  710. +} // namespace WebCore
  711. +
  712. +EOF
  713. + close ENTITIES;
  714. +
  715. system("gperf --key-positions=\"*\" -D -s 2 $htmlEntityNamesGperf > $htmlEntityNamesGenerated") == 0 || die "calling gperf failed: $?";
  716.  
  717. } # case "HTMLEntityNames"
  718.  
  719. case "DocTypeStrings" {
  720.  
  721. - my $docTypeStringsGenerated = "$outdir/DocTypeStrings.cpp";
  722. + my $docTypeStringsImpl = "$outdir/DocTypeStrings.cpp";
  723. + my $docTypeStringsGenerated = "$outdir/DocTypeStringsHash.h";
  724. my $docTypeStringsGperf = $ARGV[0];
  725. shift;
  726.  
  727. + open DOCTYPESTRINGS, ">$docTypeStringsImpl" || die "Could not open $docTypeStringsImpl for writing";
  728. + print DOCTYPESTRINGS << "EOF";
  729. +/* This file is automatically generated by make-hash-tools.pl, do not edit */
  730. +
  731. +#include "HashTools.h"
  732. +
  733. +namespace WebCore {
  734. +#include "DocTypeStringsHash.h"
  735. +
  736. +const PubIDInfo* findDoctypeEntry (register const char* str, register unsigned int len)
  737. +{
  738. + return DocTypeStringsHash::findDoctypeEntryImpl(str, len);
  739. +}
  740. +
  741. +}
  742. +
  743. +EOF
  744. + close DOCTYPESTRINGS;
  745. +
  746. system("gperf --key-positions=\"*\" -s 2 $docTypeStringsGperf > $docTypeStringsGenerated") == 0 || die "calling gperf failed: $?";
  747.  
  748. } # case "DocTypeStrings"
  749.  
  750. case "ColorData" {
  751.  
  752. - my $colorDataGenerated = "$outdir/ColorData.cpp";
  753. - my $colorDataGperf = $ARGV[0];
  754. + my $colorDataImpl = "$outdir/ColorData.cpp";
  755. + my $colorDataGenerated = "$outdir/ColorDataHash.h";
  756. + my $colorDataGperf = $ARGV[0];
  757. shift;
  758.  
  759. + open COLORDATA, ">$colorDataImpl" || die "Could not open $colorDataImpl for writing";
  760. + print COLORDATA << "EOF";
  761. +/* This file is automatically generated by make-hash-tools.pl, do not edit */
  762. +
  763. +#include "HashTools.h"
  764. +
  765. +namespace WebCore {
  766. +#include "ColorDataHash.h"
  767. +
  768. +const struct NamedColor* findColor (register const char* str, register unsigned int len)
  769. +{
  770. + return ColorDataHash::findColorImpl(str, len);
  771. +}
  772. +
  773. +}
  774. +
  775. +EOF
  776. + close COLORDATA;
  777. +
  778. system("gperf --key-positions=\"*\" -D -s 2 $colorDataGperf > $colorDataGenerated") == 0 || die "calling gperf failed: $?";
  779.  
  780. } # case "ColorData"
  781. diff --git a/WebCore/platform/ColorData.gperf b/WebCore/platform/ColorData.gperf
  782. index 11ef798..d684cb9 100644
  783. --- a/WebCore/platform/ColorData.gperf
  784. +++ b/WebCore/platform/ColorData.gperf
  785. @@ -1,13 +1,12 @@
  786. %struct-type
  787. -struct NamedColor {
  788. - const char *name;
  789. - int RGBValue;
  790. -};
  791. -%language=ANSI-C
  792. +struct NamedColor;
  793. +%omit-struct-type
  794. +%language=C++
  795. %readonly-tables
  796. %global-table
  797. %compare-strncmp
  798. -%define lookup-function-name findColor
  799. +%define class-name ColorDataHash
  800. +%define lookup-function-name findColorImpl
  801. %define hash-function-name colordata_hash_function
  802. %includes
  803. %enum
  804. diff --git a/WebCore/platform/graphics/Color.cpp b/WebCore/platform/graphics/Color.cpp
  805. index 80c8286..f28d51c 100644
  806. --- a/WebCore/platform/graphics/Color.cpp
  807. +++ b/WebCore/platform/graphics/Color.cpp
  808. @@ -26,13 +26,12 @@
  809. #include "config.h"
  810. #include "Color.h"
  811.  
  812. +#include "HashTools.h"
  813. #include "PlatformString.h"
  814. #include <math.h>
  815. #include <wtf/Assertions.h>
  816. #include <wtf/MathExtras.h>
  817.  
  818. -#include "ColorData.cpp"
  819. -
  820. using namespace std;
  821. using namespace WTF;
  822.  
  823. diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
  824. index 99bbeec..686acf5 100644
  825. --- a/WebKit/chromium/ChangeLog
  826. +++ b/WebKit/chromium/ChangeLog
  827. @@ -1,3 +1,24 @@
  828. +2010-08-06 Andras Becsi <abecsi@webkit.org>
  829. +
  830. + Reviewed by NOBODY (OOPS!).
  831. +
  832. + Undefined reference errors when linking due to gperf and inlining.
  833. + webkit.org/b/29244
  834. +
  835. + EFL CMake changes by Leandro Pereira <leandro@profusion.mobi>
  836. +
  837. + Refactor gperf code generation and usage to fix the debug build with gcc>4.4.
  838. + Hitherto gperf generated C code, these files were included in multiple C++ files across WebCore
  839. + to access the functionality provided. This resulted in debug build failure with newer gcc versions
  840. + because of a behaviour change of gcc, which disables C style inlining in debug mode.
  841. + The make-hash-tools.pl script lets gperf generate C++ code for all gperf files now, which are compiled
  842. + in their own compilation unit.
  843. + The functionality provided by the generated code is wrapped behind HashTools.h, so there is no need
  844. + for multiple inclusions of generated C files to access these functions.
  845. +
  846. + * src/WebEntities.cpp:
  847. + (WebKit::WebEntities::WebEntities):
  848. +
  849. 2010-08-06 Kavita Kanetkar <kkanetkar@chromium.org>
  850.  
  851. Reviewed by Joseph Pecoraro.
  852. diff --git a/WebKit/chromium/src/WebEntities.cpp b/WebKit/chromium/src/WebEntities.cpp
  853. index 665d8d9..78c3f5f 100644
  854. --- a/WebKit/chromium/src/WebEntities.cpp
  855. +++ b/WebKit/chromium/src/WebEntities.cpp
  856. @@ -31,9 +31,9 @@
  857. #include "config.h"
  858. #include "WebEntities.h"
  859.  
  860. -#include <string.h>
  861. -
  862. +#include "HashTools.h"
  863. #include "PlatformString.h"
  864. +#include <string.h>
  865. #include "StringBuilder.h"
  866. #include <wtf/HashMap.h>
  867.  
  868. @@ -41,15 +41,6 @@
  869.  
  870. using namespace WebCore;
  871.  
  872. -namespace {
  873. -// Note that this file is also included by LegacyHTMLDocumentParser.cpp so we are getting
  874. -// two copies of the data in memory. We can fix this by changing the script
  875. -// that generated the array to create a static const that is its length, but
  876. -// this is low priority since the data is less than 4K. We use anonymous
  877. -// namespace to prevent name collisions.
  878. -#include "HTMLEntityNames.cpp" // NOLINT
  879. -}
  880. -
  881. namespace WebKit {
  882.  
  883. void populateMap(WTF::HashMap<int, WebCore::String>& map,
  884. @@ -91,8 +82,8 @@ WebEntities::WebEntities(bool xmlEntities)
  885. false);
  886. else
  887. populateMap(m_entitiesMap,
  888. - wordlist,
  889. - sizeof(wordlist) / sizeof(Entity),
  890. + wordList(),
  891. + wordListSize(),
  892. true);
  893. }
  894.  
  895. diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
  896. index 36bf9d1..f9d28ef 100644
  897. --- a/WebKit/qt/ChangeLog
  898. +++ b/WebKit/qt/ChangeLog
  899. @@ -1,3 +1,24 @@
  900. +2010-08-06 Andras Becsi <abecsi@webkit.org>
  901. +
  902. + Reviewed by NOBODY (OOPS!).
  903. +
  904. + Undefined reference errors when linking due to gperf and inlining.
  905. + webkit.org/b/29244
  906. +
  907. + EFL CMake changes by Leandro Pereira <leandro@profusion.mobi>
  908. +
  909. + Refactor gperf code generation and usage to fix the debug build with gcc>4.4.
  910. + Hitherto gperf generated C code, these files were included in multiple C++ files across WebCore
  911. + to access the functionality provided. This resulted in debug build failure with newer gcc versions
  912. + because of a behaviour change of gcc, which disables C style inlining in debug mode.
  913. + The make-hash-tools.pl script lets gperf generate C++ code for all gperf files now, which are compiled
  914. + in their own compilation unit.
  915. + The functionality provided by the generated code is wrapped behind HashTools.h, so there is no need
  916. + for multiple inclusions of generated C files to access these functions.
  917. +
  918. + * WebCoreSupport/FrameLoaderClientQt.cpp:
  919. + (WebCore::FrameLoaderClientQt::createPlugin):
  920. +
  921. 2010-08-06 Luiz Agostini <luiz.agostini@openbossa.org>
  922.  
  923. Reviewed by Kenneth Rohde Christiansen.
  924. diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
  925. index 9fe66d9..e5a81bd 100644
  926. --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
  927. +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
  928. @@ -1407,7 +1407,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
  929. for (unsigned i = 0; i < numqStyleSheetProperties; ++i) {
  930. CSSPropertyID property = qstyleSheetProperties[i];
  931.  
  932. - styleSheet += QString::fromLatin1(::getPropertyName(property));
  933. + styleSheet += QString::fromLatin1(getPropertyName(property));
  934. styleSheet += QLatin1Char(':');
  935. styleSheet += computedStyle(element)->getPropertyValue(property);
  936. styleSheet += QLatin1Char(';');
  937. diff --git a/cmake/WebKitGenerators.cmake b/cmake/WebKitGenerators.cmake
  938. index 50c9077..5d3b86d 100644
  939. --- a/cmake/WebKitGenerators.cmake
  940. +++ b/cmake/WebKitGenerators.cmake
  941. @@ -2,7 +2,6 @@
  942. # It will check for the programs and define the given executables:
  943. # PERL_EXECUTABLE
  944. # BISON_EXECUTABLE
  945. -# GPERF_EXECUTABLE
  946. # FLEX_EXECUTABLE
  947.  
  948. INCLUDE (WebKitFS)
  949. @@ -69,25 +68,24 @@ MACRO(GENERATE_GRAMMAR _prefix _source)
  950. ENDMACRO ()
  951.  
  952.  
  953. -FIND_PROGRAM(GPERF_EXECUTABLE gperf)
  954. -IF (NOT GPERF_EXECUTABLE)
  955. - MESSAGE(FATAL_ERROR "Missing gperf")
  956. -ENDIF ()
  957. -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GPerf DEFAULT_MSG GPERF_EXECUTABLE)
  958. -SET(PERF_HASH_GENERATOR ${WEBCORE_DIR}/make-hash-tools.pl)
  959. -
  960. # - Create perfect hash tables using gperf
  961. -# GENERATE_GPERF(extension source_file)
  962. -#
  963. -# The generated files lives in ${DERIVED_SOURCES_DIR} and ends in .cpp
  964. -MACRO(GENERATE_GPERF _source)
  965. +MACRO(MAKE_HASH_TOOLS _source)
  966. GET_FILENAME_COMPONENT(_name ${_source} NAME_WE)
  967. +
  968. + IF (${_source} STREQUAL "HTMLEntityNames")
  969. + SET(_hash_tools_h "${DERIVED_SOURCES_DIR}/HashTools.h")
  970. + ELSE ()
  971. + SET(_hash_tools_h "")
  972. + ENDIF ()
  973. +
  974. ADD_CUSTOM_COMMAND(
  975. - OUTPUT ${DERIVED_SOURCES_DIR}/${_name}.cpp
  976. - DEPENDS ${_source}
  977. - COMMAND ${PERL_EXECUTABLE} ${PERF_HASH_GENERATOR} ${DERIVED_SOURCES_DIR} ${_source}
  978. + OUTPUT ${DERIVED_SOURCES_DIR}/${_name}.cpp ${_hash_tools_h}
  979. + COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/make-hash-tools.pl ${DERIVED_SOURCES_DIR} ${_source}.gperf
  980. VERBATIM)
  981. -ENDMACRO ()
  982. +
  983. + UNSET(_name)
  984. + UNSET(_hash_tools_h)
  985. +ENDMACRO()
  986.  
  987.  
  988. # Modules that the bindings generator scripts may use
Add Comment
Please, Sign In to add comment