[
https://issues.apache.org/jira/browse/PROTON-1455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17180033#comment-17180033
]
Jiri Daněk commented on PROTON-1455:
------------------------------------
Glibc defines a {{__wur}} macro to set the unused result warning for a function.
There are multiple variants of {{strerror_r}} in {{strings.h}}. This comment
tries to explain
{noformat}
/* Reentrant version of `strerror'.
There are 2 flavors of `strerror_r', GNU which returns the string
and may or may not use the supplied temporary buffer and POSIX one
which fills the string into the buffer.
To use the POSIX version, -D_XOPEN_SOURCE=600 or -D_POSIX_C_SOURCE=200112L
without -D_GNU_SOURCE is needed, otherwise the GNU version is
preferred. */
{noformat}
The variant that ends up chosen currently in Proton is the POSIX one, defined as
{noformat}
extern int __REDIRECT_NTH (strerror_r,
(int __errnum, char *__buf, size_t __buflen),
__xpg_strerror_r) __nonnull ((2));
{noformat}
and that one doesn't have the {{__wur}}.
The result of calling strerr_r in platform.c is unused, but the warning is not
triggered now.
> Problem building on Ubuntu xenial with g++
> ------------------------------------------
>
> Key: PROTON-1455
> URL: https://issues.apache.org/jira/browse/PROTON-1455
> Project: Qpid Proton
> Issue Type: Bug
> Components: build, proton-c
> Reporter: Irina Boverman
> Assignee: Justin Ross
> Priority: Major
>
> 31%] Building CXX object
> proton-c/CMakeFiles/qpid-proton.dir/src/messenger/transform.c.o
> cd /proton/build/proton-c && /usr/bin/c++ -std=c++11 -Dqpid_proton_EXPORTS
> -I/proton/build/proton-c/src -I/proton/build/proton-c/include
> -I/proton/proton-c/src -I/proton/proton-c/include -fvisibility=hidden -O2 -g
> -DNDEBUG -fPIC -Werror -Wall -pedantic-errors -Wno-format
> -Wno-variadic-macros -o
> CMakeFiles/qpid-proton.dir/src/messenger/transform.c.o -c
> /proton/proton-c/src/messenger/transform.c
> [ 31%] Building CXX object
> proton-c/CMakeFiles/qpid-proton.dir/src/platform/platform.c.o
> cd /proton/build/proton-c && /usr/bin/c++ -std=c++11 -Dqpid_proton_EXPORTS
> -DUSE_ATOLL -DUSE_CLOCK_GETTIME -DUSE_STRERROR_R -I/proton/build/proton-c/src
> -I/proton/build/proton-c/include -I/proton/proton-c/src
> -I/proton/proton-c/include -fvisibility=hidden -O2 -g -DNDEBUG -fPIC
> -Werror -Wall -pedantic-errors -Wno-format -Wno-variadic-macros -o
> CMakeFiles/qpid-proton.dir/src/platform/platform.c.o -c
> /proton/proton-c/src/platform/platform.c
> /proton/proton-c/src/platform/platform.c: In function 'void
> pn_i_strerror(int, char*, size_t)':
> /proton/proton-c/src/platform/platform.c:92:34: error: ignoring return value
> of 'char* strerror_r(int, char*, size_t)', declared with attribute
> warn_unused_result [-Werror=unused-result]
> strerror_r(errnum, buf, buflen);
> ^
> cc1plus: all warnings being treated as errors
> proton-c/CMakeFiles/qpid-proton.dir/build.make:1081: recipe for target
> 'proton-c/CMakeFiles/qpid-proton.dir/src/platform/platform.c.o' failed
> make[2]: Leaving directory '/proton/build'
> make[2]: *** [proton-c/CMakeFiles/qpid-proton.dir/src/platform/platform.c.o]
> Error 1
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]