-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define a preprocessor flag for enabling warnings on unused Connection…
…Handle (#71) * Define a preprocessor flag for enabling warnings on unused ConnectionHandle * add KDBINDINGS_ENABLE_WARN_UNUSED as a cmake option * move preprocessor macros directly in a standard header file * explicity casts the return value to void to ignore warning for CI
- Loading branch information
1 parent
457bc6e
commit 90a96ce
Showing
10 changed files
with
43 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
# Contact KDAB at <[email protected]> for commercial licensing options. | ||
# | ||
|
||
option(KDBINDINGS_ENABLE_WARN_UNUSED "Enable warnings for unused ConnectionHandles" ON) | ||
|
||
set(HEADERS | ||
binding.h | ||
binding_evaluator.h | ||
|
@@ -20,6 +22,7 @@ set(HEADERS | |
connection_evaluator.h | ||
connection_handle.h | ||
utils.h | ||
KDBindingsConfig.h | ||
) | ||
|
||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0") | ||
|
@@ -33,6 +36,11 @@ add_library(KDAB::KDBindings ALIAS KDBindings) | |
set_target_properties(KDBindings PROPERTIES | ||
INTERFACE_COMPILE_FEATURES cxx_std_17 | ||
) | ||
|
||
if(KDBINDINGS_ENABLE_WARN_UNUSED) | ||
target_compile_definitions(KDBindings INTERFACE KDBINDINGS_ENABLE_WARN_UNUSED=1) | ||
endif() | ||
|
||
target_include_directories(KDBindings INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..> | ||
$<INSTALL_INTERFACE:include> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
#ifdef KDBINDINGS_ENABLE_WARN_UNUSED | ||
#define KDBINDINGS_WARN_UNUSED [[nodiscard]] | ||
#else | ||
#define KDBINDINGS_WARN_UNUSED | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters