[cxx-abi-dev] Mangling for noexcept operator

John McCall rjmccall at apple.com
Tue Sep 25 09:03:03 UTC 2012


On Sep 4, 2012, at 12:24 PM, David Vandevoorde wrote:
> On Sep 4, 2012, at 2:46 PM, John McCall wrote:
>> On Sep 4, 2012, at 11:30 AM, David Vandevoorde wrote:
>>> On Sep 4, 2012, at 2:17 PM, John McCall wrote:
>>>> On Sep 4, 2012, at 6:39 AM, Mike Herrick wrote:
>>>>> We don't seem to have a mangling for the new noexcept operator.  
>>>>> 
>>>>> How's this:
>>>>> 
>>>>> <operator-name> ::= nx		# noexcept (an expression)
>>>>> 
>>>>> For example:
>>>>> 
>>>>> void f(int) noexcept;
>>>>> void f(float) throw (int);
>>>>> template <class T> auto g(T p) -> decltype((int (*)[noexcept(f(p))])0);
>>>>> int main() {
>>>>> g(1);
>>>>> }
>>>>> 
>>>>> Which would provide a mangled name of: _Z1gIiEDTcvPAnxcl1ffp_E_iLi0EET_ for g.
>>>> 
>>>> This seems like a fine mangling, but it shouldn't be an <operator-name>.
>>>> Let's just do:
>>>> <expression> ::= nx <expression>
>>> 
>>> It would be odd not to follow the pattern of sizeof and alignof here, no?
>> 
>> Heh.  I was following the pattern of typeid and throw. :)
> 
> 
> Ah yes.
> 
>> I didn't actually notice that sizeof and alignof are only <expression>s directly in the type variant.
> 
> Oops: So sizeof(type) and alignof(type) are there twice: Once under <operator-name> and once under <expression>.  :-(
> 
>>> (I can kind of see an argument to distinguish the "operators" that cannot be the basis of a <base-unresolved-name>, but I'm not sure it's worth the complication.)
>> 
>> Well, they also can't be the names of declarations, at least until the committee inevitably adds an operator sizeof. :)
>> 
>> I withdraw my tweak, although I may just move these using editorial discretion unless you really object.  Neither seems inherently less complicated, and having (e.g.) both sizeof rules in the same place has some merit.
> 
> I don't object.  It does look like some cleaning up would be nice there.

This seemed totally uncontroversial, so (after much delay) I went ahead
and committed the following patch:

commit a4fdb4282645c1ed88249ceadc4a7fc56b929402
Author: John McCall <rjmccall at apple.com>
Date:   Tue Sep 25 01:37:45 2012 -0700

    Remove the mangling entries for sizeof and alignof from the
    operators section.  Add the sizeof/alignof expression cases
    to the expressions section.  These are editorial changes.
    
    Also add Mike Herrick's proposed 'nx' mangling for noexcept.

diff --git a/abi.html b/abi.html
index fe5e72c..8262643 100644
--- a/abi.html
+++ b/abi.html
@@ -4090,10 +4090,6 @@ the first of which is lowercase.
                  ::= cl        # ()            
                  ::= ix        # []            
                  ::= qu        # ?             
-                 ::= st        # sizeof (a type)
-                 ::= sz        # sizeof (an expression)
-                  ::= at        # alignof (a type)
-                  ::= az        # alignof (an expression)
                  ::= cv <type>      # (cast)        
                  ::= v <digit> <source-name>     # vendor extended operator
 </pre></font></code>
@@ -4622,8 +4618,11 @@ arguments.
                ::= cc <type> <expression>                               # const_cast<type> (expression)
                ::= rc <type> <expression>                               # reinterpret_cast<type> (expression)
                ::= st <type>                                            # sizeof (a type)
+               ::= sz <expression>                                      # sizeof (an expression)
                ::= at <type>                                            # alignof (a type)
-               ::= <template-param>
+               ::= az <expression>                                      # alignof (an expression)
+               ::= nx <expression>                                      # noexcept (expression)
+               ::= <template-param>
                ::= <function-param>
                ::= dt <expression> <unresolved-name>                    # expr.name
                ::= pt <expression> <unresolved-name>                    # expr->name

John.


More information about the cxx-abi-dev mailing list