remove -Wno-deprecated-declarations #744

Open
opened 2025-03-18 09:17:09 +00:00 by pennae · 6 comments
Owner

we currently build lix with -Wno-deprecated-declarations, but we'd like to turn that warning back on. right now this isn't feasible because we have a bunch of these warnings caused by our own declarations (which are rather easy to fix) and declarations from openssl, rapidcheck, and some other places. this should be easy to do, but there are many places that cause these warnings

we currently build lix with `-Wno-deprecated-declarations`, but we'd like to turn that warning back on. right now this isn't feasible because we have a bunch of these warnings caused by our own declarations (which are rather easy to fix) and declarations from openssl, rapidcheck, and some other places. this should be easy to do, but there are many places that cause these warnings
Member

This issue was mentioned on Gerrit on the following CLs:

  • comment in cl/2829 ("n-e-j: use full lix warning config")
  • commit message in cl/2934 ("libutil: use openssl EVP for hashing, address deprecated use")
  • commit message in cl/2969 ("tests: ignore deprecated uses in rapidcheck")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/2829", "number": 2829, "kind": "comment"}, {"backlink": "https://gerrit.lix.systems/c/lix/+/2934", "number": 2934, "kind": "commit message"}, {"backlink": "https://gerrit.lix.systems/c/lix/+/2969", "number": 2969, "kind": "commit message"}], "cl_meta": {"2829": {"change_title": "n-e-j: use full lix warning config"}, "2934": {"change_title": "libutil: use openssl EVP for hashing, address deprecated use"}, "2969": {"change_title": "tests: ignore deprecated uses in rapidcheck"}}} --> This issue was mentioned on Gerrit on the following CLs: * comment in [cl/2829](https://gerrit.lix.systems/c/lix/+/2829) ("n-e-j: use full lix warning config") * commit message in [cl/2934](https://gerrit.lix.systems/c/lix/+/2934) ("libutil: use openssl EVP for hashing, address deprecated use") * commit message in [cl/2969](https://gerrit.lix.systems/c/lix/+/2969) ("tests: ignore deprecated uses in rapidcheck")
Member

I was looking into this a bit.. the warnings within our code mainly stem from use of the default Value constructor. There are many easy cases (esp in tests etc) but the main tricky case I noticed was the prevalence of eval-y functions (EvalState::eval, NixRepl::evalString, EvalState::callFunction etc) writing the result to an out parameter passed by reference rather than returning it (by value).

This means there's lots of calls like Value v; state.evalFile(CanonPath(manifestFile), v); or Value v2; state.autoCallFunction(*autoArgs, v1, v2);. I'm not super clear on what the desired factoring of this would be.. all (or almost all?) of these functions seem to be void-return functions currently, so one option might be to refactor them to return their result by value instead of with an out-parameter, but I'm not sure if there's performance reasons for avoiding that?

I kinda already went ahead and tried that locally (just out of curiosity) with the functions where it's relevant for purposes of avoiding Value default constructors, and at least tests pass locally + some quick smoketests seem to work...

I was looking into this a bit.. the warnings within our code mainly stem from use of the default `Value` constructor. There are many easy cases (esp in tests etc) but the main tricky case I noticed was the prevalence of eval-y functions (`EvalState::eval`, `NixRepl::evalString`, `EvalState::callFunction` etc) writing the result to an out parameter passed by reference rather than returning it (by value). This means there's lots of calls like `Value v; state.evalFile(CanonPath(manifestFile), v);` or `Value v2; state.autoCallFunction(*autoArgs, v1, v2);`. I'm not super clear on what the desired factoring of this would be.. all (or almost all?) of these functions seem to be `void`-return functions currently, so one option might be to refactor them to return their result by value instead of with an out-parameter, but I'm not sure if there's performance reasons for avoiding that? I kinda already went ahead and tried that locally (just out of curiosity) with the functions where it's relevant for purposes of avoiding `Value` default constructors, and at least tests pass locally + some quick smoketests seem to work...
Author
Owner

having the Value-out-parameter functions return a value has indeed been tried in the past, but for reasons that were never investigated deeply we saw a noticable negative perf impact for that (cl/1626). having them return values would be awesome, but we really have to get the perf impact under control

having the Value-out-parameter functions return a value has indeed been tried in the past, but for reasons that were never investigated deeply we saw a noticable negative perf impact for that (cl/1626). having them return values would be awesome, but we really have to get the perf impact under control
Member

Wow, that's a bizarre perf regression. Was this on Clang, gcc or both?

Wow, that's a bizarre perf regression. Was this on Clang, gcc or both?
Author
Owner

don't remember. this was tested before we forbade building with gcc, so chances are high it happened on gcc

don't remember. this was tested before we forbade building with gcc, so chances are high it happened on gcc
Member

I took a stab at the perf regressions and took the liberty of forking it out into its own Forgejo issue: #792

I took a stab at the perf regressions and took the liberty of forking it out into its own Forgejo issue: https://git.lix.systems/lix-project/lix/issues/792
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#744
No description provided.