Guest User

Untitled

a guest
May 29th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.01 KB | None | 0 0
  1. Index: WebCore/ChangeLog
  2. ===================================================================
  3. --- WebCore/ChangeLog (revision 61708)
  4. +++ WebCore/ChangeLog (working copy)
  5. @@ -1,3 +1,37 @@
  6. +2010-06-23 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. + Refactor gperf code generation and usage to fix the debug build with gcc>4.4.
  14. + Hitherto gperf generated C code, these files were included in multiple C++ files across WebCore
  15. + to access the functionality provided. This resulted in debug build failure with newer gcc versions
  16. + because of a behaviour change of gcc, which disables C style inlining in debug mode.
  17. + The make-hash-tools.pl script lets gperf generate C++ code for all gperf files now, which are compiled
  18. + in their own compilation unit.
  19. + The functionality provided by the generated code is wrapped behind HashTools.h, so there is no need
  20. + for multiple inclusions of generated C files to access these functions.
  21. +
  22. + No new functionality added, no new tests needed.
  23. +
  24. + * CMakeLists.txt:
  25. + * WebCore.gyp/WebCore.gyp:
  26. + * WebCore.pri:
  27. + * WebCore.xcodeproj/project.pbxproj:
  28. + * css/CSSParser.cpp:
  29. + * css/makeprop.pl:
  30. + * css/makevalues.pl:
  31. + * html/DocTypeStrings.gperf:
  32. + * html/HTMLDocument.cpp:
  33. + * html/HTMLEntityNames.gperf:
  34. + * html/HTMLEntityParser.cpp:
  35. + * html/LegacyPreloadScanner.cpp:
  36. + * make-hash-tools.pl:
  37. + * platform/ColorData.gperf:
  38. + * platform/graphics/Color.cpp:
  39. +
  40. 2010-06-23 Andy Estes <aestes@apple.com>
  41.  
  42. Reviewed by Alexey Proskuryakov.
  43. Index: WebCore/CMakeLists.txt
  44. ===================================================================
  45. --- WebCore/CMakeLists.txt (revision 61708)
  46. +++ WebCore/CMakeLists.txt (working copy)
  47. @@ -516,6 +516,10 @@ SET(WebCore_SOURCES
  48. ${DERIVED_SOURCES_DIR}/CSSGrammar.cpp
  49. ${DERIVED_SOURCES_DIR}/HTMLElementFactory.cpp
  50. ${DERIVED_SOURCES_DIR}/HTMLEntityNames.cpp
  51. + ${DERIVED_SOURCES_DIR}/DocTypeStrings.cpp
  52. + ${DERIVED_SOURCES_DIR}/CSSValueKeywords.cpp
  53. + ${DERIVED_SOURCES_DIR}/CSSPropertyNames.cpp
  54. + ${DERIVED_SOURCES_DIR}/ColorData.cpp
  55. ${DERIVED_SOURCES_DIR}/HTMLNames.cpp
  56. ${DERIVED_SOURCES_DIR}/JSHTMLElementWrapperFactory.cpp
  57. ${DERIVED_SOURCES_DIR}/UserAgentStyleSheetsData.cpp
  58. Index: WebCore/WebCore.pri
  59. ===================================================================
  60. --- WebCore/WebCore.pri (revision 61708)
  61. +++ WebCore/WebCore.pri (working copy)
  62. @@ -682,7 +682,7 @@ cssprops.wkScript = $$PWD/css/makeprop.p
  63. cssprops.output = $${WC_GENERATED_SOURCES_DIR}/CSSPropertyNames.cpp
  64. cssprops.input = WALDOCSSPROPS
  65. 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
  66. -cssprops.depends = ${QMAKE_FILE_NAME} $${DASHBOARDSUPPORTCSSPROPERTIES} $${EXTRACSSPROPERTIES}
  67. +cssprops.depends = ${QMAKE_FILE_NAME} $${DASHBOARDSUPPORTCSSPROPERTIES} $${EXTRACSSPROPERTIES} $$cssprops.wkScript
  68. addExtraCompiler(cssprops)
  69.  
  70. # GENERATOR 6-B:
  71. @@ -690,7 +690,7 @@ cssvalues.wkScript = $$PWD/css/makevalue
  72. cssvalues.output = $${WC_GENERATED_SOURCES_DIR}/CSSValueKeywords.cpp
  73. cssvalues.input = WALDOCSSVALUES
  74. 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
  75. -cssvalues.depends = ${QMAKE_FILE_NAME} $${EXTRACSSVALUES}
  76. +cssvalues.depends = ${QMAKE_FILE_NAME} $${EXTRACSSVALUES} $$cssvalues.wkScript
  77. cssvalues.clean = ${QMAKE_FILE_OUT} ${QMAKE_VAR_WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.h
  78. addExtraCompiler(cssvalues)
  79.  
  80. Index: WebCore/make-hash-tools.pl
  81. ===================================================================
  82. --- WebCore/make-hash-tools.pl (revision 61708)
  83. +++ WebCore/make-hash-tools.pl (working copy)
  84. @@ -26,35 +26,181 @@ use File::Basename;
  85. my $outdir = $ARGV[0];
  86. shift;
  87. my $option = basename($ARGV[0],".gperf");
  88. +my $hashToolsHeader = "$outdir/HashTools.h";
  89. +
  90. +sub createHashToolsHeader() {
  91. +
  92. +open HEADER, ">$hashToolsHeader" || die "Could not open $hashToolsHeader for writing";
  93. +print HEADER << "EOF";
  94. +/* This file is automatically generated by make-hash-tools.pl, do not edit */
  95. +
  96. +#ifndef HashTools_h
  97. +#define HashTools_h
  98. +
  99. +#include "wtf/Platform.h"
  100. +
  101. +namespace WebCore {
  102. +
  103. +struct Entity {
  104. + const char* name;
  105. + int code;
  106. +};
  107. +
  108. +struct PubIDInfo {
  109. + enum eMode {
  110. + eQuirks,
  111. + eQuirks3,
  112. + eAlmostStandards
  113. + };
  114. +
  115. + const char* name;
  116. + eMode mode_if_no_sysid;
  117. + eMode mode_if_sysid;
  118. +};
  119. +
  120. +struct NamedColor {
  121. + const char* name;
  122. + int RGBValue;
  123. +};
  124. +
  125. +struct Property {
  126. + const char* name;
  127. + int id;
  128. +};
  129. +
  130. +struct Value {
  131. + const char* name;
  132. + int id;
  133. +};
  134. +
  135. +const Entity* findEntity(register const char* str, register unsigned int len);
  136. +const PubIDInfo* findDoctypeEntry(register const char* str, register unsigned int len);
  137. +const NamedColor* findColor(register const char* str, register unsigned int len);
  138. +const Property* findProperty(register const char* str, register unsigned int len);
  139. +const Value* findValue(register const char* str, register unsigned int len);
  140. +
  141. +#if PLATFORM(CHROMIUM)
  142. +
  143. +const Entity* wordList();
  144. +const int wordListSize();
  145. +
  146. +#endif
  147. +
  148. +}
  149. +
  150. +#endif // HashTools_h
  151. +
  152. +EOF
  153. +close HEADER;
  154. +
  155. +}
  156. +
  157. +
  158.  
  159. switch ($option) {
  160.  
  161. case "HTMLEntityNames" {
  162.  
  163. - my $htmlEntityNamesGenerated = "$outdir/HTMLEntityNames.cpp";
  164. + createHashToolsHeader();
  165. +
  166. + my $htmlEntityNamesImpl = "$outdir/HTMLEntityNames.cpp";
  167. + my $htmlEntityNamesGenerated = "$outdir/HTMLEntityNamesHash.h";
  168. my $htmlEntityNamesGperf = $ARGV[0];
  169. shift;
  170.  
  171. + open ENTITIES, ">$htmlEntityNamesImpl" || die "Could not open $htmlEntityNamesImpl for writing";
  172. + print ENTITIES << "EOF";
  173. +/* This file is automatically generated by make-hash-tools.pl, do not edit */
  174. +
  175. +#include "HashTools.h"
  176. +
  177. +namespace WebCore {
  178. +#include "HTMLEntityNamesHash.h"
  179. +
  180. +const Entity* findEntity(register const char* str, register unsigned int len)
  181. +{
  182. + return HTMLEntityHash::findEntityImpl(str, len);
  183. +}
  184. +
  185. +#if PLATFORM(CHROMIUM)
  186. +
  187. +const Entity* wordList()
  188. +{
  189. + return WebCore::entity_wordlist;
  190. +}
  191. +
  192. +const int wordListSize()
  193. +{
  194. + return sizeof(WebCore::entity_wordlist) / sizeof(Entity);
  195. +}
  196. +
  197. +#endif // PLATFORM(CHROMIUM)
  198. +
  199. +} // namespace WebCore
  200. +
  201. +EOF
  202. + close ENTITIES;
  203. +
  204. system("gperf --key-positions=\"*\" -D -s 2 $htmlEntityNamesGperf > $htmlEntityNamesGenerated") == 0 || die "calling gperf failed: $?";
  205.  
  206. } # case "HTMLEntityNames"
  207.  
  208. case "DocTypeStrings" {
  209.  
  210. - my $docTypeStringsGenerated = "$outdir/DocTypeStrings.cpp";
  211. + my $docTypeStringsImpl = "$outdir/DocTypeStrings.cpp";
  212. + my $docTypeStringsGenerated = "$outdir/DocTypeStringsHash.h";
  213. my $docTypeStringsGperf = $ARGV[0];
  214. shift;
  215.  
  216. + open DOCTYPESTRINGS, ">$docTypeStringsImpl" || die "Could not open $docTypeStringsImpl for writing";
  217. + print DOCTYPESTRINGS << "EOF";
  218. +/* This file is automatically generated by make-hash-tools.pl, do not edit */
  219. +
  220. +#include "HashTools.h"
  221. +
  222. +namespace WebCore {
  223. +#include "DocTypeStringsHash.h"
  224. +
  225. +const PubIDInfo* findDoctypeEntry (register const char* str, register unsigned int len)
  226. +{
  227. + return DocTypeStringsHash::findDoctypeEntryImpl(str, len);
  228. +}
  229. +
  230. +}
  231. +
  232. +EOF
  233. + close DOCTYPESTRINGS;
  234. +
  235. system("gperf --key-positions=\"*\" -s 2 $docTypeStringsGperf > $docTypeStringsGenerated") == 0 || die "calling gperf failed: $?";
  236.  
  237. } # case "DocTypeStrings"
  238.  
  239. case "ColorData" {
  240.  
  241. - my $colorDataGenerated = "$outdir/ColorData.cpp";
  242. - my $colorDataGperf = $ARGV[0];
  243. + my $colorDataImpl = "$outdir/ColorData.cpp";
  244. + my $colorDataGenerated = "$outdir/ColorDataHash.h";
  245. + my $colorDataGperf = $ARGV[0];
  246. shift;
  247.  
  248. + open COLORDATA, ">$colorDataImpl" || die "Could not open $colorDataImpl for writing";
  249. + print COLORDATA << "EOF";
  250. +/* This file is automatically generated by make-hash-tools.pl, do not edit */
  251. +
  252. +#include "HashTools.h"
  253. +
  254. +namespace WebCore {
  255. +#include "ColorDataHash.h"
  256. +
  257. +const struct NamedColor* findColor (register const char* str, register unsigned int len)
  258. +{
  259. + return ColorDataHash::findColorImpl(str, len);
  260. +}
  261. +
  262. +}
  263. +
  264. +EOF
  265. + close COLORDATA;
  266. +
  267. system("gperf --key-positions=\"*\" -D -s 2 $colorDataGperf > $colorDataGenerated") == 0 || die "calling gperf failed: $?";
  268.  
  269. } # case "ColorData"
  270. Index: WebCore/WebCore.gyp/WebCore.gyp
  271. ===================================================================
  272. --- WebCore/WebCore.gyp/WebCore.gyp (revision 61708)
  273. +++ WebCore/WebCore.gyp/WebCore.gyp (working copy)
  274. @@ -546,7 +546,6 @@
  275. '<(SHARED_INTERMEDIATE_DIR)/webkit',
  276. '<(RULE_INPUT_PATH)',
  277. ],
  278. - 'process_outputs_as_sources': 0,
  279. },
  280. # Rule to build generated JavaScript (V8) bindings from .idl source.
  281. {
  282. @@ -653,6 +652,13 @@
  283. # Additional .cpp files from the webcore_bindings_sources rules.
  284. '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSGrammar.cpp',
  285. '<(SHARED_INTERMEDIATE_DIR)/webkit/XPathGrammar.cpp',
  286. +
  287. + # Additional .cpp files for HashTools.h
  288. + '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLEntityNames.cpp',
  289. + '<(SHARED_INTERMEDIATE_DIR)/webkit/DocTypeStrings.cpp',
  290. + '<(SHARED_INTERMEDIATE_DIR)/webkit/ColorData.cpp',
  291. + '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSPropertyNames.cpp',
  292. + '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSValueKeywords.cpp',
  293. ],
  294. 'conditions': [
  295. ['javascript_engine=="v8"', {
  296. Index: WebCore/WebCore.xcodeproj/project.pbxproj
  297. ===================================================================
  298. --- WebCore/WebCore.xcodeproj/project.pbxproj (revision 61708)
  299. +++ WebCore/WebCore.xcodeproj/project.pbxproj (working copy)
  300. @@ -458,6 +458,11 @@
  301. 1AB7FC860A8B92EC00D9D37B /* XPathValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7FC650A8B92EC00D9D37B /* XPathValue.h */; };
  302. 1AB7FC870A8B92EC00D9D37B /* XPathVariableReference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7FC660A8B92EC00D9D37B /* XPathVariableReference.cpp */; };
  303. 1AB7FC880A8B92EC00D9D37B /* XPathVariableReference.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7FC670A8B92EC00D9D37B /* XPathVariableReference.h */; };
  304. + 1ABA76C911D20E47004C201C /* ColorData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E406F3FB1198307D009D59D6 /* ColorData.cpp */; };
  305. + 1ABA76CA11D20E50004C201C /* CSSPropertyNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41EA038119836DB00710BC5 /* CSSPropertyNames.cpp */; };
  306. + 1ABA76CB11D20E57004C201C /* CSSValueKeywords.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */; };
  307. + 1ABA76CC11D20E5B004C201C /* DocTypeStrings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E406F3FA1198304D009D59D6 /* DocTypeStrings.cpp */; };
  308. + 1ABA77FD11D21031004C201C /* HTMLEntityNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E406F4021198329A009D59D6 /* HTMLEntityNames.cpp */; };
  309. 1ABFE7530CD968D000FE4834 /* SQLTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ABFE7520CD968D000FE4834 /* SQLTransaction.cpp */; };
  310. 1AC2260C0DB69F190089B669 /* JSDOMApplicationCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC2260A0DB69F190089B669 /* JSDOMApplicationCache.cpp */; };
  311. 1AC2260D0DB69F190089B669 /* JSDOMApplicationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC2260B0DB69F190089B669 /* JSDOMApplicationCache.h */; };
  312. @@ -21845,6 +21850,11 @@
  313. 1AD8F81C11CAB9E900E93E54 /* PlatformStrategies.cpp in Sources */,
  314. B525A96611CA2340003A23A8 /* JSSQLException.cpp in Sources */,
  315. A8E6A78211D1661B00311F4A /* HTMLParserScheduler.cpp in Sources */,
  316. + 1ABA76C911D20E47004C201C /* ColorData.cpp in Sources */,
  317. + 1ABA76CA11D20E50004C201C /* CSSPropertyNames.cpp in Sources */,
  318. + 1ABA76CB11D20E57004C201C /* CSSValueKeywords.cpp in Sources */,
  319. + 1ABA76CC11D20E5B004C201C /* DocTypeStrings.cpp in Sources */,
  320. + 1ABA77FD11D21031004C201C /* HTMLEntityNames.cpp in Sources */,
  321. );
  322. runOnlyForDeploymentPostprocessing = 0;
  323. };
  324. Index: WebCore/css/CSSParser.cpp
  325. ===================================================================
  326. --- WebCore/css/CSSParser.cpp (revision 61708)
  327. +++ WebCore/css/CSSParser.cpp (working copy)
  328. @@ -61,6 +61,7 @@
  329. #include "FloatConversion.h"
  330. #include "FontFamilyValue.h"
  331. #include "FontValue.h"
  332. +#include "HashTools.h"
  333. #include "MediaList.h"
  334. #include "MediaQueryExp.h"
  335. #include "Pair.h"
  336. @@ -88,9 +89,6 @@ extern int cssyyparse(void* parser);
  337. using namespace std;
  338. using namespace WTF;
  339.  
  340. -#include "CSSPropertyNames.cpp"
  341. -#include "CSSValueKeywords.cpp"
  342. -
  343. namespace WebCore {
  344.  
  345. static const unsigned INVALID_NUM_PARSED_PROPERTIES = UINT_MAX;
  346. Index: WebCore/css/makeprop.pl
  347. ===================================================================
  348. --- WebCore/css/makeprop.pl (revision 61708)
  349. +++ WebCore/css/makeprop.pl (working copy)
  350. @@ -41,15 +41,14 @@ print GPERF << "EOF";
  351. #include \"CSSPropertyNames.h\"
  352. %}
  353. %struct-type
  354. -struct Property {
  355. - const char* name;
  356. - int id;
  357. -};
  358. -%language=ANSI-C
  359. +struct Property;
  360. +%omit-struct-type
  361. +%language=C++
  362. %readonly-tables
  363. %global-table
  364. %compare-strncmp
  365. -%define lookup-function-name findProperty
  366. +%define class-name CSSPropertyNamesHash
  367. +%define lookup-function-name findPropertyImpl
  368. %define hash-function-name propery_hash_function
  369. %define word-array-name property_wordlist
  370. %includes
  371. @@ -72,6 +71,10 @@ print HEADER << "EOF";
  372. #ifndef CSSPropertyNames_h
  373. #define CSSPropertyNames_h
  374.  
  375. +#include <string.h>
  376. +
  377. +namespace WebCore {
  378. +
  379. enum CSSPropertyID {
  380. CSSPropertyInvalid = 0,
  381. EOF
  382. @@ -99,15 +102,17 @@ print HEADER << "EOF";
  383.  
  384. const char* getPropertyName(CSSPropertyID);
  385.  
  386. +} // namespace WebCore
  387. +
  388. #endif // CSSPropertyNames_h
  389.  
  390. EOF
  391.  
  392. close HEADER;
  393.  
  394. -system("gperf --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf > CSSPropertyNames.cpp") == 0 || die "calling gperf failed: $?";
  395. +system("gperf --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf > CSSPropertyNamesHash.h") == 0 || die "calling gperf failed: $?";
  396.  
  397. -open C, ">>CSSPropertyNames.cpp" || die "Could not open CSSPropertyNames.cpp for writing";
  398. +open C, ">>CSSPropertyNamesHash.h" || die "Could not open CSSPropertyNamesHash.h for writing";
  399. print C "static const char * const propertyNameStrings[$num] = {\n";
  400.  
  401. foreach my $name (@names) {
  402. @@ -116,6 +121,29 @@ foreach my $name (@names) {
  403.  
  404. print C << "EOF";
  405. };
  406. +
  407. +EOF
  408. +
  409. +close C;
  410. +
  411. +my $propertyNamesImpl = "CSSPropertyNames.cpp";
  412. +
  413. +open PROPERTYNAMES, ">$propertyNamesImpl" || die "Could not open $propertyNamesImpl for writing";
  414. +print PROPERTYNAMES << "EOF";
  415. +/* This file is automatically generated by make-hash-tools.pl, do not edit */
  416. +
  417. +
  418. +#include "CSSPropertyNames.h"
  419. +#include "HashTools.h"
  420. +
  421. +namespace WebCore {
  422. +#include "CSSPropertyNamesHash.h"
  423. +
  424. +const Property* findProperty (register const char* str, register unsigned int len)
  425. +{
  426. + return CSSPropertyNamesHash::findPropertyImpl(str, len);
  427. +}
  428. +
  429. const char* getPropertyName(CSSPropertyID id)
  430. {
  431. if (id < firstCSSProperty)
  432. @@ -125,7 +153,10 @@ const char* getPropertyName(CSSPropertyI
  433. return 0;
  434. return propertyNameStrings[index];
  435. }
  436. +
  437. +} // namespace WebCore
  438. +
  439. EOF
  440.  
  441. -close C;
  442. +close PROPERTYNAMES;
  443.  
  444. Index: WebCore/css/makevalues.pl
  445. ===================================================================
  446. --- WebCore/css/makevalues.pl (revision 61708)
  447. +++ WebCore/css/makevalues.pl (working copy)
  448. @@ -42,14 +42,13 @@ print GPERF << "EOF";
  449. #include \"CSSValueKeywords.h\"
  450. %}
  451. %struct-type
  452. -struct Value {
  453. - const char* name;
  454. - int id;
  455. -};
  456. -%language=ANSI-C
  457. +struct Value;
  458. +%omit-struct-type
  459. +%language=C++
  460. %readonly-tables
  461. %compare-strncmp
  462. -%define lookup-function-name findValue
  463. +%define class-name CSSValueKeywordsHash
  464. +%define lookup-function-name findValueImpl
  465. %define hash-function-name value_hash_function
  466. %define word-array-name value_word_list
  467. %includes
  468. @@ -72,6 +71,10 @@ print HEADER << "EOF";
  469. #ifndef CSSValueKeywords_h
  470. #define CSSValueKeywords_h
  471.  
  472. +#include <string.h>
  473. +
  474. +namespace WebCore {
  475. +
  476. const int CSSValueInvalid = 0;
  477. EOF
  478.  
  479. @@ -92,13 +95,16 @@ print HEADER << "EOF";
  480.  
  481. const char* getValueName(unsigned short id);
  482.  
  483. +} // namespace WebCore
  484. +
  485. #endif // CSSValueKeywords_h
  486. +
  487. EOF
  488. close HEADER;
  489.  
  490. -system("gperf --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf > CSSValueKeywords.cpp") == 0 || die "calling gperf failed: $?";
  491. +system("gperf --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf > CSSValueKeywordsHash.h") == 0 || die "calling gperf failed: $?";
  492.  
  493. -open C, ">>CSSValueKeywords.cpp" || die "Could not open CSSValueKeywords.cpp for writing";
  494. +open C, ">>CSSValueKeywordsHash.h" || die "Could not open CSSValueKeywordsHash.h for writing";
  495. print C "static const char * const valueList[] = {\n";
  496. print C "\"\",\n";
  497. foreach my $name (@names) {
  498. @@ -107,12 +113,38 @@ foreach my $name (@names) {
  499. print C << "EOF";
  500. 0
  501. };
  502. +
  503. +EOF
  504. +
  505. +close C;
  506. +
  507. +my $valueKeywordsImpl = "CSSValueKeywords.cpp";
  508. +
  509. +open VALUEKEYWORDS, ">$valueKeywordsImpl" || die "Could not open $valueKeywordsImpl for writing";
  510. +print VALUEKEYWORDS << "EOF";
  511. +/* This file is automatically generated by make-hash-tools.pl, do not edit */
  512. +
  513. +#include "CSSValueKeywords.h"
  514. +#include "HashTools.h"
  515. +
  516. +namespace WebCore {
  517. +#include "CSSValueKeywordsHash.h"
  518. +
  519. +const Value* findValue (register const char* str, register unsigned int len)
  520. +{
  521. + return CSSValueKeywordsHash::findValueImpl(str, len);
  522. +}
  523. +
  524. const char* getValueName(unsigned short id)
  525. {
  526. if (id >= numCSSValueKeywords || id <= 0)
  527. return 0;
  528. return valueList[id];
  529. }
  530. +
  531. +} // namespace WebCore
  532. +
  533. EOF
  534.  
  535. -close C;
  536. +close VALUEKEYWORDS;
  537. +
  538. Index: WebCore/html/DocTypeStrings.gperf
  539. ===================================================================
  540. --- WebCore/html/DocTypeStrings.gperf (revision 61708)
  541. +++ WebCore/html/DocTypeStrings.gperf (working copy)
  542. @@ -1,21 +1,13 @@
  543. %struct-type
  544. -struct PubIDInfo {
  545. - enum eMode {
  546. - eQuirks,
  547. - eQuirks3,
  548. - eAlmostStandards
  549. - };
  550. -
  551. - const char* name;
  552. - eMode mode_if_no_sysid;
  553. - eMode mode_if_sysid;
  554. -}
  555. -%language=ANSI-C
  556. +struct PubIDInfo;
  557. +%omit-struct-type
  558. +%language=C++
  559. %readonly-tables
  560. %global-table
  561. %compare-strncmp
  562. +%define class-name DocTypeStringsHash
  563. %define initializer-suffix ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards
  564. -%define lookup-function-name findDoctypeEntry
  565. +%define lookup-function-name findDoctypeEntryImpl
  566. %define hash-function-name doctype_hash_function
  567. %includes
  568. %enum
  569. Index: WebCore/html/HTMLDocument.cpp
  570. ===================================================================
  571. --- WebCore/html/HTMLDocument.cpp (revision 61708)
  572. +++ WebCore/html/HTMLDocument.cpp (working copy)
  573. @@ -64,6 +64,7 @@
  574. #include "FrameLoader.h"
  575. #include "FrameTree.h"
  576. #include "FrameView.h"
  577. +#include "HashTools.h"
  578. #include "HTMLDocumentParser.h"
  579. #include "HTMLBodyElement.h"
  580. #include "HTMLElementFactory.h"
  581. @@ -75,8 +76,6 @@
  582. #include "Settings.h"
  583. #include <wtf/text/CString.h>
  584.  
  585. -#include "DocTypeStrings.cpp"
  586. -
  587. namespace WebCore {
  588.  
  589. using namespace HTMLNames;
  590. Index: WebCore/html/HTMLEntityNames.gperf
  591. ===================================================================
  592. --- WebCore/html/HTMLEntityNames.gperf (revision 61708)
  593. +++ WebCore/html/HTMLEntityNames.gperf (working copy)
  594. @@ -25,16 +25,16 @@
  595. */
  596. %}
  597. %struct-type
  598. -struct Entity {
  599. - const char *name;
  600. - int code;
  601. -};
  602. -%language=ANSI-C
  603. +struct Entity;
  604. +%language=C++
  605. +%omit-struct-type
  606. %readonly-tables
  607. %global-table
  608. %compare-strncmp
  609. -%define lookup-function-name findEntity
  610. +%define class-name HTMLEntityHash
  611. +%define lookup-function-name findEntityImpl
  612. %define hash-function-name entity_hash_function
  613. +%define word-array-name entity_wordlist
  614. %includes
  615. %enum
  616. %%
  617. Index: WebCore/html/HTMLEntityParser.cpp
  618. ===================================================================
  619. --- WebCore/html/HTMLEntityParser.cpp (revision 61708)
  620. +++ WebCore/html/HTMLEntityParser.cpp (working copy)
  621. @@ -28,21 +28,9 @@
  622. #include "config.h"
  623. #include "HTMLEntityParser.h"
  624.  
  625. +#include "HashTools.h"
  626. #include <wtf/Vector.h>
  627.  
  628. -// Use __GNUC__ instead of PLATFORM(GCC) to stay consistent with the gperf generated c file
  629. -#ifdef __GNUC__
  630. -// The main parser includes this too so we are getting two copies of the data. However, this way the code gets inlined.
  631. -#include "HTMLEntityNames.cpp"
  632. -#else
  633. -// Not inlined for non-GCC compilers
  634. -struct Entity {
  635. - const char* name;
  636. - int code;
  637. -};
  638. -const struct Entity* findEntity(register const char* str, register unsigned int len);
  639. -#endif
  640. -
  641. using namespace WTF;
  642.  
  643. namespace WebCore {
  644. Index: WebCore/html/LegacyHTMLDocumentParser.cpp
  645. ===================================================================
  646. --- WebCore/html/LegacyHTMLDocumentParser.cpp (revision 61708)
  647. +++ WebCore/html/LegacyHTMLDocumentParser.cpp (working copy)
  648. @@ -39,6 +39,7 @@
  649. #include "Frame.h"
  650. #include "FrameLoader.h"
  651. #include "FrameView.h"
  652. +#include "HashTools.h"
  653. #include "HTMLElement.h"
  654. #include "HTMLNames.h"
  655. #include "LegacyHTMLTreeBuilder.h"
  656. @@ -54,8 +55,6 @@
  657. #include <wtf/ASCIICType.h>
  658. #include <wtf/CurrentTime.h>
  659.  
  660. -#include "HTMLEntityNames.cpp"
  661. -
  662. #define PRELOAD_SCANNER_ENABLED 1
  663.  
  664. using namespace WTF;
  665. Index: WebCore/html/LegacyPreloadScanner.cpp
  666. ===================================================================
  667. --- WebCore/html/LegacyPreloadScanner.cpp (revision 61708)
  668. +++ WebCore/html/LegacyPreloadScanner.cpp (working copy)
  669. @@ -38,25 +38,13 @@
  670. #include "Document.h"
  671. #include "Frame.h"
  672. #include "FrameLoader.h"
  673. +#include "HashTools.h"
  674. #include "HTMLLinkElement.h"
  675. #include "HTMLNames.h"
  676. #include <wtf/text/CString.h>
  677. #include <wtf/CurrentTime.h>
  678. #include <wtf/unicode/Unicode.h>
  679.  
  680. -// Use __GNUC__ instead of PLATFORM(GCC) to stay consistent with the gperf generated c file
  681. -#ifdef __GNUC__
  682. -// The main tokenizer includes this too so we are getting two copies of the data. However, this way the code gets inlined.
  683. -#include "HTMLEntityNames.cpp"
  684. -#else
  685. -// Not inlined for non-GCC compilers
  686. -struct Entity {
  687. - const char* name;
  688. - int code;
  689. -};
  690. -const struct Entity* findEntity(register const char* str, register unsigned int len);
  691. -#endif
  692. -
  693. #define PRELOAD_DEBUG 0
  694.  
  695. using namespace WTF;
  696. Index: WebCore/platform/ColorData.gperf
  697. ===================================================================
  698. --- WebCore/platform/ColorData.gperf (revision 61708)
  699. +++ WebCore/platform/ColorData.gperf (working copy)
  700. @@ -1,13 +1,12 @@
  701. %struct-type
  702. -struct NamedColor {
  703. - const char *name;
  704. - int RGBValue;
  705. -};
  706. -%language=ANSI-C
  707. +struct NamedColor;
  708. +%omit-struct-type
  709. +%language=C++
  710. %readonly-tables
  711. %global-table
  712. %compare-strncmp
  713. -%define lookup-function-name findColor
  714. +%define class-name ColorDataHash
  715. +%define lookup-function-name findColorImpl
  716. %define hash-function-name colordata_hash_function
  717. %includes
  718. %enum
  719. Index: WebCore/platform/graphics/Color.cpp
  720. ===================================================================
  721. --- WebCore/platform/graphics/Color.cpp (revision 61708)
  722. +++ WebCore/platform/graphics/Color.cpp (working copy)
  723. @@ -26,13 +26,12 @@
  724. #include "config.h"
  725. #include "Color.h"
  726.  
  727. +#include "HashTools.h"
  728. #include "PlatformString.h"
  729. #include <math.h>
  730. #include <wtf/Assertions.h>
  731. #include <wtf/MathExtras.h>
  732.  
  733. -#include "ColorData.cpp"
  734. -
  735. using namespace std;
  736. using namespace WTF;
  737.  
  738. Index: WebKit/chromium/ChangeLog
  739. ===================================================================
  740. --- WebKit/chromium/ChangeLog (revision 61708)
  741. +++ WebKit/chromium/ChangeLog (working copy)
  742. @@ -1,3 +1,21 @@
  743. +2010-06-23 Andras Becsi <abecsi@webkit.org>
  744. +
  745. + Reviewed by NOBODY (OOPS!).
  746. +
  747. + Undefined reference errors when linking due to gperf and inlining.
  748. + webkit.org/b/29244
  749. +
  750. + Refactor gperf code generation and usage to fix the debug build with gcc>4.4.
  751. + Hitherto gperf generated C code, these files were included in multiple C++ files across WebCore
  752. + to access the functionality provided. This resulted in debug build failure with newer gcc versions
  753. + because of a behaviour change of gcc, which disables C style inlining in debug mode.
  754. + The make-hash-tools.pl script lets gperf generate C++ code for all gperf files now, which are compiled
  755. + in their own compilation unit.
  756. + The functionality provided by the generated code is wrapped behind HashTools.h, so there is no need
  757. + for multiple inclusions of generated C files to access these functions.
  758. +
  759. + * src/WebEntities.cpp:
  760. +
  761. 2010-06-23 Yuzo Fujishima <yuzo@google.com>
  762.  
  763. Reviewed by Shinichiro Hamaji.
  764. Index: WebKit/chromium/src/WebEntities.cpp
  765. ===================================================================
  766. --- WebKit/chromium/src/WebEntities.cpp (revision 61708)
  767. +++ WebKit/chromium/src/WebEntities.cpp (working copy)
  768. @@ -31,9 +31,9 @@
  769. #include "config.h"
  770. #include "WebEntities.h"
  771.  
  772. -#include <string.h>
  773. -
  774. +#include "HashTools.h"
  775. #include "PlatformString.h"
  776. +#include <string.h>
  777. #include "StringBuilder.h"
  778. #include <wtf/HashMap.h>
  779.  
  780. @@ -41,15 +41,6 @@
  781.  
  782. using namespace WebCore;
  783.  
  784. -namespace {
  785. -// Note that this file is also included by LegacyHTMLDocumentParser.cpp so we are getting
  786. -// two copies of the data in memory. We can fix this by changing the script
  787. -// that generated the array to create a static const that is its length, but
  788. -// this is low priority since the data is less than 4K. We use anonymous
  789. -// namespace to prevent name collisions.
  790. -#include "HTMLEntityNames.cpp" // NOLINT
  791. -}
  792. -
  793. namespace WebKit {
  794.  
  795. void populateMap(WTF::HashMap<int, WebCore::String>& map,
  796. @@ -91,8 +82,8 @@ WebEntities::WebEntities(bool xmlEntitie
  797. false);
  798. else
  799. populateMap(m_entitiesMap,
  800. - wordlist,
  801. - sizeof(wordlist) / sizeof(Entity),
  802. + wordList(),
  803. + wordListSize(),
  804. true);
  805. }
  806.  
  807. Index: WebKit/qt/ChangeLog
  808. ===================================================================
  809. --- WebKit/qt/ChangeLog (revision 61708)
  810. +++ WebKit/qt/ChangeLog (working copy)
  811. @@ -1,3 +1,22 @@
  812. +2010-06-23 Andras Becsi <abecsi@webkit.org>
  813. +
  814. + Reviewed by NOBODY (OOPS!).
  815. +
  816. + Undefined reference errors when linking due to gperf and inlining.
  817. + webkit.org/b/29244
  818. +
  819. + Refactor gperf code generation and usage to fix the debug build with gcc>4.4.
  820. + Hitherto gperf generated C code, these files were included in multiple C++ files across WebCore
  821. + to access the functionality provided. This resulted in debug build failure with newer gcc versions
  822. + because of a behaviour change of gcc, which disables C style inlining in debug mode.
  823. + The make-hash-tools.pl script lets gperf generate C++ code for all gperf files now, which are compiled
  824. + in their own compilation unit.
  825. + The functionality provided by the generated code is wrapped behind HashTools.h, so there is no need
  826. + for multiple inclusions of generated C files to access these functions.
  827. +
  828. + * WebCoreSupport/FrameLoaderClientQt.cpp:
  829. + (WebCore::FrameLoaderClientQt::createPlugin):
  830. +
  831. 2010-06-23 David Boddie <dboddie@trolltech.com>
  832.  
  833. Reviewed by Simon Hausmann.
  834. Index: WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
  835. ===================================================================
  836. --- WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp (revision 61708)
  837. +++ WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp (working copy)
  838. @@ -1322,7 +1322,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::
  839. for (unsigned i = 0; i < numqStyleSheetProperties; ++i) {
  840. CSSPropertyID property = qstyleSheetProperties[i];
  841.  
  842. - styleSheet += QString::fromLatin1(::getPropertyName(property));
  843. + styleSheet += QString::fromLatin1(getPropertyName(property));
  844. styleSheet += QLatin1Char(':');
  845. styleSheet += computedStyle(element)->getPropertyValue(property);
  846. styleSheet += QLatin1Char(';');
Add Comment
Please, Sign In to add comment