Skip to content

Commit

Permalink
Merge pull request idealvin#236 from shuai132/master
Browse files Browse the repository at this point in the history
fix some build warning
  • Loading branch information
idealvin authored Jul 1, 2022
2 parents b09d66c + 605cfef commit 0e39195
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
else()
add_compile_options(-Wall -O2 -g -Wno-sign-compare -Wno-class-memaccess -Wno-strict-aliasing)
add_compile_options(-Wall -O2 -g -Wno-sign-compare -Wno-strict-aliasing)
if(APPLE)
add_compile_options(-fno-pie)
endif()
Expand Down
1 change: 0 additions & 1 deletion include/co/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ class __coapi Client final {
};
uint16 _port;
uint8 _use_ssl;
uint8 _;
int _fd;
};

Expand Down
2 changes: 1 addition & 1 deletion src/co/hook.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class Hook {
return s >= 0 ? &tb[s] : NULL;
}

bool hook_sleep;
co::table<HookCtx> tb;
bool hook_sleep;
};

} // co
Expand Down
4 changes: 4 additions & 0 deletions src/co/hook.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#pragma once

#ifdef __APPLE__
#include "TargetConditionals.h"
#endif

namespace co {
void disable_hook_sleep();
void enable_hook_sleep();
Expand Down
32 changes: 16 additions & 16 deletions src/json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,15 @@ bool Parser::parse(S b, S e, void_ptr_t& val) {

static inline const char* init_s2e_table() {
static char tb[256] = { 0 };
tb['r'] = '\r';
tb['n'] = '\n';
tb['t'] = '\t';
tb['b'] = '\b';
tb['f'] = '\f';
tb['"'] = '"';
tb['\\'] = '\\';
tb['/'] = '/';
tb['u'] = 'u';
tb[(unsigned char)'r'] = '\r';
tb[(unsigned char)'n'] = '\n';
tb[(unsigned char)'t'] = '\t';
tb[(unsigned char)'b'] = '\b';
tb[(unsigned char)'f'] = '\f';
tb[(unsigned char)'"'] = '"';
tb[(unsigned char)'\\'] = '\\';
tb[(unsigned char)'/'] = '/';
tb[(unsigned char)'u'] = 'u';
return tb;
}

Expand Down Expand Up @@ -615,13 +615,13 @@ bool Json::parse_from(const char* s, size_t n) {

static inline const char* init_e2s_table() {
static char tb[256] = { 0 };
tb['\r'] = 'r';
tb['\n'] = 'n';
tb['\t'] = 't';
tb['\b'] = 'b';
tb['\f'] = 'f';
tb['\"'] = '"';
tb['\\'] = '\\';
tb[(unsigned char)'\r'] = 'r';
tb[(unsigned char)'\n'] = 'n';
tb[(unsigned char)'\t'] = 't';
tb[(unsigned char)'\b'] = 'b';
tb[(unsigned char)'\f'] = 'f';
tb[(unsigned char)'\"'] = '"';
tb[(unsigned char)'\\'] = '\\';
return tb;
}

Expand Down
3 changes: 3 additions & 0 deletions src/log/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ bool Logger::start() {
if ((uint32)ls > (bs >> 2)) ls = (int32)(bs >> 2);
return true;
}();
(void)x;

if (atomic_bool_cas(&_log_thread, (void*)0, (void*)8)) {
global().log_time->update();
Expand Down Expand Up @@ -429,6 +430,7 @@ void Logger::write_tlogs(co::array<PerTopic*>& v, LogTime* t) {

void Logger::push(char* s, size_t n) {
static bool ks = this->start();
(void)ks;
if (!_stop) {
if (unlikely(n > (uint32)FLG_max_log_size)) {
n = FLG_max_log_size;
Expand Down Expand Up @@ -459,6 +461,7 @@ void Logger::push(char* s, size_t n) {

void Logger::push(const char* topic, char* s, size_t n) {
static bool ks = this->start();
(void)ks;
if (!_stop) {
if (unlikely(n > (uint32)FLG_max_log_size)) {
n = FLG_max_log_size;
Expand Down
4 changes: 4 additions & 0 deletions src/log/stack_trace.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef _WIN32
#include "stack_trace.h"

#ifdef __APPLE__
#include "TargetConditionals.h"
#endif

// We do not support stack trace on IOS, ANDROID
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR || defined(__ANDROID__) || !defined(HAS_BACKTRACE_H)
namespace ___ {
Expand Down
1 change: 0 additions & 1 deletion unitest/fastream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ DEF_test(fastream) {
EXPECT_EQ(fs.str(), "");

s = x.data();
x = std::move(x);
EXPECT_EQ(x.str(), "xx");
EXPECT_EQ(x.data(), s);

Expand Down
2 changes: 1 addition & 1 deletion xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ elseif is_plat("mingw") then
set_optimize("faster")
else
set_optimize("faster") -- faster: -O2 fastest: -O3 none: -O0
--add_cxflags("-Wno-narrowing", "-Wno-sign-compare", "-Wno-class-memaccess", "-Wno-strict-aliasing")
--add_cxflags("-Wno-narrowing", "-Wno-sign-compare", "-Wno-strict-aliasing")
if is_plat("macosx", "iphoneos") then
add_cxflags("-fno-pie")
end
Expand Down

0 comments on commit 0e39195

Please sign in to comment.