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

Build everything with -Werror #1100

Merged
merged 12 commits into from
Dec 11, 2023
Merged

Build everything with -Werror #1100

merged 12 commits into from
Dec 11, 2023

Conversation

pcercuei
Copy link
Contributor

Build everything (Libiio, IIOD, and iio-utils) with -Werror or the Visual Studio equivalent, and fix a bunch of warnings that were reported.

When COMPILE_WARNING_AS_ERROR is set, compile everything with -Werror
and not just Libiio.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
time_t is implementation defined, and therefore there is no printf
format specifier that is guaranteed to work on every platform.

Address this issue by using %ld and casting the value to long.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Specify the arguments to the yylex() function in its forward prototype,
as old-style prototypes that don't specify the number of arguments are
deprecated in C.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
The return codes are stored within the "struct iiod_command" as a
int32_t, there is no point to use a intptr_t in the public API.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
We compute a difference between two 64-bit values, and given that the
result corresponds to a timeout value in milliseconds, we can guarantee
that it will fit in 32-bits.

Use an explicit downcast to unsigned int to tell the compiler that we
know it's okay.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Set argc parameter to dup_argv/free_argw as unsigned int, to avoid
signed/unsigned comparisons.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Use PRId64 from <inttypes.h> to print the int64_t value.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
MSVC does not support escape sequences and will complain if it finds
some, even when those are actually dead code.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
iio_strerror() expects an "int" value for the error code. Visual Studio
will complain if we are passing a ssize_t, as it is a downcast. However,
we know that error codes all fit in "int", so the downcast is safe.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
@pcercuei pcercuei merged commit 6fdb616 into main Dec 11, 2023
24 checks passed
@pcercuei pcercuei deleted the pcercuei/werror branch December 11, 2023 16:49
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.

2 participants