Summary: | Functions with C linkage should return POD types | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Filip Pizlo <fpizlo> | ||||||
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | mrowe, webkit.review.bot | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Attachments: |
|
Description
Filip Pizlo
2012-03-13 17:01:46 PDT
Created attachment 131752 [details]
the patch
Attachment 131752 [details] did not pass style-queue:
Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1
Source/JavaScriptCore/ChangeLog:3: ChangeLog entry has no bug number [changelog/bugnumber] [5]
Total errors found: 1 in 3 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 131758 [details]
the patch
Corrected the comment.
Apparently, the requirements for return types of functions with C linkage match the C++-03 definition of POD (a strict subset of aggregate types - so no C++-style members, only POD fields). The C++-11 definition has been split up into two separate concepts (trivial and standard-layout). Prior to this code we were returning standard-layout but not non-trivial (and thus not POD) classes, which is correct in C++-11 but not C++-03.
Attachment 131758 [details] did not pass style-queue:
Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1
Source/JavaScriptCore/ChangeLog:3: ChangeLog entry has no bug number [changelog/bugnumber] [5]
Total errors found: 1 in 3 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 131758 [details] the patch View in context: https://bugs.webkit.org/attachment.cgi?id=131758&action=review Looks fine to me. > Source/JavaScriptCore/ChangeLog:3 > + Need a short description and bug URL (OOPS!) Describe the problem! > Source/JavaScriptCore/dfg/DFGOperations.h:160 > +// According to C++ rules, a type used for the return signature of function with C linkage (i.e. > +// 'extern "C"') needs to be POD in the C++-03 sense: loosely speaking it must have nothing more than > +// those members that would be valid in C. This means no constructors. I don't think it's necessary to explain what a POD type is here. I'd simplify this to something like: // Since this type is used in the signature of a function declared with C linkage it must be a POD type. > Source/JavaScriptCore/llint/LLIntSlowPaths.h:44 > +// According to C++ rules, a type used for the return signature of function with C linkage (i.e. > +// 'extern "C"') needs to be POD in the C++-03 sense: loosely speaking it must have nothing more than > +// those members that would be valid in C. This means no constructors. Same comment about the comment here. Landed in http://trac.webkit.org/changeset/110651 |