Skip to content

Fix Clang 16 compiler warning: format (1) #335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

eriksejr
Copy link
Contributor

@eriksejr eriksejr commented Dec 8, 2023

While compiling Clang 16 generates the following warnings.

in spine.c:

spine.c:934:101: warning: format specifies type 'long' but the argument has type 'pthread_t' (aka 'struct pthread *') [-Wformat]
                                SPINE_LOG_DEBUG(("DEBUG: Device[%i] Valid Thread to be Created (%ld)", poller_details->host_id, threads[device_counter]));

in util.c:

util.c:1265:100: warning: format specifies type 'long' but the argument has type 'pthread_t' (aka 'struct pthread *') [-Wformat]
        snprintf(logprefix, SMALL_BUFSIZE, "SPINE: Poller[%i] PID[%i] PT[%ld] ", set.poller_id, getpid(), pthread_self());

This one i'm not as sure about, maybe this should be cast to a long unsigned int instead? I have not had problems running it this way but i'm not 100% sure this the right fix.

…rgument has type 'pthread_t' (aka 'struct pthread *') [-Wformat]
@TheWitness TheWitness merged commit a75accc into Cacti:1.2.x Dec 8, 2023
TheWitness pushed a commit that referenced this pull request Dec 8, 2023
While compiling Clang 16 generates the following warnings.

in spine.c:

```
spine.c:934:101: warning: format specifies type 'long' but the argument has type 'pthread_t' (aka 'struct pthread *') [-Wformat]
                                SPINE_LOG_DEBUG(("DEBUG: Device[%i] Valid Thread to be Created (%ld)", poller_details->host_id, threads[device_counter]));
```

in util.c:
```
util.c:1265:100: warning: format specifies type 'long' but the argument has type 'pthread_t' (aka 'struct pthread *') [-Wformat]
        snprintf(logprefix, SMALL_BUFSIZE, "SPINE: Poller[%i] PID[%i] PT[%ld] ", set.poller_id, getpid(), pthread_self());
```
This one i'm not as sure about, maybe this should be cast to a long
unsigned int instead? I have not had problems running it this way but
i'm not 100% sure this the right fix.

Co-authored-by: Erik Sejr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants