[webkit-reviews] review requested: [Bug 68629] Enable -Wcast-align for Apple Mac port : [Attachment 108350] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 22 09:41:33 PDT 2011


David Kilzer (ddkilzer) <ddkilzer at webkit.org> has asked  for review:
Bug 68629: Enable -Wcast-align for Apple Mac port
https://bugs.webkit.org/show_bug.cgi?id=68629

Attachment 108350: Patch
https://bugs.webkit.org/attachment.cgi?id=108350&action=review

------- Additional Comments from David Kilzer (ddkilzer) <ddkilzer at webkit.org>
Reviewed by NOBODY (OOPS!).

Source/JavaScriptCore:

This fixes the following 2 errors when compiling with clang:

KeywordLookup.h:75:20:{75:20-75:59}{75:20-75:59}: error: cast from 'const UChar
*' (aka 'const unsigned short *') to 'uint32_t *' (aka 'unsigned int *')
increases required alignment from 2 to 4 [-Werror,-Wcast-align,3]
} else if (COMPARE_CHARACTERS2(code + 1, 'o', 'r')) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
KeywordLookup.h:30:7: note: instantiated from:
(((uint32_t*)(address))[0] == CHARPAIR_TOUINT32(char1, char2))
^~~~~~~~~~~~~~~~~~~~
KeywordLookup.h:82:20:{82:20-82:69}{82:20-82:69}: error: cast from 'const UChar
*' (aka 'const unsigned short *') to 'uint64_t *' (aka 'unsigned long long *')
increases required alignment from 2 to 8 [-Werror,-Wcast-align,3]
} else if (COMPARE_CHARACTERS4(code + 1, 'a', 'l', 's', 'e')) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
KeywordLookup.h:35:7: note: instantiated from:
(((uint64_t*)(address))[0] == CHARQUAD_TOUINT64(char1, char2, char3, char4))
^~~~~~~~~~~~~~~~~~~~

* Configurations/Base.xcconfig:
(WARNING_CFLAGS_BASE): Add -Wcast-align switch.
* KeywordLookupGenerator.py: Use reinterpret_cast instead of a
C-style cast since this code is only used when the CPU does not
need aligned access (per the CPU(NEEDS_ALIGNED_ACCESS) macro).

Source/JavaScriptGlue:

* Configurations/Base.xcconfig:
(WARNING_CFLAGS_BASE): Add -Wcast-align and -Wcast-qual
switches.

Source/WebCore:

This fixes the following error when compiling with clang:

WebCore/rendering/RenderLayer.cpp:128:24:{128:24-128:38}{128:34-128:38}: error:
cast from 'WebCore::ClipRects *' to 'size_t *' (aka 'unsigned long *')
increases required alignment from 4 to 8 [-Werror,-Wcast-align,3]
renderArena->free(*(size_t *)this, this);
^~~~~~~~~~~~~~

* Configurations/Base.xcconfig:
(WARNING_CFLAGS_BASE): Add -Wcast-align switch.
* rendering/RenderLayer.cpp:
(WebCore::ClipRects::destroy): Use reinterpret_cast instead of a
C-style cast.

Source/WebKit/mac:

This fixes the following error when compiling with clang:

WebKit/mac/Plugins/WebNetscapePluginPackage.mm:137:31:{137:31-137:42}{137:41-13
7:42}: error: cast from 'unsigned char *' to 'SInt16 *' (aka 'short *')
increases required alignment from 1 to 2 [-Werror,-Wcast-align,3]
if (index < 1 || index > *(SInt16 *)p)
^~~~~~~~~~~

* Configurations/Base.xcconfig:
(WARNING_CFLAGS_BASE): Add -Wcast-align and -Wcast-qual
switches.
* Plugins/WebNetscapePluginPackage.mm:
(-[WebNetscapePluginPackage stringForStringListID:andIndex:]):
Use reinterpret_cast instead of a C-style cast.

Source/WebKit2:

* Configurations/Base.xcconfig:
(WARNING_CFLAGS): Add -Wcast-align and -Wcast-qual switches.
---
 13 files changed, 92 insertions(+), 9 deletions(-)


More information about the webkit-reviews mailing list