libexpr/primops: Suppress deprecation warning in prim_importNative
as of cl/5456 prim_importNative default constructs a `Value` in order to pass as an out parameter to a ValueInitializer function. Default construction is deprecated, but there isn't a meaningful value to initialize it to instead. After cl/5357 this will give a deprecation warning (which in an asanBuild will be an error), so this commit suppresses that warning for that `Value` construction. Change-Id: Ie567a6e81b5753672001320e9fc816c56a6a6964
This commit is contained in:
@@ -300,8 +300,16 @@ Value prim_importNative(EvalState & state, Value ** args)
|
||||
state.ctx.errors.make<EvalError>("symbol '%1%' from '%2%' resolved to NULL when a function pointer was expected", sym, path).debugThrow();
|
||||
}
|
||||
|
||||
// Default construction of `Value` is deprecated, and uses of `Value&` out parameters
|
||||
// have mostly been removed in favor of returning a `Value` instead. However in this
|
||||
// particular case, this signature (ValueInitializer defined above) is externally visible,
|
||||
// changing it would be an API breaking change, so for this one instance we just suppress
|
||||
// the warning instead.
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
Value v;
|
||||
(func)(state, v);
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
/* We don't dlclose because v may be a primop referencing a function in the shared object file */
|
||||
return v;
|
||||
|
||||
Reference in New Issue
Block a user