[PR #22] [MERGED] cmake: Silence warnings with clang. #1

Closed
opened 2026-01-29 19:05:59 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/stenzek/duckstation/pull/22
Author: @orbea
Created: 2/12/2020
Status: Merged
Merged: 2/13/2020
Merged by: @stenzek

Base: masterHead: clang


📝 Commits (1)

  • 0c05ad4 cmake: Silence warnings with clang.

📊 Changes

2 files changed (+12 additions, -7 deletions)

View changed files

📝 CMakeLists.txt (+4 -7)
CMakeModules/CheckCXXFlag.cmake (+8 -0)

📄 Description

This adds a check_cxx_flag function to CMakeModules/CheckCXXFlag.cmake designed to make it easier to check compiler flags across the build system and implemented for the existing -Wall check, -Wno-class-memaccess and -Wno-invalid-offsetof. There may be other places this can be used, but I think this is enough for now.

I also removed the existing msg for enabling -Wall because cmake seems adequate to informing the result already.

-- Performing Test COMPILER_SUPPORTS_WALL
-- Performing Test COMPILER_SUPPORTS_WALL - Success
-- Performing Test COMPILER_SUPPORTS_MEMACCESS
-- Performing Test COMPILER_SUPPORTS_MEMACCESS - Failed
-- Performing Test COMPILER_SUPPORTS_OFFSETOF
-- Performing Test COMPILER_SUPPORTS_OFFSETOF - Success

Also note its important to use -Werror for these checks, because the compiler may only emit an warning and not an error if they are not supported.

The goal behind this is to silence these numerous compiler warnings with clang-9.0.1.

warning: unknown warning option '-Wno-class-memaccess'; did you mean '-Wno-class-varargs'? [-Wunknown-warning-option]
1 warning generated.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/stenzek/duckstation/pull/22 **Author:** [@orbea](https://github.com/orbea) **Created:** 2/12/2020 **Status:** ✅ Merged **Merged:** 2/13/2020 **Merged by:** [@stenzek](https://github.com/stenzek) **Base:** `master` ← **Head:** `clang` --- ### 📝 Commits (1) - [`0c05ad4`](https://github.com/stenzek/duckstation/commit/0c05ad471c30e1ab65fbded24c7c4b425d7b4d70) cmake: Silence warnings with clang. ### 📊 Changes **2 files changed** (+12 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+4 -7) ➕ `CMakeModules/CheckCXXFlag.cmake` (+8 -0) </details> ### 📄 Description This adds a `check_cxx_flag` function to ` CMakeModules/CheckCXXFlag.cmake` designed to make it easier to check compiler flags across the build system and implemented for the existing `-Wall` check, `-Wno-class-memaccess` and `-Wno-invalid-offsetof`. There may be other places this can be used, but I think this is enough for now. I also removed the existing msg for enabling `-Wall` because cmake seems adequate to informing the result already. ``` -- Performing Test COMPILER_SUPPORTS_WALL -- Performing Test COMPILER_SUPPORTS_WALL - Success -- Performing Test COMPILER_SUPPORTS_MEMACCESS -- Performing Test COMPILER_SUPPORTS_MEMACCESS - Failed -- Performing Test COMPILER_SUPPORTS_OFFSETOF -- Performing Test COMPILER_SUPPORTS_OFFSETOF - Success ``` Also note its important to use `-Werror` for these checks, because the compiler may only emit an warning and not an error if they are not supported. The goal behind this is to silence these numerous compiler warnings with `clang-9.0.1`. ``` warning: unknown warning option '-Wno-class-memaccess'; did you mean '-Wno-class-varargs'? [-Wunknown-warning-option] 1 warning generated. ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 19:05:59 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/duckstation#1