You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "jiridanek (via GitHub)" <gi...@apache.org> on 2024/01/07 20:34:08 UTC

[PR] PROTON-2772: add printf format arg annotations to satisfy MSVC [qpid-proton]

jiridanek opened a new pull request, #419:
URL: https://github.com/apache/qpid-proton/pull/419

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] PROTON-2772: add printf format arg annotations to satisfy MSVC [qpid-proton]

Posted by "jiridanek (via GitHub)" <gi...@apache.org>.
jiridanek commented on code in PR #419:
URL: https://github.com/apache/qpid-proton/pull/419#discussion_r1444071676


##########
c/src/core/encoder.c:
##########
@@ -78,7 +78,7 @@ static uint8_t pn_type2code(pn_encoder_t *encoder, pn_type_t type)
   case PN_MAP: return PNE_MAP32;
   case PN_DESCRIBED: return PNE_DESCRIPTOR;
   default:
-    return pn_error_format(pni_encoder_error(encoder), PN_ERR, "not a value type: %u\n", type);
+    return pn_error_format(pni_encoder_error(encoder), PN_ERR, "not a value type: %u\n", (unsigned int)type);

Review Comment:
   Let;s go with %d as well



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] PROTON-2772: add printf format arg annotations to satisfy MSVC [qpid-proton]

Posted by "jiridanek (via GitHub)" <gi...@apache.org>.
jiridanek commented on code in PR #419:
URL: https://github.com/apache/qpid-proton/pull/419#discussion_r1444069607


##########
c/src/core/encoder.c:
##########
@@ -78,7 +78,7 @@ static uint8_t pn_type2code(pn_encoder_t *encoder, pn_type_t type)
   case PN_MAP: return PNE_MAP32;
   case PN_DESCRIBED: return PNE_DESCRIPTOR;
   default:
-    return pn_error_format(pni_encoder_error(encoder), PN_ERR, "not a value type: %u\n", type);
+    return pn_error_format(pni_encoder_error(encoder), PN_ERR, "not a value type: %u\n", (unsigned int)type);

Review Comment:
   This is about printing an enum, the compiler is unhappy with `%u`. Not really sure what's the nicest way to resolve this. In C23, it will be possible to specify a backing type for enum.
   
   Nowadays, if I read correctly, iti is either a char, int, or unsigned int. Wouldn't maybe treating it as an int work better here? So %d and (int) cast?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] PROTON-2772: add printf format arg annotations to satisfy MSVC [qpid-proton]

Posted by "jiridanek (via GitHub)" <gi...@apache.org>.
jiridanek commented on code in PR #419:
URL: https://github.com/apache/qpid-proton/pull/419#discussion_r1444068569


##########
c/src/core/engine.c:
##########
@@ -1645,9 +1645,9 @@ void pn_delivery_dump(pn_delivery_t *d)
   printf("{tag=%s, local.type=%" PRIu64 ", remote.type=%" PRIu64 ", local.settled=%u, "
          "remote.settled=%u, updated=%u, current=%u, writable=%u, readable=%u, "
          "work=%u}",
-         tag, d->local.type, d->remote.type, d->local.settled,
-         d->remote.settled, d->updated, pn_delivery_current(d),
-         pn_delivery_writable(d), pn_delivery_readable(d), d->work);
+         tag, d->local.type, d->remote.type, (unsigned)d->local.settled,
+         (unsigned)d->remote.settled, (unsigned)d->updated, (unsigned)pn_delivery_current(d),
+         (unsigned)pn_delivery_writable(d), (unsigned)pn_delivery_readable(d), (unsigned)d->work);

Review Comment:
   MSVC would be happy to print `bool`s with `%i`, but `%u` it does not like. Maybe just go with `%i` or `%d` instead?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] PROTON-2772: add printf format arg annotations to satisfy MSVC [qpid-proton]

Posted by "jiridanek (via GitHub)" <gi...@apache.org>.
jiridanek commented on code in PR #419:
URL: https://github.com/apache/qpid-proton/pull/419#discussion_r1444071641


##########
c/src/core/engine.c:
##########
@@ -1645,9 +1645,9 @@ void pn_delivery_dump(pn_delivery_t *d)
   printf("{tag=%s, local.type=%" PRIu64 ", remote.type=%" PRIu64 ", local.settled=%u, "
          "remote.settled=%u, updated=%u, current=%u, writable=%u, readable=%u, "
          "work=%u}",
-         tag, d->local.type, d->remote.type, d->local.settled,
-         d->remote.settled, d->updated, pn_delivery_current(d),
-         pn_delivery_writable(d), pn_delivery_readable(d), d->work);
+         tag, d->local.type, d->remote.type, (unsigned)d->local.settled,
+         (unsigned)d->remote.settled, (unsigned)d->updated, (unsigned)pn_delivery_current(d),
+         (unsigned)pn_delivery_writable(d), (unsigned)pn_delivery_readable(d), (unsigned)d->work);

Review Comment:
   I'm changing this to %d



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] PROTON-2772: add printf format arg annotations to satisfy MSVC [qpid-proton]

Posted by "jiridanek (via GitHub)" <gi...@apache.org>.
jiridanek merged PR #419:
URL: https://github.com/apache/qpid-proton/pull/419


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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