Skip to content

Warnings with recent compilers clang 19 #2103

Open
@shikokuchuo

Description

Describe the bug

Recent updates to compiler versions unearth the following warnings:

  1. http_server.c
    warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

  2. aio.c
    runtime error: call to function nni_aio_free through pointer to incorrect function type 'void (*)(void *)'
    UndefinedBehaviorSanitizer: undefined-behavior

Solution

(1) You've already fixed in main, would be great to port this to stable.
(2) The cast of nni_aio_free() to type nni_cb is technically UB here: https://github.com/nanomsg/nng/blob/main/src/core/aio.c#L77

I will provide a PR for both of the above.

** Environment Details **

  • NNG version 1.10.1
  • Operating system and version: Ubuntu 22
  • Compiler and language used: clang 19.1.7 with ASAN/UBSAN
  • Static library

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions