Mangling: grammar too permissive

Martin von Loewis loewis at informatik.hu-berlin.de
Mon Mar 27 13:48:02 UTC 2000


After reviewing today's mangling grammar, I found that it allows a
number of constructions that can't possibly appear, and that can be
easily correct in the grammar:

1. <substitution> in <qualified name>: This allows <nested-names> of
   NSi_E, where i is either a letter or a (base-36) digit. I think
   this cannot, or should not, occur: If you can substitute the entire
   <qualified-name>, you should use Si_ instead.

   Solution: Remove <substitution> alternative in <qualified name>

2. extra alternatives in <encoding-type>: In all cases where an
   encoding-type can occur, it always identifies a
   bare-function-type; it never is a type or a substitution on its
   own. Therefore, I propose to remove the encoding-type, and replace
   its two occurences with bare-function-type.

3. extern "C" allowed at toplevel. The grammar allows _Z3fooYi, which
   would be extern "C" ??? foo(int). However (as the text points out),
   that would be mangled as "foo", so it cannot happen.
   Solution: Move [Y] from <bare-function-type> into <function-type>.

Regards,
Martin




More information about the cxx-abi-dev mailing list