Fix CentOS 6 build failures
testrules.cc had a signed to unsigned comparison and it used lambda functions (which are not supported in CentOS 6). The keywords struct in hintparser.cc needed to be declared static in order for it to compile.
This commit is contained in:
		
							
								
								
									
										28
									
								
								server/modules/filter/cache/test/testrules.cc
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								server/modules/filter/cache/test/testrules.cc
									
									
									
									
										vendored
									
									
								
							@ -197,7 +197,7 @@ int test_store()
 | 
			
		||||
{
 | 
			
		||||
    int errors = 0;
 | 
			
		||||
 | 
			
		||||
    for (size_t i = 0; i < n_store_test_cases; ++i)
 | 
			
		||||
    for (int i = 0; i < n_store_test_cases; ++i)
 | 
			
		||||
    {
 | 
			
		||||
        printf("TC      : %d\n", (int)(i + 1));
 | 
			
		||||
        const struct store_test_case& test_case = store_test_cases[i];
 | 
			
		||||
@ -306,13 +306,28 @@ struct ARRAY_TEST_CASE
 | 
			
		||||
 | 
			
		||||
const int n_array_test_cases = sizeof(array_test_cases) / sizeof(array_test_cases[0]);
 | 
			
		||||
 | 
			
		||||
typedef CacheRules::SCacheRules SCacheRules;
 | 
			
		||||
std::vector<SCacheRules> rules;
 | 
			
		||||
 | 
			
		||||
struct ShouldStore
 | 
			
		||||
{
 | 
			
		||||
    ShouldStore(GWBUF* buf):
 | 
			
		||||
        pStmt(buf)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool operator()(SCacheRules sRules)
 | 
			
		||||
    {
 | 
			
		||||
        return sRules->should_store(NULL, pStmt);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    GWBUF* pStmt;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int test_array_store()
 | 
			
		||||
{
 | 
			
		||||
    int errors = 0;
 | 
			
		||||
 | 
			
		||||
    typedef CacheRules::SCacheRules SCacheRules;
 | 
			
		||||
    std::vector<SCacheRules> rules;
 | 
			
		||||
 | 
			
		||||
    if (CacheRules::parse(ARRAY_RULES, 0, &rules))
 | 
			
		||||
    {
 | 
			
		||||
        for (int i = 0; i < n_array_test_cases; ++i)
 | 
			
		||||
@ -322,10 +337,7 @@ int test_array_store()
 | 
			
		||||
            cout << tc.zStmt << endl;
 | 
			
		||||
 | 
			
		||||
            GWBUF* pStmt = create_gwbuf(tc.zStmt);
 | 
			
		||||
            auto it = std::find_if(rules.begin(), rules.end(), [pStmt](SCacheRules sRules)
 | 
			
		||||
                                   {
 | 
			
		||||
                                       return sRules->should_store(NULL, pStmt);
 | 
			
		||||
                                   });
 | 
			
		||||
            auto it = std::find_if(rules.begin(), rules.end(), ShouldStore(pStmt));
 | 
			
		||||
 | 
			
		||||
            int index = (it == rules.end()) ? -1 : std::distance(rules.begin(), it);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * The keywords in the hint syntax
 | 
			
		||||
 */
 | 
			
		||||
struct
 | 
			
		||||
static struct
 | 
			
		||||
{
 | 
			
		||||
    const char *keyword;
 | 
			
		||||
    TOKEN_VALUE token;
 | 
			
		||||
@ -51,23 +51,6 @@ struct
 | 
			
		||||
    { "server", TOK_SERVER},
 | 
			
		||||
    { NULL, static_cast<TOKEN_VALUE>(0)}
 | 
			
		||||
};
 | 
			
		||||
/**
 | 
			
		||||
HINT_TOKEN kwords[] = {
 | 
			
		||||
        { TOK_MAXSCALE, "maxscale" },
 | 
			
		||||
        { TOK_PREPARE,  "prepare" },
 | 
			
		||||
        { TOK_START,    "start" },
 | 
			
		||||
        { TOK_START,    "begin" },
 | 
			
		||||
        { TOK_STOP,     "stop" },
 | 
			
		||||
        { TOK_STOP,     "end" },
 | 
			
		||||
        { TOK_EQUAL,    "=" },
 | 
			
		||||
        { TOK_ROUTE,    "route" },
 | 
			
		||||
        { TOK_TO,       "to" },
 | 
			
		||||
        { TOK_MASTER,   "master" },
 | 
			
		||||
        { TOK_SLAVE,    "slave" },
 | 
			
		||||
        { TOK_SERVER,   "server" },
 | 
			
		||||
        { 0,            NULL}
 | 
			
		||||
};
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static HINT_TOKEN *hint_next_token(GWBUF **buf, char **ptr);
 | 
			
		||||
static void hint_pop(HINT_SESSION *);
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user