Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a compile error with Clang on Windows in Release build #18552

Merged

Conversation

mprettner-huawei
Copy link
Contributor

What does this PR do?

This PR fixes a compile error that occurs when compiling the engine with Clang on Windows in a release build. The locally defined function GetLastErrorString() is only used as parameter to AZ_Assert, meaning it is not called in release builds, which leads to a unused function warning.

How was this PR tested?

Compile with Clang on Windows with Release configuration

@mprettner-huawei mprettner-huawei requested a review from a team as a code owner December 12, 2024 11:56
@@ -29,7 +29,7 @@ namespace AzQtComponents

namespace
{
std::string GetLastErrorString()
[[maybe_unused]] std::string GetLastErrorString()
Copy link
Contributor

@spham-amzn spham-amzn Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but you can squeeze a little bit more build optimization be wrapping this function inside a #if defined(AZ_ENABLE_TRACING) block. This is based on this function only existing inside the AZ_Asserts in this method.

@lsemp3d lsemp3d merged commit 2a05e22 into o3de:development Dec 14, 2024
3 checks passed
DrogonMar pushed a commit to DrogonMar/o3de that referenced this pull request Dec 20, 2024
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.

3 participants