You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2023/04/19 21:39:00 UTC

[jira] [Commented] (PROTON-2714) logger.c:204:41: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Werror=format=]

    [ https://issues.apache.org/jira/browse/PROTON-2714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17714315#comment-17714315 ] 

ASF GitHub Bot commented on PROTON-2714:
----------------------------------------

jiridanek commented on code in PR #397:
URL: https://github.com/apache/qpid-proton/pull/397#discussion_r1171879826


##########
c/src/core/connection_driver.c:
##########
@@ -43,7 +43,7 @@ static pn_event_t *batch_next(pn_connection_driver_t *d) {
   /* Log the next event that will be processed */
   pn_event_t *next = pn_collector_next(d->collector);
   if (next && PN_SHOULD_LOG(&d->transport->logger, PN_SUBSYSTEM_EVENT, PN_LEVEL_DEBUG)) {
-    pni_logger_log_msg_inspect(&d->transport->logger, PN_SUBSYSTEM_EVENT, PN_LEVEL_DEBUG, next, "");
+    pni_logger_log_msg_inspect(&d->transport->logger, PN_SUBSYSTEM_EVENT, PN_LEVEL_DEBUG, next, "%s", "");

Review Comment:
   there is only this one line where the annotations lead to siliness needed not to generate a warning (empty formatting string on gcc generates warning)





> logger.c:204:41: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Werror=format=]
> ---------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: PROTON-2714
>                 URL: https://issues.apache.org/jira/browse/PROTON-2714
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: proton-c
>    Affects Versions: proton-c-0.38.0
>            Reporter: Jiri Daněk
>            Assignee: Jiri Daněk
>            Priority: Minor
>
> These don't actually produce compiler diagnostics, that only appears after the printing functions are annotated. So this is not causing compilation failures currently.
> {noformat}
> /home/jdanek/repos/qpid/qpid-proton/c/src/ssl/openssl.c: In function ‘process_input_ssl’:
> /home/jdanek/repos/qpid/qpid-proton/c/src/ssl/openssl.c:1039:70: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Werror=format=]
>  1039 |   ssl_log( transport, PN_LEVEL_TRACE, "process_input_ssl( data size=%d )",available );
>       |                                                                     ~^    ~~~~~~~~~
>       |                                                                      |    |
>       |                                                                      int  size_t {aka long unsigned int}
>       |                                                                     %ld
> cc1: all warnings being treated as errors
> gmake[2]: *** [c/CMakeFiles/qpid-proton-core-static.dir/build.make:520: c/CMakeFiles/qpid-proton-core-static.dir/src/ssl/openssl.c.o] Error 1
> gmake[1]: *** [CMakeFiles/Makefile2:1375: c/CMakeFiles/qpid-proton-core-static.dir/all] Error 2
> gmake: *** [Makefile:146: all] Error 2
> {noformat}
> {noformat}
> /home/jdanek/repos/qpid/qpid-proton/c/src/core/logger.c: In function ‘pni_logger_log_raw’:
> /home/jdanek/repos/qpid/qpid-proton/c/src/core/logger.c:204:41: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Werror=format=]
>   204 |     pn_fixed_string_addf(&out, "%04x/%04x: ", i, size);
>       |                                      ~~~^        ~~~~
>       |                                         |        |
>       |                                         |        size_t {aka long unsigned int}
>       |                                         unsigned int
>       |                                      %04lx
> cc1: all warnings being treated as errors
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org