[Openvpn-devel,4/5] Add missing stdint.h includes in unit tests files

Message ID 20230208001819.244694-5-arne@rfc2549.org
State Accepted
Headers show
Series Build and run unittests with mingw in Github actions | expand

Commit Message

Arne Schwabe Feb. 8, 2023, 12:18 a.m. UTC
My mingw compiler/headers (mingw-w64 10.0.0 on macOS) seem to be more
pendantic than the one that comes with Ubuntu 22.04 (github actions) or
any of the other platforms including msvc/normal windows header.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 tests/unit_tests/example_test/test.c  | 1 +
 tests/unit_tests/example_test/test2.c | 1 +
 tests/unit_tests/openvpn/mock_msg.c   | 1 +
 3 files changed, 3 insertions(+)

Comments

Selva Nair Feb. 9, 2023, 10:23 p.m. UTC | #1
CC: list

---------- Forwarded message ---------
From: Selva Nair <selva.nair@gmail.com>
Date: Wed, Feb 8, 2023 at 11:34 PM
Subject: Re: [Openvpn-devel] [PATCH 4/5] Add missing stdint.h includes in
unit tests files
To: Arne Schwabe <arne@rfc2549.org>


Hi,

On Tue, Feb 7, 2023 at 7:19 PM Arne Schwabe <arne@rfc2549.org> wrote:

> My mingw compiler/headers (mingw-w64 10.0.0 on macOS) seem to be more
> pendantic than the one that comes with Ubuntu 22.04 (github actions) or
> any of the other platforms including msvc/normal windows header.
>
> Signed-off-by: Arne Schwabe <arne@rfc2549.org>
> ---
>  tests/unit_tests/example_test/test.c  | 1 +
>  tests/unit_tests/example_test/test2.c | 1 +
>  tests/unit_tests/openvpn/mock_msg.c   | 1 +
>  3 files changed, 3 insertions(+)
>
> diff --git a/tests/unit_tests/example_test/test.c
> b/tests/unit_tests/example_test/test.c
> index ea31b884d..c174025cc 100644
> --- a/tests/unit_tests/example_test/test.c
> +++ b/tests/unit_tests/example_test/test.c
> @@ -4,6 +4,7 @@
>  #include <stdarg.h>
>  #include <string.h>
>  #include <setjmp.h>
> +#include <stdint.h>
>  #include <cmocka.h>
>
>  static int
> diff --git a/tests/unit_tests/example_test/test2.c
> b/tests/unit_tests/example_test/test2.c
> index 5a186d5d7..bb54633c8 100644
> --- a/tests/unit_tests/example_test/test2.c
> +++ b/tests/unit_tests/example_test/test2.c
> @@ -4,6 +4,7 @@
>  #include <stdarg.h>
>  #include <string.h>
>  #include <setjmp.h>
> +#include <stdint.h>
>  #include <cmocka.h>
>
>
> diff --git a/tests/unit_tests/openvpn/mock_msg.c
> b/tests/unit_tests/openvpn/mock_msg.c
> index 3ede98c00..3fa9a166f 100644
> --- a/tests/unit_tests/openvpn/mock_msg.c
> +++ b/tests/unit_tests/openvpn/mock_msg.c
> @@ -32,6 +32,7 @@
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <setjmp.h>
> +#include <stdint.h>
>  #include <cmocka.h>


Actually it may not be your setup: mingw on Linux also requires this if
using cmocka-master branch. cmocka-1.1.5 works without this include for me.
That would explain why we haven't seen this error yet in native builds.

Anyway, cmocka docs also tell us to always include <stdint.h>.

Acked-by: Selva Nair <selva.nair@gmail.com>
Gert Doering Feb. 10, 2023, 8:59 p.m. UTC | #2
Tested with cmocka on linux and AIX ("nothing more exotic than that").

Nothing breaks.

.. and if cmocka docs tell us "this is the thing", then it is :-)

Your patch has been applied to the master and release/2.6 branch.

commit e80720ef9399d7a4e3469cf1004d064643e0f4dd (master)
commit 1b06696efb069ff9dfc77bac6cb487de232938cc (release/2.6)
Author: Arne Schwabe
Date:   Wed Feb 8 01:18:18 2023 +0100

     Add missing stdint.h includes in unit tests files

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Selva Nair <selva.nair@gmail.com>
     Message-Id: <20230208001819.244694-5-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26182.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/tests/unit_tests/example_test/test.c b/tests/unit_tests/example_test/test.c
index ea31b884d..c174025cc 100644
--- a/tests/unit_tests/example_test/test.c
+++ b/tests/unit_tests/example_test/test.c
@@ -4,6 +4,7 @@ 
 #include <stdarg.h>
 #include <string.h>
 #include <setjmp.h>
+#include <stdint.h>
 #include <cmocka.h>
 
 static int
diff --git a/tests/unit_tests/example_test/test2.c b/tests/unit_tests/example_test/test2.c
index 5a186d5d7..bb54633c8 100644
--- a/tests/unit_tests/example_test/test2.c
+++ b/tests/unit_tests/example_test/test2.c
@@ -4,6 +4,7 @@ 
 #include <stdarg.h>
 #include <string.h>
 #include <setjmp.h>
+#include <stdint.h>
 #include <cmocka.h>
 
 
diff --git a/tests/unit_tests/openvpn/mock_msg.c b/tests/unit_tests/openvpn/mock_msg.c
index 3ede98c00..3fa9a166f 100644
--- a/tests/unit_tests/openvpn/mock_msg.c
+++ b/tests/unit_tests/openvpn/mock_msg.c
@@ -32,6 +32,7 @@ 
 #include <stdio.h>
 #include <stdlib.h>
 #include <setjmp.h>
+#include <stdint.h>
 #include <cmocka.h>