Skip to content

Commit

Permalink
Treat compiler warning as error
Browse files Browse the repository at this point in the history
  • Loading branch information
beef9999 committed Jan 17, 2024
1 parent b57b277 commit 4e4ea90
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.macos.arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ "main", "release/*" ]

jobs:
macOS-clang-debug:
macOS-clang-release:
runs-on: [self-hosted, macOS, ARM64]

steps:
Expand All @@ -26,9 +26,9 @@ jobs:
- name: Build
run: |
cmake -B ${{github.workspace}}/build -D PHOTON_BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=Debug \
cmake -B ${{github.workspace}}/build -D PHOTON_BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=Release \
-D PHOTON_ENABLE_SASL=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3
cmake --build ${{github.workspace}}/build -j -- VERBOSE=1
cmake --build ${{github.workspace}}/build -j
- name: Test
working-directory: ${{github.workspace}}/build
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ "main", "release/*" ]

jobs:
macOS-12-Monterey-debug:
macOS-12-Monterey-release:
runs-on: macos-12

steps:
Expand All @@ -26,9 +26,9 @@ jobs:
- name: Build
run: |
cmake -B ${{github.workspace}}/build -D PHOTON_BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=Debug \
cmake -B ${{github.workspace}}/build -D PHOTON_BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=Release \
-D PHOTON_ENABLE_SASL=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3
cmake --build ${{github.workspace}}/build -j -- VERBOSE=1
cmake --build ${{github.workspace}}/build -j
- name: Test
working-directory: ${{github.workspace}}/build
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ if (NOT (${ARCH} STREQUAL x86_64) AND NOT (${ARCH} STREQUAL aarch64) AND NOT (${
endif ()
ProcessorCount(NumCPU)

# Compiler options
add_compile_options(-Wall) # -Werror is not enable yet
# Global compiler options, only effective within this project
add_compile_options(-Wall -Werror -Wno-error=pragmas)

set(CMAKE_CXX_STANDARD ${PHOTON_CXX_STANDARD})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
2 changes: 2 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
add_definitions(-w)

add_executable(simple-example simple/simple.cpp)
target_link_libraries(simple-example PRIVATE photon_static)

Expand Down
16 changes: 8 additions & 8 deletions fs/subfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,56 +231,56 @@ namespace fs
return underlayfs->mknod(path, mode, dev);
}

virtual ssize_t getxattr(const char *path, const char *name, void *value, size_t size)
virtual ssize_t getxattr(const char *path, const char *name, void *value, size_t size) override
{
if (!underlay_xattrfs)
LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs");
PathCat __(this, path);
return underlay_xattrfs->getxattr(path, name, value, size);
}
virtual ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size)
virtual ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size) override
{
if (!underlay_xattrfs)
LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs");
PathCat __(this, path);
return underlay_xattrfs->lgetxattr(path, name, value, size);
}
virtual ssize_t listxattr(const char *path, char *list, size_t size)
virtual ssize_t listxattr(const char *path, char *list, size_t size) override
{
if (!underlay_xattrfs)
LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs");
PathCat __(this, path);
return underlay_xattrfs->listxattr(path, list, size);
}
virtual ssize_t llistxattr(const char *path, char *list, size_t size)
virtual ssize_t llistxattr(const char *path, char *list, size_t size) override
{
if (!underlay_xattrfs)
LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs");
PathCat __(this, path);
return underlay_xattrfs->llistxattr(path, list, size);
}
virtual int setxattr(const char *path, const char *name, const void *value, size_t size, int flags)
virtual int setxattr(const char *path, const char *name, const void *value, size_t size, int flags) override
{
if (!underlay_xattrfs)
LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs");
PathCat __(this, path);
return underlay_xattrfs->setxattr(path, name, value, size, flags);
}
virtual int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags)
virtual int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags) override
{
if (!underlay_xattrfs)
LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs");
PathCat __(this, path);
return underlay_xattrfs->lsetxattr(path, name, value, size, flags);
}
virtual int removexattr(const char *path, const char *name)
virtual int removexattr(const char *path, const char *name) override
{
if (!underlay_xattrfs)
LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs");
PathCat __(this, path);
return underlay_xattrfs->removexattr(path, name);
}
virtual int lremovexattr(const char *path, const char *name)
virtual int lremovexattr(const char *path, const char *name) override
{
if (!underlay_xattrfs)
LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs");
Expand Down
2 changes: 1 addition & 1 deletion net/basic_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ ssize_t ISocketStream::recv_at_least_mutable(struct iovec *iov, int iovcnt,
if (ret == 0) break; // EOF
if ((n += ret) >= least) break;
auto r = v.extract_front(ret);
assert(r == ret); (void)r;
assert((ssize_t) r == ret); (void)r;
} while (v.iovcnt && v.iov->iov_len);
return n;
}
Expand Down
7 changes: 7 additions & 0 deletions net/http/headers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,14 @@ HeadersBase::KV* HeadersBase::kv_add_sort(KV kv) {
if ((char*)(begin - 1) <= m_buf + m_buf_size)
LOG_ERROR_RETURN(ENOBUFS, nullptr, "no buffer");
auto it = std::lower_bound(begin, kv_end(), kv, HA(this));
#ifndef __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
memmove(begin - 1, begin, sizeof(KV) * (it - begin));
#ifndef __clang__
#pragma GCC diagnostic pop
#endif
m_kv_size++;
*(it - 1) = kv;
return it - 1;
Expand Down
2 changes: 1 addition & 1 deletion net/http/url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void URL::fix_target() {
if (m_target.size() == 0 || t.front() != '/') {
m_tmp_target = (char*)malloc(m_target.size() + 1);
m_tmp_target[0] = '/';
strncpy(m_tmp_target+1, t.data(), t.size());
memcpy(m_tmp_target+1, t.data(), t.size());
m_target = rstring_view16(0, m_target.size()+1);
m_path = rstring_view16(0, m_path.size()+1);
}
Expand Down
3 changes: 3 additions & 0 deletions net/security-context/tls-stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class TLSContextImpl : public TLSContext {
case TLSVersion::SSL23:
method = SSLv23_method();
break;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
case TLSVersion::TLS11:
method = TLSv1_1_method();
break;
Expand All @@ -109,6 +111,7 @@ class TLSContextImpl : public TLSContext {
break;
default:
method = TLSv1_2_method();
#pragma GCC diagnostic pop
}
ctx = SSL_CTX_new(method);
if (ctx == nullptr) {
Expand Down
8 changes: 4 additions & 4 deletions thread/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,15 +928,15 @@ R"(
size_t randomizer = (rand() % 32) * (1024 + 8);
stack_size = align_up(randomizer + stack_size + sizeof(thread), PAGE_SIZE);
char* ptr = (char*)photon_thread_alloc(stack_size);
auto p = ptr + stack_size - sizeof(thread) - randomizer;
(uint64_t&)p &= ~63;
auto th = new (p) thread;
uint64_t p = (uint64_t) ptr + stack_size - sizeof(thread) - randomizer;
p = align_down(p, 64);
auto th = new((char*) p) thread;
th->buf = ptr;
th->stackful_alloc_top = ptr;
th->start = start;
th->stack_size = stack_size;
th->arg = arg;
auto sp = align_down((uint64_t)p - reserved_space, 64);
auto sp = align_down(p - reserved_space, 64);
th->stack.init((void*)sp, &_photon_thread_stub, th);
AtomicRunQ arq(rq);
th->vcpu = arq.vcpu;
Expand Down

0 comments on commit 4e4ea90

Please sign in to comment.