Given the `_fxsave()` function returning `void`, it is invalid C but valid C++:

# WG14 N1256 (C99) / N1570 (C11)
6.8.6.4 The return statement
Constraints
1 A return statement with an expression shall not appear in a function
whose return type is void. ...

# WG21 N1804 (C++03)
6.6.3 The return statement [stmt.return]
3 A return statement with an expression of type “cv void” can be used
only in functions with a return type of cv void; the expression
is evaluated just before the function returns to its caller.

# WG21 N4582 (C++1z)
6.6.3 The return statement [stmt.return]
2 ... A return statement with an operand of type void shall be used
only in a function whose return type is cv void. ...


------------------                               
Best regards,
lh_mouse
2016-08-19

-------------------------------------------------------------
发件人:David Wohlferd <d...@limegreensocks.com>
发送日期:2016-08-19 11:51
收件人:gcc@gcc.gnu.org
抄送:
主题:fxsrintrin.h

According to the docs 
(https://gcc.gnu.org/onlinedocs/gcc/x86-Built-in-Functions.html), 
__builtin_ia32_fxsave() has return type 'void.'  Given that, does this 
code (from gcc/config/i386/fxsrintrin.h) make sense?

     _fxsave (void *__P)
     {
       return __builtin_ia32_fxsave (__P);
     }

Returning a void?  Is that a thing?  Similar question for _fxrstor, 
_fxsave64, and _fxrstor64.

And again in xsaveintrin.h for _xsave, _xrstor, _xsave64 and _xrstor64?

dw



Reply via email to