Guest User

Untitled

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