This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fxsrintrin.h

Interesting. Seems slightly strange, but I've seen stranger. I guess it's seen as "cleaner" than forcing this into 2 statements.

IAC, it seems wrong for headers, since they can be used from either C or C++. Also, seems unnecessary here, since 'return' is implied by the fact that the 'next' statement is the end of the routine.


On 8/18/2016 10:50 PM, lhmouse wrote:
Given the `_fxsave()` function returning `void`, it is invalid C but valid C++:

# WG14 N1256 (C99) / N1570 (C11) The return statement
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,

发件人:David Wohlferd <>
发送日期:2016-08-19 11:51

According to the docs
__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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]