Bug 88369 - Add support for malloc and alloc_size attributes
Summary: Add support for malloc and alloc_size attributes
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-05 15:38 PDT by Nuno Lopes
Modified: 2022-03-01 03:23 PST (History)
4 users (show)

See Also:


Attachments
Patch (2.38 KB, patch)
2012-06-05 15:42 PDT, Nuno Lopes
gustavo: commit-queue-
Details | Formatted Diff | Diff
Patch #2 (2.68 KB, application/octet-stream)
2012-06-05 16:19 PDT, Nuno Lopes
no flags Details
Patch #3 (2.68 KB, patch)
2012-06-05 16:24 PDT, Nuno Lopes
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nuno Lopes 2012-06-05 15:38:28 PDT
Add support for malloc and alloc_size attributes
Comment 1 Nuno Lopes 2012-06-05 15:42:42 PDT
Created attachment 145883 [details]
Patch
Comment 2 Geoffrey Garen 2012-06-05 15:44:37 PDT
Why?
Comment 3 WebKit Review Bot 2012-06-05 15:45:33 PDT
Attachment 145883 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/wtf/Co..." exit_code: 1
Source/WTF/wtf/FastMalloc.h:32:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Nuno Lopes 2012-06-05 15:48:06 PDT
(In reply to comment #2)
> Why?

The malloc attribute is used by compilers for optimizations purposes. It allows the compiler to decide that a pointer returned by such functions cannot alias anything.
The alloc_size attribute allows the compilers to emit warnings and/or add run-time instrumentation to catch buffer overflows. GCC can emit warnings based on this attribute, and clang has experimental support to instrument code to detect buffer overflows.
Comment 5 Gustavo Noronha (kov) 2012-06-05 16:01:34 PDT
Comment on attachment 145883 [details]
Patch

Attachment 145883 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/12901618
Comment 6 Build Bot 2012-06-05 16:16:18 PDT
Comment on attachment 145883 [details]
Patch

Attachment 145883 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12893708
Comment 7 Build Bot 2012-06-05 16:18:55 PDT
Comment on attachment 145883 [details]
Patch

Attachment 145883 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/12896696
Comment 8 Nuno Lopes 2012-06-05 16:19:44 PDT
Created attachment 145891 [details]
Patch #2

This new patch should fix the build for non-clang compilers.
Comment 9 Nuno Lopes 2012-06-05 16:24:11 PDT
Created attachment 145892 [details]
Patch #3

sorry for the churn. I forgot the 'patch' flag on the previous attachment.
Comment 10 WebKit Review Bot 2012-06-05 16:26:27 PDT
Attachment 145892 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/wtf/Co..." exit_code: 1
Source/WTF/wtf/FastMalloc.h:32:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.