[LTP] [PATCH 12/12] posix/interface/conformance: Fix/supress all unused-result warnings

Cyril Hrubis chrubis@suse.cz
Fri Nov 19 16:43:49 CET 2021


Hi!
> --- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-2.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-2.c
> @@ -33,6 +33,9 @@
>  #include "posixtest.h"
>  #include "tempfile.h"
>  
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Wunused-result"
>
>  #define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1)

There is actually better trick than disabling the warning with pragmas,
we use it in lib/tst_test.c as well:

#define WRITE_MSG(msg) do { \
        if (write(STDOUT_FILENO, msg, sizeof(msg) - 1)) { \
                /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425 */ \
        } \
} while (0)

I guess that we should add PTS_WRITE_MSG() to the posixtest.h and make
use of it in all open posix tests.

The rest of the patch looks good.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list