WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
154162
GCC buildfix in Source/WebCore/svg/SVGToOTFFontConversion.cpp
https://bugs.webkit.org/show_bug.cgi?id=154162
Summary
GCC buildfix in Source/WebCore/svg/SVGToOTFFontConversion.cpp
Csaba Osztrogonác
Reported
2016-02-12 04:20:16 PST
build error: ../../Source/WebCore/svg/SVGToOTFFontConversion.cpp: In member function 'size_t WebCore::SVGToOTFFontConverter::finishAppendingKERNSubtable(WTF::Vector<WebCore::SVGToOTFFontConverter::KerningData>, uint16_t)': ../../Source/WebCore/svg/SVGToOTFFontConversion.cpp:1100:30: error: use of 'kerningData' before deduction of 'auto' Source/WebCore/svg/SVGToOTFFontConversion.cpp: ... for (auto& kerningData : kerningData) { append16(kerningData.glyph1); append16(kerningData.glyph2); append16(kerningData.adjustment); } ... GCC can't handle properly if we use the same variable name in range declaration as in range expression of range-based for loop. (tested with GCC 4.9 and 5.2 too.) The simplest workaround is renaming one of the variable. Explicit type declaration isn't enough for GCC. We needed the same workaround previously -
bug151622
.
Attachments
Patch
(1.83 KB, patch)
2016-02-12 04:22 PST
,
Csaba Osztrogonác
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Csaba Osztrogonác
Comment 1
2016-02-12 04:22:57 PST
Created
attachment 271164
[details]
Patch
Csaba Osztrogonác
Comment 2
2016-02-12 04:52:36 PST
I don't like at all to use the same variable name for the element and for the collection in range-based for loop, but I think it is a GCC bug, so I reported it:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69784
Andreas Kling
Comment 3
2016-02-12 05:23:37 PST
Comment on
attachment 271164
[details]
Patch huh!
Csaba Osztrogonác
Comment 4
2016-02-12 05:52:11 PST
Comment on
attachment 271164
[details]
Patch Clearing flags on attachment: 271164 Committed
r196469
: <
http://trac.webkit.org/changeset/196469
>
Csaba Osztrogonác
Comment 5
2016-02-12 05:52:16 PST
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 6
2016-02-12 08:45:16 PST
Comment on
attachment 271164
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=271164&action=review
> Source/WebCore/svg/SVGToOTFFontConversion.cpp:1104 > + for (auto& kerningDataElement : kerningData) { > + append16(kerningDataElement.glyph1); > + append16(kerningDataElement.glyph2); > + append16(kerningDataElement.adjustment); > }
I’m happy with this fix. However, I wanted to point out for future reference in WebKit coding style that when a variable has really small scope like this, it’s often good practice to give it a shorter name since the context makes its meaning clear without the name having to express everything. Hence, I would have named this local variable "element" or "pair" rather than using a multi-word phrase.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug