Closed Bug 669693 Opened 13 years ago Closed 13 years ago

Dehydra: Unhandled type_pack_expansion/decltype_type etc.

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mccr8, Assigned: jcranmer)

References

Details

Attachments

(2 files)

When running Dehydra on some files on moz-central, I get a ton of console spew: /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:67:1: warning: attribute ignored in declaration of ‘class<unnamed>::TransactionPoolEv\ entTarget’ /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:67:1: warning: attribute for ‘class<unnamed>::TransactionPoolEventTarget’ must follow\ the ‘class’ keyword /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp: In constructor ‘std::exception::exception()’: /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_pack_expansion: _ArgTypes ... /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_pack_expansion: _ArgTypes ... /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_pack_expansion: _ArgTypes ... /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_pack_expansion: _ArgTypes ... /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_pack_expansion: _ArgTypes ... /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_pack_expansion: _ArgTypes ... /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_pack_expansion: _ArgTypes ... /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_pack_expansion: _ArgTypes ... /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled decltype_type: decltype (((_Tp1)((declval<_Args1>)\ ()...), std::__sfinae_types::__one())) /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_argument_pack: _Args ... /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled decltype_type: decltype ((static_cast<_Tp1>(declva\ l<_Arg1>()), std::__sfinae_types::__one())) /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_argument_pack: _Arg /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_argument_pack: _Args ... /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_argument_pack: _From /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_argument_pack: _Tp /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_argument_pack: _Tp, _Up /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_argument_pack: _Tp, _Up, _Vp ... /home/amccreight/tm/dom/indexedDB/AsyncConnectionHelper.cpp:579:1: warning: Dehydra: Unhandled type_argument_pack: _Tp ...
In IRC, jcranmer said this probably means it isn't reifying some structure. The warning is produced in dehydra_types.c, and is on a default case in a switch on TREE_CODE (type).
TYPE_PACK_EXPANSION is defined in cp/cp-tree.def and "Represents a type expression that will be expanded into a list of types when instantiated with one or more argument packs". TYPE_ARGUMENT_PACK is defined in the same file and "Represents an argument pack of types (or templates)". I'm not really sure what that means, except that the former sounds like a type-level function, and the latter sounds like an argument for a type level function. One instance of this I found looks fairly innocuous. There's a method: unsigned size() const { return descriptors_.size(); } Where descriptors_ is defined as: std::vector<base::FileDescriptor> descriptors_; The class itself doesn't look all that weird, except that it is the subtype of a template. I'm not really sure how this would be represented in Dehydra, unless it has to cancel out the type abstraction and application somehow and create a template.
Simple test case that doesn't require STL: template <typename... A> void func(A... args) {} template <typename... B> class C {}; B... is the type_argument_pack/ A... is the type_pack_expansion.
Blocks: 568081
This also needs to be added to dehydra_types.js and lazy_types.js. A complete list of the types in gcc-4.6.1 headers and which files handle them: +---- dehydra_types.c |+--- libs/unstable/lazy_types.js ||+-- libs/unstable/dehydra_types.js ||| -- ALL xxx offset_type xxx enumeral_type xxx boolean_type xxx integer_type xxx real_type xxx pointer_type xxx reference_type nullptr_type xxx fixed_point_type xxx complex_type xxx vector_type xxx array_type xxx record_type xxx union_type qual_union_type xxx void_type xxx function_type xxx method_type lang_type -- C++ x template_template_parm xxx template_type_parm xxx typename_type xx typeof_type x bound_template_template_parm unbound_class_template type_argument_pack type_pack_expansion decltype_type -- Objective-C class_interface_type class_implementation_type category_interface_type category_implementation_type protocol_interface_type -- Ada unconstrained_array_type [Java and C family define no types] Some notes: qual_union_type [Similar to UNION_TYPE, except that the expressions in DECL_QUALIFIER in each FIELD_DECL determine what the union contains. The first field whose DECL_QUALIFIER expression is true is deemed to occupy the union.] lang_type [Unknown type that the front-end has to worry about] unbound_class_template [For template template argument of the form `T::template C'.] type_argument_pack [A collection of type arguments] type_pack_expansion [A type expression that expands into a list of types] decltype_type [Appears to be C++0x-specified clone of typeof()] [ I don't care about Objective C or Ada, just listed them for completeness ]
Apologies, the decltype only appears to be emitted if the type is parameter-dependent, e.g.: template <typename A, typename B> void f(A x, B y, decltype(x / y) z) {}
This adds support for decltype and variadic templates in dehydra_types.c, lazy_types.js, and dehydra_types.js, at least as near as I can tell.
Attachment #554897 - Flags: review?(tglek)
Comment on attachment 554897 [details] [diff] [review] Adds support for decltype, variadic templates ># HG changeset patch ># Parent 468f253e4ae71c74fae2366619693bac10c38827 > >diff --git a/dehydra_types.c b/dehydra_types.c >--- a/dehydra_types.c >+++ b/dehydra_types.c >@@ -453,16 +453,19 @@ static jsval dehydra_convert_type_cached > > break; > } > case COMPLEX_TYPE: > case VECTOR_TYPE: > /* maybe should add an isTemplateParam? */ > case TEMPLATE_TYPE_PARM: > case TYPENAME_TYPE: >+ case TYPE_ARGUMENT_PACK: >+ case TYPE_PACK_EXPANSION: >+ // FIXME: variadic templates need better support > dehydra_defineStringProperty (this, obj, NAME, dehydra_typeString(type)); > dehydra_defineProperty (this, obj, ISTYPENAME, JSVAL_TRUE); This is kinda misleading. Feels like isTypename should not be set for these new cases. > break; > case FUNCTION_TYPE: > case METHOD_TYPE: > dehydra_convertAttachFunctionType (this, obj, type); > break; > case ARRAY_TYPE: >@@ -485,16 +488,17 @@ static jsval dehydra_convert_type_cached > if (type_name) { > // what the hell else would a template be? > xassert (DECL_P (type_name)); > dehydra_defineStringProperty (this, obj, NAME, decl_as_string (type_name, 0)); > break; > } > } > case TYPEOF_TYPE: >+ case DECLTYPE_TYPE: > // avoid dealing with typeof mess > dehydra_defineStringProperty (this, obj, "typeof_not_implemented", type_as_string (type, 0)); Same here. Should not confuse decltype and typeoftype >+ elif self.lang == 'c++0x': >+ command += " -std=c++0x" > command += " -c -fplugin=../gcc_" + self.plugin + ".so -o /dev/null" > if "PLUGINS_MOZ" in config_opts: > command += ' -fplugin-arg="' + self.jsfile > argprefix = "--" > else : > command += " -fplugin-arg-gcc_" + self.plugin + "-script=" + self.jsfile > argprefix = "-fplugin-arg-gcc_" + self.plugin + "-" > for key, value in self.arguments.iteritems(): >@@ -182,29 +184,26 @@ def extractTests(filename): > arguments = spec.get('args') > if arguments is None: > arguments = {} > > langs = spec.get('lang') > if langs is None: > langs = 'c,c++' > # ignore C tests if C is not enabled >- if not 'C_SUPPORT' in config_opts: >- # ignore C only tests >- if langs == 'c': >- return [] >- # use only C++ for multiplatform tests >- langs = 'c++' >+ supported = set(['c++', 'c++0x']) >+ if 'C_SUPPORT' in config_opts: >+ supported.update('c') > langs = langs.split(',') > for lang in langs: >- if lang not in ('c', 'c++'): >+ if lang not in ('c', 'c++', 'c++0x'): not you mean if lang not in supported? Rest is good work
Attachment #554897 - Flags: review?(tglek) → review-
(In reply to Taras Glek (:taras) from comment #8) > Comment on attachment 554897 [details] [diff] [review] > Adds support for decltype, variadic templates > > ># HG changeset patch > ># Parent 468f253e4ae71c74fae2366619693bac10c38827 > > > >diff --git a/dehydra_types.c b/dehydra_types.c > >--- a/dehydra_types.c > >+++ b/dehydra_types.c > >@@ -453,16 +453,19 @@ static jsval dehydra_convert_type_cached > > > > break; > > } > > case COMPLEX_TYPE: > > case VECTOR_TYPE: > > /* maybe should add an isTemplateParam? */ > > case TEMPLATE_TYPE_PARM: > > case TYPENAME_TYPE: > >+ case TYPE_ARGUMENT_PACK: > >+ case TYPE_PACK_EXPANSION: > >+ // FIXME: variadic templates need better support > > dehydra_defineStringProperty (this, obj, NAME, dehydra_typeString(type)); > > dehydra_defineProperty (this, obj, ISTYPENAME, JSVAL_TRUE); > > This is kinda misleading. Feels like isTypename should not be set for these > new cases. As far as I can tell, the isTypename is more or less just an attribute which says "this is a template typename parameter", which the variadic pack types certainly are. > > case TYPEOF_TYPE: > >+ case DECLTYPE_TYPE: > > // avoid dealing with typeof mess > > dehydra_defineStringProperty (this, obj, "typeof_not_implemented", type_as_string (type, 0)); > > Same here. Should not confuse decltype and typeoftype As far as I can figure out, typeof and decltype are the same thing; gcc tells me to use decltype instead of typeof if you use typeof with -std=c++0x. > >- if lang not in ('c', 'c++'): > >+ if lang not in ('c', 'c++', 'c++0x'): > > not you mean if lang not in supported? If ENABLE_C_SUPPORT is not enabled, this would throw an error.
(In reply to Joshua Cranmer [:jcranmer] from comment #9) > (In reply to Taras Glek (:taras) from comment #8) > > Comment on attachment 554897 [details] [diff] [review] > > Adds support for decltype, variadic templates > > > > ># HG changeset patch > > ># Parent 468f253e4ae71c74fae2366619693bac10c38827 > > > > > >diff --git a/dehydra_types.c b/dehydra_types.c > > >--- a/dehydra_types.c > > >+++ b/dehydra_types.c > > >@@ -453,16 +453,19 @@ static jsval dehydra_convert_type_cached > > > > > > break; > > > } > > > case COMPLEX_TYPE: > > > case VECTOR_TYPE: > > > /* maybe should add an isTemplateParam? */ > > > case TEMPLATE_TYPE_PARM: > > > case TYPENAME_TYPE: > > >+ case TYPE_ARGUMENT_PACK: > > >+ case TYPE_PACK_EXPANSION: > > >+ // FIXME: variadic templates need better support > > > dehydra_defineStringProperty (this, obj, NAME, dehydra_typeString(type)); > > > dehydra_defineProperty (this, obj, ISTYPENAME, JSVAL_TRUE); > > > > This is kinda misleading. Feels like isTypename should not be set for these > > new cases. > > As far as I can tell, the isTypename is more or less just an attribute which > says "this is a template typename parameter", which the variadic pack types > certainly are. > > > > case TYPEOF_TYPE: > > >+ case DECLTYPE_TYPE: > > > // avoid dealing with typeof mess > > > dehydra_defineStringProperty (this, obj, "typeof_not_implemented", type_as_string (type, 0)); > > > > Same here. Should not confuse decltype and typeoftype > > As far as I can figure out, typeof and decltype are the same thing; gcc > tells me to use decltype instead of typeof if you use typeof with -std=c++0x. Change it to "typeof/decltype_not_implemented" and r+ on the rest
Changed the decltype thing and pushed the rest.
Assignee: nobody → Pidgeot18
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: Core → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: