aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRatchanan Srirattanamet <ratchanan@ubports.com>2023-11-29 00:42:50 +0700
committerRatchanan Srirattanamet <ratchanan@ubports.com>2023-11-29 01:42:23 +0700
commit41c2b5c21de5a3774f0bbb54de3999eaccc7de70 (patch)
tree8e846264c36e02681cef23cc0bd7e31656546ae8 /tests
parentb153ce4da15f9ff3dc7f1bd5bd798a402d444f4b (diff)
downloadayatana-indicator-sound-41c2b5c21de5a3774f0bbb54de3999eaccc7de70.tar.gz
ayatana-indicator-sound-41c2b5c21de5a3774f0bbb54de3999eaccc7de70.tar.bz2
ayatana-indicator-sound-41c2b5c21de5a3774f0bbb54de3999eaccc7de70.zip
src, tests: fix -Wint-to-pointer-cast and a chance of test crashpersonal/peat-psuwit/protected-superclass
Turns the constructor of `VolumeControl` and `VolumeWarning` from `internal` to `protected`. This makes Vala emits C declaration of constructors, which is required by the test's mocks extending these classes, in the external header. Without them, the mocks' C code would then consider them "implicitly declared", and will assume they return `int` instead of a pointer. If the returned address happened to be higher than `INT_MAX`, the code will consider the returned address negative and sign-extend it when casting to a pointer, corrupting it. As for "unprivating" these constructors, this is an internal static library anyway. No libraries or headers are installed from this package. This change is invisible from outside.
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 6776514..39711ed 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -83,8 +83,8 @@ vala_init(vala-mocks
set_source_files_properties(media-player-mock.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-unknown-warning-option -Wno-incompatible-pointer-types -Wno-discarded-qualifiers")
set_source_files_properties(media-player-list-mock.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types -Wno-unused-variable")
set_source_files_properties(options-mock.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types -Wno-unused-variable")
-set_source_files_properties(volume-control-mock.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types -Wno-int-to-pointer-cast -Wno-implicit-function-declaration")
-set_source_files_properties(volume-warning-mock.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types -Wno-unused-variable -Wno-int-to-pointer-cast -Wno-implicit-function-declaration")
+set_source_files_properties(volume-control-mock.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types")
+set_source_files_properties(volume-warning-mock.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types -Wno-unused-variable")
vala_add(vala-mocks
media-player-mock.vala