Merge pull request #3751 from sysown/fix-c99-issues-v2

add -std=c11 flag
pull/3305/head
René Cannaò 4 years ago committed by GitHub
commit 40aa84fc80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -123,18 +123,13 @@ MYCXXFLAGS=-std=c++11 $(MYCFLAGS) $(PSQLCH) $(ENABLE_EPOLL)
default: libproxysql.a
.PHONY: default
_OBJ = c_tokenizer.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
_OBJ_CXX = ProxySQL_GloVars.oo network.oo debug.oo configfile.oo Query_Cache.oo SpookyV2.oo MySQL_Authentication.oo gen_utils.oo sqlite3db.oo mysql_connection.oo MySQL_HostGroups_Manager.oo mysql_data_stream.oo MySQL_Thread.oo MySQL_Session.oo MySQL_Protocol.oo mysql_backend.oo Query_Processor.oo ProxySQL_Admin.oo ProxySQL_Config.oo ProxySQL_Restapi.oo MySQL_Monitor.oo MySQL_Logger.oo thread.oo MySQL_PreparedStatement.oo ProxySQL_Cluster.oo ClickHouse_Authentication.oo ClickHouse_Server.oo ProxySQL_Statistics.oo Chart_bundle_js.oo ProxySQL_HTTP_Server.oo ProxySQL_RESTAPI_Server.oo font-awesome.min.css.oo main-bundle.min.css.oo set_parser.oo MySQL_Variables.oo
_OBJ_CXX = ProxySQL_GloVars.oo network.oo debug.oo configfile.oo Query_Cache.oo SpookyV2.oo MySQL_Authentication.oo gen_utils.oo sqlite3db.oo mysql_connection.oo MySQL_HostGroups_Manager.oo mysql_data_stream.oo MySQL_Thread.oo MySQL_Session.oo MySQL_Protocol.oo mysql_backend.oo Query_Processor.oo ProxySQL_Admin.oo ProxySQL_Config.oo ProxySQL_Restapi.oo MySQL_Monitor.oo MySQL_Logger.oo thread.oo MySQL_PreparedStatement.oo ProxySQL_Cluster.oo ClickHouse_Authentication.oo ClickHouse_Server.oo ProxySQL_Statistics.oo Chart_bundle_js.oo ProxySQL_HTTP_Server.oo ProxySQL_RESTAPI_Server.oo font-awesome.min.css.oo main-bundle.min.css.oo set_parser.oo MySQL_Variables.oo c_tokenizer.oo
OBJ_CXX = $(patsubst %,$(ODIR)/%,$(_OBJ_CXX))
HEADERS = ../include/*.h ../include/*.hpp
%.ko: %.cpp $(HEADERS)
$(CXX) -fPIC -c -o $@ $< $(MYCXXFLAGS) $(CXXFLAGS)
$(ODIR)/%.o: %.c $(HEADERS)
$(CC) -fPIC -c -o $@ $< $(MYCFLAGS) $(CFLAGS)
$(ODIR)/%.oo: %.cpp $(HEADERS)
$(CXX) -fPIC -c -o $@ $< $(MYCXXFLAGS) $(CXXFLAGS)

@ -742,12 +742,12 @@ char *mysql_query_digest_and_first_comment(char *s, int _len, char **first_comme
int str_len = p_r - p_r_t + 1;
int collapsed = 0;
for (int i = 0; i < str_len; i++) {
char* const c_p_r_t = ((char*)p_r_t + i);
char* const n_p_r_t = ((char*)p_r_t + i + 1);
for (int j = 0; j < str_len; j++) {
char* const c_p_r_t = ((char*)p_r_t + j);
char* const n_p_r_t = ((char*)p_r_t + j + 1);
if (is_digit_char(*c_p_r_t) && is_digit_char(*n_p_r_t)) {
memmove(c_p_r_t, c_p_r_t + 1, str_len - i);
memmove(c_p_r_t, c_p_r_t + 1, str_len - j);
collapsed += 1;
}
}
@ -755,8 +755,8 @@ char *mysql_query_digest_and_first_comment(char *s, int _len, char **first_comme
p_r -= collapsed;
int new_str_len = p_r - p_r_t + 1;
for (int i = 0; i < new_str_len; i++) {
char* const c_p_r_t = ((char*)p_r_t + i);
for (int j = 0; j < new_str_len; j++) {
char* const c_p_r_t = ((char*)p_r_t + j);
if (is_digit_char(*c_p_r_t)) {
*c_p_r_t = '?';
}
@ -2388,10 +2388,12 @@ char* mysql_query_digest_first_stage(const char* const q, int q_len, char** cons
get_options(&opts);
// state shared between all the parsing states
struct shared_st shared_st = { 0 };
struct shared_st shared_st;
memset(&shared_st, 0, sizeof(struct shared_st));
init_shared_st(&shared_st, q, q_len, d_max_len, res);
struct stage_1_st stage_1_st = { 0 };
memset(&stage_1_st, 0, sizeof(struct stage_1_st));
init_stage_1_st(&stage_1_st);
// perform just the first stage parsing
@ -2422,12 +2424,15 @@ char* mysql_query_digest_second_stage(const char* const q, int q_len, char** con
get_options(&opts);
// state shared between all the parsing states
struct shared_st shared_st = { 0 };
struct shared_st shared_st;
memset(&shared_st, 0, sizeof(struct shared_st));
init_shared_st(&shared_st, q, q_len, d_max_len, res);
struct stage_1_st stage_1_st = { 0 };
struct stage_1_st stage_1_st;
memset(&stage_1_st, 0, sizeof(struct stage_1_st));
init_stage_1_st(&stage_1_st);
struct stage_2_st stage_2_st = { 0 };
struct stage_2_st stage_2_st;
memset(&stage_2_st, 0, sizeof(struct stage_2_st));
// perform just the first stage parsing
stage_1_parsing(&shared_st, &stage_1_st, &opts, fst_cmnt);
@ -2474,15 +2479,20 @@ char* mysql_query_digest_and_first_comment_2(const char* const q, int q_len, cha
get_options(&opts);
// state shared between all the parsing states
struct shared_st shared_st = { 0 };
struct shared_st shared_st;
memset(&shared_st, 0, sizeof(struct shared_st));
init_shared_st(&shared_st, q, q_len, d_max_len, res);
// individual states for stages
struct stage_1_st stage_1_st = { 0 };
struct stage_1_st stage_1_st;
memset(&stage_1_st, 0, sizeof(struct stage_1_st));
init_stage_1_st(&stage_1_st);
struct stage_2_st stage_2_st = { 0 };
struct stage_3_st stage_3_st = { 0 };
struct stage_4_st stage_4_st = { 0 };
struct stage_2_st stage_2_st;
struct stage_3_st stage_3_st;
struct stage_4_st stage_4_st;
memset(&stage_2_st, 0, sizeof(struct stage_2_st));
memset(&stage_3_st, 0, sizeof(struct stage_3_st));
memset(&stage_4_st, 0, sizeof(struct stage_4_st));
char min_digest_size = 0;
@ -2766,7 +2776,8 @@ char* mysql_query_digest_and_first_comment_one_it(char* q, int q_len, char** fst
get_options(&opts);
// state shared between all the parsing states
struct shared_st shared_st = { 0 };
struct shared_st shared_st;
memset(&shared_st, 0, sizeof(struct shared_st));
shared_st.q = q;
shared_st.q_len = q_len;
shared_st.d_max_len = d_max_len;
@ -2776,9 +2787,12 @@ char* mysql_query_digest_and_first_comment_one_it(char* q, int q_len, char** fst
shared_st.res_pre_pos = res;
// state required between different iterations of special parsing states
struct cmnt_type_1_st c_t_1_st = { 0 };
struct literal_string_st literal_str_st = { 0 };
struct literal_digit_st literal_digit_st = { 0 };
struct cmnt_type_1_st c_t_1_st;
struct literal_string_st literal_str_st;
struct literal_digit_st literal_digit_st;
memset(&c_t_1_st, 0, sizeof(struct cmnt_type_1_st));
memset(&literal_str_st, 0, sizeof(struct literal_string_st));
memset(&literal_digit_st, 0, sizeof(struct literal_digit_st));
enum p_st cur_st = st_no_mark_found;
Loading…
Cancel
Save