Guest User

Untitled

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