Guest User

Untitled

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