From ccdf495f7b3b979954d7bc7041ddd2216eb1026d Mon Sep 17 00:00:00 2001 From: Ethan Sommer Date: Fri, 5 Jun 2020 17:16:33 -0400 Subject: include/tinyalsa/plugin.h: include time.h Older versions of linux's API header sound/asound.h accidentally rely on indirect declaration of struct timespec, which isn't reliable, so include time.h before it to support older versions of sound/asound.h properly --- include/tinyalsa/plugin.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/tinyalsa/plugin.h b/include/tinyalsa/plugin.h index 91d862a..a140754 100644 --- a/include/tinyalsa/plugin.h +++ b/include/tinyalsa/plugin.h @@ -33,6 +33,7 @@ #include #include #include +#include #include -- cgit v1.2.3 From 0c279d81e722e8e7c285dae22666675787bd30e9 Mon Sep 17 00:00:00 2001 From: Ethan Sommer Date: Fri, 5 Jun 2020 16:44:53 -0400 Subject: cmake: specify c99 Set standard to c99, require it, disable language extensions. Define _POSIX_C_SOURCE to 200809L so time.h declares struct timespec. Add -Wpedantic to find use of language extensions. snd_card_plugin.c: remove one unnecessary ';' to make -Wpedantic work --- CMakeLists.txt | 9 +++++++-- src/snd_card_plugin.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9be12b6..f6aea98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,10 @@ execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/version.sh -s print project("TinyALSA" VERSION ${TINYALSA_VERSION} LANGUAGES C) +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_EXTENSIONS OFF) + # Options option(BUILD_SHARED_LIBS "Build shared libraries" ON) option(TINYALSA_USES_PLUGINS "Whether or not to build with plugin support" OFF) @@ -38,7 +42,8 @@ target_include_directories("tinyalsa" PUBLIC $ $) target_compile_definitions("tinyalsa" PRIVATE - $<$:TINYALSA_USES_PLUGINS>) + $<$:TINYALSA_USES_PLUGINS> + PUBLIC _POSIX_C_SOURCE=200809L) target_link_libraries("tinyalsa" PUBLIC ${CMAKE_DL_LIBS}) # Examples @@ -68,7 +73,7 @@ target_link_libraries("tinywavinfo" PRIVATE m) # Add C warning flags include(CheckCCompilerFlag) -foreach(FLAG IN ITEMS -Wall -Wextra -Werror -Wfatal-errors) +foreach(FLAG IN ITEMS -Wall -Wextra -Wpedantic -Werror -Wfatal-errors) string(TOUPPER "HAVE${FLAG}" HAVE_VAR) string(REPLACE "-" "_" HAVE_VAR "${HAVE_VAR}") check_c_compiler_flag("${FLAG}" "${HAVE_VAR}") diff --git a/src/snd_card_plugin.c b/src/snd_card_plugin.c index 17912a2..c6d4baf 100644 --- a/src/snd_card_plugin.c +++ b/src/snd_card_plugin.c @@ -81,7 +81,7 @@ enum snd_node_type snd_utils_get_node_type(struct snd_node *node) node->ops->get_int(node->dev_node, "type", &val); return val; -}; +} static int snd_utils_resolve_symbols(struct snd_node *node) { -- cgit v1.2.3