#16 Added -Wdocumentation to Clang build, and fixed doc comments for clean Clang build.

This commit is contained in:
fpagliughi
2019-08-22 08:32:52 -04:00
parent 8c17856af1
commit b0cbf7ae4a
3 changed files with 20 additions and 11 deletions

View File

@@ -24,22 +24,22 @@ do
mkdir buildtst ; pushd buildtst
# Configure the build
if ! CXX=${COMPILER} cmake -DSOCKPP_BUILD_EXAMPLES=ON -DSOCKPP_BUILD_TESTS=ON .. ; then
if ! cmake -DSOCKPP_BUILD_EXAMPLES=ON -DSOCKPP_BUILD_TESTS=ON -DCMAKE_CXX_COMPILER=${COMPILER} .. ; then
printf "\nCMake configuration failed for %s\n" "${COMPILER}"
exit 1
exit 1
fi
# Build the library, examples, and unit tests
if ! make -j${BUILD_JOBS} ; then
printf "\nCompilation failed for %s\n" "${COMPILER}"
exit 2
fi
printf "\nCompilation failed for %s\n" "${COMPILER}"
exit 2
fi
# Run the unit tests
if ! ./tests/unit/unit_tests ; then
printf "\nUnit tests failed for %s\n" "${COMPILER}"
exit 3
fi
printf "\nUnit tests failed for %s\n" "${COMPILER}"
exit 3
fi
popd
fi

View File

@@ -119,13 +119,17 @@ public:
sock_address_any() : addr_{}, sz_(0) {}
/**
* Constructs an address.
* @param addr Pointer to a buffer holding the address.
* @param n The number of valid bytes in the address
*/
sock_address_any(const sockaddr* addr, socklen_t n) {
// TODO: Check size of n.
std::memcpy(&addr_, addr, sz_ = n);
}
/**
* Constructs an address.
* Constructs an address.
* @param addr The buffer holding the address.
* @param n The number of valid bytes in the address
*/
sock_address_any(const sockaddr_storage& addr, socklen_t n) {
// TODO: Check size of n n?
@@ -133,7 +137,7 @@ public:
}
/**
* Copies another address to this one.
* @param addr
* @param addr The other address to copy into this one.
*/
sock_address_any(const sock_address& addr)
: sock_address_any(addr.sockaddr_ptr(), addr.size()) {}

View File

@@ -60,7 +60,12 @@ set_target_properties(sockpp-objs PROPERTIES POSITION_INDEPENDENT_CODE 1)
# --- Warnings ---
if(NOT MSVC)
target_compile_options(sockpp-objs PRIVATE -Wall -Wextra -pedantic) # -Werror)
# Maybe set '-Werror' for Release builds?
if (CMAKE_CXX_COMPILER_ID MATCHES Clang)
target_compile_options(sockpp-objs PRIVATE -Wall -Wextra -pedantic -Wdocumentation)
else()
target_compile_options(sockpp-objs PRIVATE -Wall -Wextra -pedantic)
endif()
endif()
#if(MSVC)