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

Applied clang-tidy suggestions and export of compile commands for linter support #1794

Closed
wants to merge 5 commits into from

Conversation

Spixmaster
Copy link

@Spixmaster Spixmaster commented Mar 10, 2024

The export of the compile commands in the CMakeLists.txt, I put them where I think it is fitting. Please adjust how you like if you want to keep.

The changes in the source code are minor. There are still suggestions by clang-tidy left but I programmed the minor ones. Please take especially a look at the headers I added or removed. I do not not whether the place I put them is correct since you support different environments.

The removed ones were not needed. The added ones are needed for the following data types in your source code.

#include <asm-generic/socket.h> //provides SOL_SOCKET, SO_ERROR, SO_PEERCRED, SO_RCVTIMEO, SO_REUSEPORT and 1 more
#include <bits/signum-generic.h> //provides SIGPIPE
#include <cerrno> //provides EAGAIN, EBADF, EINPROGRESS, EINTR, EMFILE and 1 more; preferred in C++ instead of <errno.h>
#include <chrono> //provides duration, duration_cast, microseconds, milliseconds, seconds and 1 more
#include <cstddef> //provides NULL, nullptr_t, size_t
#include <cstdint> //provides int64_t, uint64_t, uint8_t
#include <cstdio> //provides BUFSIZ, snprintf
#include <cstdlib> //provides strtoul, strtoull
#include <ctime> //provides time_t
#include <iterator> //provides advance, distance
#include <limits> //provides numeric_limits
#include <stdexcept> //provides invalid_argument
#include <sys/types.h> //provides ssize_t
#include <vector> //provides vector
#include <bits/types/struct_timeval.h> //provides timeval
#include <type_traits> //provides enable_if, is_array, remove_extent, underlying_type
#include <zconf.h> //provides Bytef, uInt
#include <openssl/asn1.h> //provides ASN1_STRING_get0_data, ASN1_STRING_length
#include <openssl/bio.h> //provides BIO_NOCLOSE, BIO_free_all, BIO_new_mem_buf, BIO_new_socket, BIO_set_nbio
#include <openssl/crypto.h> //provides OPENSSL_INIT_LOAD_CRYPTO_STRINGS
#include <openssl/obj_mac.h> //provides NID_commonName, NID_subject_alt_name
#include <openssl/opensslv.h> //provides OPENSSL_VERSION_NUMBER
#include <openssl/pem.h> //provides PEM_X509_INFO_read_bio
#include <openssl/prov_ssl.h> //provides TLS1_1_VERSION
#include <openssl/safestack.h> //provides STACK_OF
#include <openssl/tls1.h> //provides TLSEXT_NAMETYPE_host_name
#include <openssl/x509.h> //provides X509_INFO_free, X509_NAME_get_text_by_NID, X509_free, X509_get_ext_d2i, X509_get_subject_name and 3 more
#include <openssl/x509_vfy.h> //provides X509_STORE_add_cert, X509_STORE_add_crl, X509_STORE_free, X509_STORE_new, X509_V_OK

The tests succeed like with commit 548dfff. There happend fails and a segmentation fault but like I said that already happened before so these commits probably did not cause them. I probably have not setup the tests correctly.

Included some headers.
Did minor fixes.
Applied suggestions by clang-tidy.
Export compile commands in CMake for clang-tidy support.
.data() was not available.
@yhirose
Copy link
Owner

yhirose commented Mar 20, 2024

@Spixmaster thanks for the pull request, but I am not going to merge it with the same reason as #1297, #1708,
#1776. Thanks for your understanding. :)

@yhirose yhirose closed this Mar 20, 2024
@Spixmaster
Copy link
Author

@yhirose I think that at least the missing headers should be included.

@Spixmaster
Copy link
Author

@yhirose I do not mind that you decline this pull request but apply at least some of the fixes. Headers are missing and some variables can be declared const.

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