[LTP] [PATCH 12/12] posix/interface/conformance: Fix/supress all unused-result warnings
Joerg Vehlow
lkml@jv-coder.de
Mon Nov 22 07:42:52 CET 2021
Hi Cyril,
> 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.
Ok I'll fix it like that. I also like one macro in posixtest.h better
than in every file.
Joerg
More information about the ltp
mailing list