Should we use -fno-c++-static-destructors? |
|
Issue descriptionclang grew a flag that disables calling C++ destructors at program turndown time: https://reviews.llvm.org/rL340306 Should we use it? It's somewhat similar to the very old desire to just _exit(0) at exit time. Since we shouldn't lose data on crashes either, turning this on should be safe-ish (modulo data loss bugs on crashes). cc'ing some folks from "[chromium-dev] Should we stop supporting clean shutdown in Chrome? [was: How does Chrome shutdown work on Android?]"
,
Sep 17
The break compile flag for this is -Wexit-time-destructors. Tracked in issue 801563. I agree with Peter that it's preferable to remove static destructors then to silence them out.
,
Sep 17
-Wexit-time-destructors is actually 101600 from 7 years ago. I agree it's a nicer approach in theory, but in practice it's not getting done. So we could hope that things look better in the next 7 years, or we could add that flag and see what happens :-)
,
Sep 17
For instance, r529233 caused issue 805443 merely by terminating-process at the very end of main() (i.e. only skipping static destructors) because it prevented logging destructors from completing flushes (which broke chrome --version on CrOS)... (I never got back around to another try on that one but I suspect -fno-c++-static-destructors would regress that)
,
Sep 17
If there are a handful of mission-critical dtors, we could annotation them with [[clang::always_destroy]], turn on the flag, and then work on removing those over time. |
|
►
Sign in to add a comment |
|
Comment 1 by pkasting@chromium.org
, Sep 17