Unsafe C++11 Attributes

Developers should use C++11 attributes inside an enclave with care. The attribute noreturn, in particular, may cause a potencial security risk. For instance, if a trusted function calls a noreturn function any clean-up code placed after the function call will be ignored.

[noreturn]]void foo(parameters…)
{
    ...
}
int ecall_function(parameters…)
{
    ...
    foo(...);
    // Clean-up code below will be ignored
    ...
    return 0;
}
For more complete information about compiler optimizations, see our Optimization Notice.