Skip to content

Fix -Wdeprecated-builtins warnings about __has_trivial_destructor#11

Open
cpeterso wants to merge 1 commit intojamienicol:masterfrom
cpeterso:is_trivially_destructible
Open

Fix -Wdeprecated-builtins warnings about __has_trivial_destructor#11
cpeterso wants to merge 1 commit intojamienicol:masterfrom
cpeterso:is_trivially_destructible

Conversation

@cpeterso
Copy link

@cpeterso cpeterso commented Jul 8, 2024

warning: glsl-optimizer/src/compiler/glsl/list.h:58:4: warning: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Wdeprecated-builtins] ...
warning: glsl-optimizer/src/util/macros.h:195:44: note: expanded from macro 'HAS_TRIVIAL_DESTRUCTOR'
warning:   195 | #         define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
warning:       |                                            ^

clang recommends replacing __has_trivial_destructor with __is_trivially_destructible, but we can use C++11's standard std::is_trivially_destructible directly; it's been available in clang and gcc since 2013 (clang 3.3 and gcc 4.8) and at least MSVC 2019.

https://en.cppreference.com/w/cpp/types/is_destructible

warning: glsl-optimizer/src/compiler/glsl/list.h:58:4: warning: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Wdeprecated-builtins]
...
warning: glsl-optimizer/src/util/macros.h:195:44: note: expanded from macro 'HAS_TRIVIAL_DESTRUCTOR'
warning:   195 | #         define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
warning:       |                                            ^

clang recommends replacing __has_trivial_destructor with __is_trivially_destructible, but we can use C++11's standard std::is_trivially_destructible directly; it's been available in clang and gcc since 2013 (clang 3.3 and gcc 4.8) and at least MSVC 2019.

https://en.cppreference.com/w/cpp/types/is_destructible
@cpeterso
Copy link
Author

cpeterso commented Jul 8, 2024

This change isn't necessary for C++23 support, but it silences literally thousands of lines of warning spam when building Firefox.

@jamienicol
Copy link
Owner

jamienicol commented Feb 20, 2026

Again like in #10, let's strive to use the same fix upstream did: https://gitlab.freedesktop.org/mesa/mesa/-/commit/1980827aeb40725a57db6c2d79cc5323898631b9

Does that solve the warnings for us?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants