Skip to content
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

Warning with clang 16 #354

Closed
wch opened this issue Jan 20, 2023 · 2 comments · Fixed by #355
Closed

Warning with clang 16 #354

wch opened this issue Jan 20, 2023 · 2 comments · Fixed by #355

Comments

@wch
Copy link
Collaborator

wch commented Jan 20, 2023

I received an email from BDR about a warning from clang 16.

clang 16 is being prepared for release in early March, so it is time to start reporting its issues. See https://www.stats.ox.ac.uk/pub/bdr/clang16/ including its README.txt

From https://www.stats.ox.ac.uk/pub/bdr/clang16/httpuv.out:

Found the following significant warnings:
  httprequest.cpp:808:7: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
See ‘/data/gannet/ripley/R/packages/tests-clang-trunk/httpuv.Rcheck/00install.out’ for details.
@wch
Copy link
Collaborator Author

wch commented Jan 20, 2023

The problem is here:

body.empty();

It calls .empty() on a vector, but that's the wrong method: it reports whether or not the vector is empty, but I believe the goal is to clear the vector, in which case the correct method is .clear().

@wch
Copy link
Collaborator Author

wch commented Jan 20, 2023

Looking at the history, the .empty() was originally introduced in bdaee93., and then was moved to a new location in 5178f6a.

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 a pull request may close this issue.

1 participant